code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_14) on Wed May 30 20:32:13 CEST 2012 -->
<TITLE>
ARBInternalformatQuery (LWJGL API)
</TITLE>
<META NAME="date" CONTENT="2012-05-30">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ARBInternalformatQuery (LWJGL API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ARBInternalformatQuery.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../org/lwjgl/opengl/ARBInstancedArrays.html" title="class in org.lwjgl.opengl"><B>PREV CLASS</B></A>
<A HREF="../../../org/lwjgl/opengl/ARBMapBufferAlignment.html" title="class in org.lwjgl.opengl"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/lwjgl/opengl/ARBInternalformatQuery.html" target="_top"><B>FRAMES</B></A>
<A HREF="ARBInternalformatQuery.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.lwjgl.opengl</FONT>
<BR>
Class ARBInternalformatQuery</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.lwjgl.opengl.ARBInternalformatQuery</B>
</PRE>
<HR>
<DL>
<DT><PRE>public final class <B>ARBInternalformatQuery</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/lwjgl/opengl/ARBInternalformatQuery.html#GL_NUM_SAMPLE_COUNTS">GL_NUM_SAMPLE_COUNTS</A></B></CODE>
<BR>
Accepted by the <pname> parameter of GetInternalformativ:</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/lwjgl/opengl/ARBInternalformatQuery.html#glGetInternalformat(int, int, int)">glGetInternalformat</A></B>(int target,
int internalformat,
int pname)</CODE>
<BR>
Overloads glGetInternalformativ.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/lwjgl/opengl/ARBInternalformatQuery.html#glGetInternalformat(int, int, int, java.nio.IntBuffer)">glGetInternalformat</A></B>(int target,
int internalformat,
int pname,
java.nio.IntBuffer params)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="GL_NUM_SAMPLE_COUNTS"><!-- --></A><H3>
GL_NUM_SAMPLE_COUNTS</H3>
<PRE>
public static final int <B>GL_NUM_SAMPLE_COUNTS</B></PRE>
<DL>
<DD>Accepted by the <pname> parameter of GetInternalformativ:
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.lwjgl.opengl.ARBInternalformatQuery.GL_NUM_SAMPLE_COUNTS">Constant Field Values</A></DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="glGetInternalformat(int, int, int, java.nio.IntBuffer)"><!-- --></A><H3>
glGetInternalformat</H3>
<PRE>
public static void <B>glGetInternalformat</B>(int target,
int internalformat,
int pname,
java.nio.IntBuffer params)</PRE>
<DL>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="glGetInternalformat(int, int, int)"><!-- --></A><H3>
glGetInternalformat</H3>
<PRE>
public static int <B>glGetInternalformat</B>(int target,
int internalformat,
int pname)</PRE>
<DL>
<DD>Overloads glGetInternalformativ.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ARBInternalformatQuery.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../org/lwjgl/opengl/ARBInstancedArrays.html" title="class in org.lwjgl.opengl"><B>PREV CLASS</B></A>
<A HREF="../../../org/lwjgl/opengl/ARBMapBufferAlignment.html" title="class in org.lwjgl.opengl"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/lwjgl/opengl/ARBInternalformatQuery.html" target="_top"><B>FRAMES</B></A>
<A HREF="ARBInternalformatQuery.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<i>Copyright © 2002-2009 lwjgl.org. All Rights Reserved.</i>
</BODY>
</HTML>
|
Glynn-Taylor/9-Gates
|
lib/javadoc/org/lwjgl/opengl/ARBInternalformatQuery.html
|
HTML
|
gpl-3.0
| 11,533 |
/*
Unix SMB/CIFS implementation.
SMB torture tester
Copyright (C) Jelmer Vernooij 2006
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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "libcli/smb2/smb2.h"
#include "torture/smbtorture.h"
#include "torture/smb2/proto.h"
#include "../lib/util/dlinklist.h"
static bool wrap_simple_1smb2_test(struct torture_context *torture_ctx,
struct torture_tcase *tcase,
struct torture_test *test)
{
bool (*fn) (struct torture_context *, struct smb2_tree *);
bool ret;
struct smb2_tree *tree1;
if (!torture_smb2_connection(torture_ctx, &tree1))
return false;
fn = test->fn;
ret = fn(torture_ctx, tree1);
talloc_free(tree1);
return ret;
}
struct torture_test *torture_suite_add_1smb2_test(struct torture_suite *suite,
const char *name,
bool (*run)(struct torture_context *,
struct smb2_tree *))
{
struct torture_test *test;
struct torture_tcase *tcase;
tcase = torture_suite_add_tcase(suite, name);
test = talloc(tcase, struct torture_test);
test->name = talloc_strdup(test, name);
test->description = NULL;
test->run = wrap_simple_1smb2_test;
test->fn = run;
test->dangerous = false;
DLIST_ADD_END(tcase->tests, test, struct torture_test *);
return test;
}
static bool wrap_simple_2smb2_test(struct torture_context *torture_ctx,
struct torture_tcase *tcase,
struct torture_test *test)
{
bool (*fn) (struct torture_context *, struct smb2_tree *, struct smb2_tree *);
bool ret;
struct smb2_tree *tree1;
struct smb2_tree *tree2;
TALLOC_CTX *mem_ctx = talloc_new(torture_ctx);
if (!torture_smb2_connection(torture_ctx, &tree1) ||
!torture_smb2_connection(torture_ctx, &tree2)) {
return false;
}
talloc_steal(mem_ctx, tree1);
talloc_steal(mem_ctx, tree2);
fn = test->fn;
ret = fn(torture_ctx, tree1, tree2);
/* the test may already closed some of the connections */
talloc_free(mem_ctx);
return ret;
}
struct torture_test *torture_suite_add_2smb2_test(struct torture_suite *suite,
const char *name,
bool (*run)(struct torture_context *,
struct smb2_tree *,
struct smb2_tree *))
{
struct torture_test *test;
struct torture_tcase *tcase;
tcase = torture_suite_add_tcase(suite, name);
test = talloc(tcase, struct torture_test);
test->name = talloc_strdup(test, name);
test->description = NULL;
test->run = wrap_simple_2smb2_test;
test->fn = run;
test->dangerous = false;
DLIST_ADD_END(tcase->tests, test, struct torture_test *);
return test;
}
NTSTATUS torture_smb2_init(void)
{
struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "SMB2");
torture_suite_add_simple_test(suite, "CONNECT", torture_smb2_connect);
torture_suite_add_simple_test(suite, "SCAN", torture_smb2_scan);
torture_suite_add_simple_test(suite, "SCANGETINFO", torture_smb2_getinfo_scan);
torture_suite_add_simple_test(suite, "SCANSETINFO", torture_smb2_setinfo_scan);
torture_suite_add_simple_test(suite, "SCANFIND", torture_smb2_find_scan);
torture_suite_add_simple_test(suite, "GETINFO", torture_smb2_getinfo);
torture_suite_add_simple_test(suite, "SETINFO", torture_smb2_setinfo);
torture_suite_add_suite(suite, torture_smb2_lock_init());
torture_suite_add_suite(suite, torture_smb2_read_init());
torture_suite_add_suite(suite, torture_smb2_create_init());
torture_suite_add_suite(suite, torture_smb2_acls_init());
torture_suite_add_suite(suite, torture_smb2_notify_init());
torture_suite_add_suite(suite, torture_smb2_durable_open_init());
torture_suite_add_suite(suite, torture_smb2_dir_init());
torture_suite_add_suite(suite, torture_smb2_lease_init());
torture_suite_add_suite(suite, torture_smb2_compound_init());
torture_suite_add_suite(suite, torture_smb2_oplocks_init());
torture_suite_add_suite(suite, torture_smb2_streams_init());
torture_suite_add_1smb2_test(suite, "BENCH-OPLOCK", test_smb2_bench_oplock);
torture_suite_add_1smb2_test(suite, "HOLD-OPLOCK", test_smb2_hold_oplock);
suite->description = talloc_strdup(suite, "SMB2-specific tests");
torture_register_suite(suite);
return NT_STATUS_OK;
}
|
opinkerfi/winexe
|
source4/torture/smb2/smb2.c
|
C
|
gpl-3.0
| 4,748 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
"""
Execute tests
"""
from django.test import TestCase
from fingerprint.models import *
class TestFingerprint(TestCase):
def setUp(self):
pass
def test_list_all_databases(self):
fp = FingerprintDescription("66a47f694ffb676bf7676dfde24900e6")
pass
|
bioinformatics-ua/catalogue
|
emif/fingerprint/tests.py
|
Python
|
gpl-3.0
| 1,057 |
# $Id: cluster_ensemble.py 3078 2016-04-06 19:46:43Z schowell $
import numpy
import time
import os
import sasmol.sasmol as sasmol
import sassie.calculate.convergence_test as convergence_test
try:
dummy = os.environ["DISPLAY"]
except:
# allows for creating plots without an xserver
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def com_clustering(pdb_file_name, dcd_file_names, output_prefix=None,
voxel_size=5.0, show=False, create=False):
'''
Clustering routine for identifying grouping structures within
an ensemble. Uses the center of mass of the entire structure to
differentiate one from another.
This may be improved by using the center of mass of a certain region.
'''
if output_prefix:
output_prefix += '_%dA' % int(voxel_size)
else:
output_prefix = '%s_cluster_%dA' % (pdb_file_name[:-4],
int(voxel_size))
mol = sasmol.SasMol(0)
mol.read_pdb(pdb_file_name)
com_coors = []
new_voxels = []
occupied_voxels = []
number_occupied_voxels = 0
voxel_set = set([])
tic = time.time()
if create:
subset_mol = sasmol.SasMol(0)
subset_mol.read_pdb(pdb_file_name)
output_dcd = subset_mol.open_dcd_write(output_prefix + '.dcd')
i = 0
for (i_dcd, dcd_file_name) in enumerate(dcd_file_names):
print 'processing dcd: %s\n' % dcd_file_name
input_dcd = mol.open_dcd_read(dcd_file_name)
number_of_frames = input_dcd[2]
for frame in xrange(number_of_frames):
mol.read_dcd_step(input_dcd, frame)
com_coors.append(mol.calccom(0))
mol.close_dcd_read(input_dcd[0])
this_dcd_new_voxels = convergence_test.count_new_spatial_voxels(
com_coors, voxel_set, voxel_size)
number_occupied_voxels += this_dcd_new_voxels
new_voxels.append(this_dcd_new_voxels)
occupied_voxels.append(number_occupied_voxels)
# select out the dcd_frames and save them to a new dcd file
if create:
voxel_list = list(voxel_set)
voxel_number = numpy.array(com_coors)/voxel_size
dcd_frames = []
for voxel in voxel_list:
v_diff = voxel_number-voxel
i_min = numpy.argmin(numpy.sqrt(v_diff[:,0]**2 + v_diff[:,1]**2
+ v_diff[:,2]**2))
dcd_frames.append(i_min)
dcd_frames_file = dcd_file_name.replace('.dcd', '_cluster_%dA.dat'
% voxel_size)
numpy.savetxt(dcd_frames_file, dcd_frames, fmt='%d')
input_dcd = subset_mol.open_dcd_read(dcd_file_name)
number_of_frames = input_dcd[2]
for frame in xrange(number_of_frames):
subset_mol.read_dcd_step(input_dcd, frame)
if frame in dcd_frames:
i += 1
subset_mol.write_dcd_step(output_dcd, 0, i)
subset_mol.close_dcd_read(input_dcd[0])
if create:
subset_mol.close_dcd_write(output_dcd)
toc = time.time() - tic
print "\ntime used: ", toc
# convergence_test.plot_convergence(new_voxels, dcd_file_names,
# occupied_voxels, output_prefix)
return number_occupied_voxels
def voxel_scan(pdb_file_name, dcd_file_names, voxel_range,
output_prefix=None, show=False, create=False):
if not output_prefix:
output_prefix = '%s_cluster' % pdb_file_name[:-4]
occupied_voxels = numpy.zeros((len(voxel_range), 2), dtype='int64')
for (i, voxel_size) in enumerate(voxel_range):
occupied_voxels[i, 0] = voxel_size
occupied_voxels[i, 1] = com_clustering(pdb_file_name, dcd_file_names,
output_prefix=output_prefix,
voxel_size=voxel_size,
show=show, create=create)
output_prefix = os.path.join(os.getcwd(), output_prefix)
out_name = output_prefix + '.dat'
numpy.savetxt(out_name, occupied_voxels, fmt='%d')
ax = plt.subplot(111)
plt.plot(occupied_voxels[:,0], occupied_voxels[:,1])
ax.set_yscale('log')
plt.xlabel(r'voxel size ($\AA$)')
plt.ylabel('occupied voxels')
plot_name = output_prefix
plt.savefig(plot_name + '.eps', dpi=400, bbox_inches='tight')
plt.savefig(plot_name + '.png', dpi=400, bbox_inches='tight')
if show:
plt.show()
|
madscatt/zazzie
|
src_2.7/scripts/cluster_ensemble.py
|
Python
|
gpl-3.0
| 4,622 |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost/" />
<title>StickyCheckBoxUsingPagination</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Mass Edit</td></tr>
</thead><tbody>
<tr>
<td>setTimeout</td>
<td>45000</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>index.php/opportunities/default?clearingSearch=1</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Advanced</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>list-view-rowSelector_0</td>
<td>off</td>
</tr>
<tr>
<td>click</td>
<td>list-view-rowSelector_0</td>
<td></td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>verifyValue</td>
<td>list-view-rowSelector_0</td>
<td>on</td>
</tr>
<tr>
<td>open</td>
<td>index.php/opportunities/default</td>
<td></td>
</tr>
<tr>
<td>assertEditable</td>
<td>list-view-rowSelector_0</td>
<td></td>
</tr>
<tr>
<td>assertEditable</td>
<td>list-view-rowSelector_1</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>list-view-rowSelector_all</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>list-view-rowSelector_0</td>
<td>on</td>
</tr>
<tr>
<td>verifyValue</td>
<td>list-view-rowSelector_1</td>
<td>on</td>
</tr>
<tr>
<td>open</td>
<td>index.php/opportunities/default</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>list-view-rowSelector_0</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>list-view-rowSelector_1</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//ul[@id='ListViewMassActionMenu']/li/ul/li[1]/a/span[2]</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>2 records selected for updating</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>MassEdit_owner</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>save</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Owner cannot be blank.</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>MassEdit_owner</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>MassEdit_source</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>Opportunity_source_value</td>
<td>label=Inbound Call</td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>save</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>//div[@id='list-view']/table/tbody/tr[1]/td[2]/a</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>waitForText</td>
<td>//div[@id='OpportunityEditAndDetailsView']/div/div/table/tbody/tr[7]/td</td>
<td>Inbound Call</td>
</tr>
<tr>
<td>open</td>
<td>index.php/opportunities/default</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>click</td>
<td>//ul[@id='ListViewMassActionMenu']/li/ul/li[1]/a/span[2]</td>
<td></td>
</tr>
<tr>
<td>waitForCondition</td>
<td>selenium.browserbot.getCurrentWindow().jQuery.active == 0</td>
<td>30000</td>
</tr>
<tr>
<td>assertAlert</td>
<td>You must select at least one record</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
|
nezaboravi/zurmopagoda
|
app/protected/modules/opportunities/tests/functional/cases/MassEdit.html
|
HTML
|
gpl-3.0
| 4,844 |
-- 59
-- UCColumnA
-- Added UNIQUE to column TEMP_F in table Stats
CREATE TABLE "Station" (
"ID" INT PRIMARY KEY,
"CITY" CHAR(20),
"STATE" CHAR(2),
"LAT_N" INT NOT NULL,
"LONG_W" INT NOT NULL,
CHECK ("LAT_N" BETWEEN 0 AND 90),
CHECK ("LONG_W" BETWEEN -180 AND 180)
)
CREATE TABLE "Stats" (
"ID" INT REFERENCES "Station" ("ID"),
"MONTH" INT NOT NULL,
"TEMP_F" INT UNIQUE NOT NULL,
"RAIN_I" INT NOT NULL,
PRIMARY KEY ("ID", "MONTH"),
CHECK ("MONTH" BETWEEN 1 AND 12),
CHECK ("TEMP_F" BETWEEN 80 AND 150),
CHECK ("RAIN_I" BETWEEN 0 AND 100)
)
|
schemaanalyst-team/schemaanalyst
|
src/paper/ineffectivemutants/manualevaluation/mutants/NistWeather_SQLite/59.sql
|
SQL
|
gpl-3.0
| 559 |
/*
* Copyright (C) 2008, 2010 Free Software Foundation, Inc.
*
* Author: Simon Josefsson
*
* This file is part of GnuTLS.
*
* The GnuTLS 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
*
*/
/* Functions to support draft-ietf-netconf-tls-01.txt. */
#include <gnutls_int.h>
#include <gnutls_hash_int.h>
#include <gnutls_errors.h>
#ifdef ENABLE_PSK
/**
* gnutls_psk_netconf_derive_key:
* @password: zero terminated string containing password.
* @psk_identity: zero terminated string with PSK identity.
* @psk_identity_hint: zero terminated string with PSK identity hint.
* @output_key: output variable, contains newly allocated *data pointer.
*
* This function will derive a PSK key from a password, for use with
* the Netconf protocol.
*
* Returns: %GNUTLS_E_SUCCESS on success, or an error code.
*
* Since: 2.4.0
*
* Deprecated: The need for this interface was dropped from the
* standard on publication as a RFC. The function works now but will
* return a hard failure in a future release.
*/
int
gnutls_psk_netconf_derive_key (const char *password,
const char *psk_identity,
const char *psk_identity_hint,
gnutls_datum_t * output_key)
{
const char netconf_key_pad[] = "Key Pad for Netconf";
size_t sha1len = _gnutls_hash_get_algo_len (GNUTLS_DIG_SHA1);
size_t hintlen = strlen (psk_identity_hint);
digest_hd_st dig;
char *inner;
size_t innerlen;
int rc;
/*
* PSK = SHA-1(SHA-1(psk_identity + "Key Pad for Netconf" + password) +
* psk_identity_hint)
*
*/
rc = _gnutls_hash_init (&dig, GNUTLS_DIG_SHA1);
if (rc < 0)
{
gnutls_assert ();
return rc;
}
rc = _gnutls_hash (&dig, psk_identity, strlen (psk_identity));
if (rc < 0)
{
gnutls_assert ();
_gnutls_hash_deinit (&dig, NULL);
return rc;
}
rc = _gnutls_hash (&dig, netconf_key_pad, strlen (netconf_key_pad));
if (rc < 0)
{
gnutls_assert ();
_gnutls_hash_deinit (&dig, NULL);
return rc;
}
rc = _gnutls_hash (&dig, password, strlen (password));
if (rc < 0)
{
gnutls_assert ();
_gnutls_hash_deinit (&dig, NULL);
return rc;
}
innerlen = sha1len + hintlen;
inner = gnutls_malloc (innerlen);
_gnutls_hash_deinit (&dig, inner);
if (inner == NULL)
{
gnutls_assert ();
return GNUTLS_E_MEMORY_ERROR;
}
memcpy (inner + sha1len, psk_identity_hint, hintlen);
rc = _gnutls_hash_init (&dig, GNUTLS_DIG_SHA1);
if (rc < 0)
{
gnutls_assert ();
gnutls_free (inner);
return rc;
}
rc = _gnutls_hash (&dig, inner, innerlen);
gnutls_free (inner);
if (rc < 0)
{
gnutls_assert ();
_gnutls_hash_deinit (&dig, NULL);
return rc;
}
output_key->data = gnutls_malloc (sha1len);
_gnutls_hash_deinit (&dig, output_key->data);
if (output_key->data == NULL)
{
gnutls_assert ();
return GNUTLS_E_MEMORY_ERROR;
}
output_key->size = sha1len;
return 0;
}
#endif /* ENABLE_PSK */
|
pexip/os-gnutls26
|
lib/gnutls_psk_netconf.c
|
C
|
gpl-3.0
| 3,781 |
/* parse a string containing a date and/or time */
#include "fb.h"
#include <ctype.h>
/*:::::*/
FBCALL int fb_DateTimeParse( FBSTRING *s,
int *pDay, int *pMonth, int *pYear,
int *pHour, int *pMinute, int *pSecond,
int want_date, int want_time)
{
const char *text;
int result = FALSE;
size_t length, text_len;
text = s->data;
text_len = FB_STRSIZE( s );
if( text == NULL ) {
return result;
}
if( fb_hDateParse( text, text_len, pDay, pMonth, pYear, &length ) ) {
text += length;
text_len -= length;
/* skip WS */
while( isspace( *text ) )
++text, --text_len;
/* skip optional comma */
if( *text==',' )
++text, --text_len;
if( fb_hTimeParse( text, text_len, pHour, pMinute, pSecond, &length ) ) {
text += length;
text_len -= length;
result = TRUE;
} else if( !want_time ) {
result = TRUE;
}
} else if( fb_hTimeParse( text, text_len, pHour, pMinute, pSecond, &length ) ) {
text += length;
text_len -= length;
/* skip WS */
while( isspace( *text ) )
++text, --text_len;
/* skip optional comma */
if( *text==',' )
++text, --text_len;
if( fb_hDateParse( text, text_len, pDay, pMonth, pYear, &length ) ) {
text += length;
text_len -= length;
result = TRUE;
} else if( !want_date ) {
result = TRUE;
}
}
if( result ) {
/* the rest of the text must consist of white spaces */
while( *text ) {
if( !isspace( *text++ ) ) {
result = FALSE;
break;
}
}
}
return result;
}
/*:::::*/
FBCALL int fb_DateParse( FBSTRING *s, int *pDay, int *pMonth, int *pYear )
{
return fb_DateTimeParse( s,
pDay, pMonth, pYear,
NULL, NULL, NULL,
TRUE, FALSE );
}
/*:::::*/
FBCALL int fb_TimeParse( FBSTRING *s, int *pHour, int *pMinute, int *pSecond )
{
return fb_DateTimeParse( s,
NULL, NULL, NULL,
pHour, pMinute, pSecond,
FALSE, TRUE );
}
|
rvega/pd-bbb-gpio
|
vendors/FreeBASIC-0.90.0-source/src/rtlib/time_parsedatetime.c
|
C
|
gpl-3.0
| 2,406 |
/*******************
* check and radio *
*******************/
/* draw regular check and radio items using our assets */
.check,
.check row:selected,
.check row:selected:focus {
-gtk-icon-source: url("assets/checkbox-unchecked.png");
}
.check:insensitive,
.check row:selected:insensitive,
.check row:selected:focus:insensitive {
-gtk-icon-source: url("assets/checkbox-unchecked-insensitive.png");
}
.check:active, .check:checked,
.check row:selected:active, .check row:selected:checked,
.check row:selected:focus:active, .check row:selected:focus:checked {
-gtk-icon-source: url("assets/checkbox-checked.png");
}
.check:active:hover, .check:checked:hover,
.check row:selected:active:hover, .check row:selected:checked:hover,
.check row:selected:focus:active:hover, .check row:selected:focus:checked:hover {
-gtk-icon-source: url("assets/checkbox-checked-hover.png");
}
.check:active:insensitive, .check:checked:insensitive,
.check row:selected:active:insensitive, .check row:selected:checked:insensitive,
.check row:selected:focus:active:insensitive, .check row:selected:focus:checked:insensitive {
-gtk-icon-source: url("assets/checkbox-checked-insensitive.png");
}
.check:inconsistent,
.check row:selected:inconsistent,
.check row:selected:focus:inconsistent {
-gtk-icon-source: url("assets/checkbox-mixed.png");
}
.check:inconsistent:hover,
.check row:selected:inconsistent:hover,
.check row:selected:focus:inconsistent:hover {
-gtk-icon-source: url("assets/checkbox-mixed-hover.png");
}
.check:inconsistent:insensitive,
.check row:selected:inconsistent:insensitive,
.check row:selected:focus:inconsistent:insensitive {
-gtk-icon-source: url("assets/checkbox-mixed-insensitive.png");
}
.radio,
.radio row:selected,
.radio row:selected:focus {
-gtk-icon-source: url("assets/radio-unselected.png");
}
.radio:insensitive,
.radio row:selected:insensitive,
.radio row:selected:focus:insensitive {
-gtk-icon-source: url("assets/radio-unselected-insensitive.png");
}
.radio:active, .radio:checked,
.radio row:selected:active, .radio row:selected:checked,
.radio row:selected:focus:active, .radio row:selected:focus:checked {
-gtk-icon-source: url("assets/radio-selected.png");
}
.radio:active:hover, .radio:checked:hover,
.radio row:selected:active:hover, .radio row:selected:checked:hover,
.radio row:selected:focus:active:hover, .radio row:selected:focus:checked:hover {
-gtk-icon-source: url("assets/radio-selected-hover.png");
}
.radio:active:insensitive, .radio:checked:insensitive,
.radio row:selected:active:insensitive, .radio row:selected:checked:insensitive,
.radio row:selected:focus:active:insensitive, .radio row:selected:focus:checked:insensitive {
-gtk-icon-source: url("assets/radio-selected-insensitive.png");
}
.radio:inconsistent,
.radio row:selected:inconsistent,
.radio row:selected:focus:inconsistent {
-gtk-icon-source: url("assets/radio-mixed.png");
}
.radio:inconsistent:hover,
.radio row:selected:inconsistent:hover,
.radio row:selected:focus:inconsistent:hover {
-gtk-icon-source: url("assets/radio-mixed-hover.png");
}
.radio:inconsistent:insensitive,
.radio row:selected:inconsistent:insensitive,
.radio row:selected:focus:inconsistent:insensitive {
-gtk-icon-source: url("assets/radio-mixed-insensitive.png");
}
.menuitem.check:active, .menuitem.check:checked {
-gtk-icon-source: url("assets/menuitem-checkbox-checked.png");
}
.menuitem.check:active:hover, .menuitem.check:checked:hover {
-gtk-icon-source: url("assets/menuitem-checkbox-checked-hover.png");
}
.menuitem.check:active:insensitive, .menuitem.check:checked:insensitive {
-gtk-icon-source: url("assets/menuitem-checkbox-checked-insensitive.png");
}
.menuitem.check:inconsistent:hover,
.menuitem.radio:inconsistent:hover {
-gtk-icon-source: url("assets/menuitem-checkbox-mixed-hover.png");
}
.menuitem.check:inconsistent,
.menuitem.radio:inconsistent {
-gtk-icon-source: url("assets/menuitem-checkbox-mixed.png");
}
.menuitem.check:inconsistent:insensitive,
.menuitem.radio:inconsistent:insensitive {
-gtk-icon-source: url("assets/menuitem-checkbox-mixed-insensitive.png");
}
.menuitem.radio:active, .menuitem.radio:checked {
-gtk-icon-source: url("assets/menuitem-radio-checked.png");
}
.menuitem.radio:active:hover, .menuitem.radio:checked:hover {
-gtk-icon-source: url("assets/menuitem-radio-checked-hover.png");
}
.menuitem.radio:active:insensitive, .menuitem.radio:checked:insensitive {
-gtk-icon-source: url("assets/menuitem-radio-checked-insensitive.png");
}
GtkIconView.content-view.cell.check {
-gtk-icon-source: url("assets/grid-selection-unchecked.png");
}
GtkIconView.content-view.cell.check:active, GtkIconView.content-view.cell.check:checked {
-gtk-icon-source: url("assets/grid-selection-checked.png");
}
/***************
* resize grip *
***************/
.grip {
background-image: url("assets/resize-grip.png");
}
/******************
* pane separator *
******************/
.pane-separator,
.pane-separator.horizontal {
background-image: url("assets/pane-separator.png");
background-repeat: no-repeat;
background-position: center center;
}
.pane-separator.vertical {
background-image: url("assets/pane-separator-vertical.png");
background-repeat: no-repeat;
background-position: center center;
}
|
kmathern/mx-greybird-themes
|
Greybird-thin-grip/gtk-3.0/gtk-widgets-assets.css
|
CSS
|
gpl-3.0
| 5,367 |
// ZipConstants.cs
//
// Copyright (C) 2001 Mike Krueger
// Copyright (C) 2004 John Reilly
//
// This file was translated from java, it was part of the GNU Classpath
// Copyright (C) 2001 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
// 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.
//
// Linking this library statically or dynamically with other modules is
// making a combined work based on this library. Thus, the terms and
// conditions of the GNU General Public License cover the whole
// combination.
//
// As a special exception, the copyright holders of this library give you
// permission to link this library with independent modules to produce an
// executable, regardless of the license terms of these independent
// modules, and to copy and distribute the resulting executable under
// terms of your choice, provided that you also meet, for each linked
// independent module, the terms and conditions of the license of that
// module. An independent module is a module which is not derived from
// or based on this library. If you modify this library, you may extend
// this exception to your version of the library, but you are not
// obligated to do so. If you do not wish to do so, delete this
// exception statement from your version.
using System;
using System.Text;
namespace ICSharpCode.SharpZipLib.Zip
{
/// <summary>
/// The kind of compression used for an entry in an archive
/// </summary>
public enum CompressionMethod
{
/// <summary>
/// A direct copy of the file contents is held in the archive
/// </summary>
Stored = 0,
/// <summary>
/// Common Zip compression method using a sliding dictionary
/// of up to 32KB and secondary compression from Huffman/Shannon-Fano trees
/// </summary>
Deflated = 8,
/// <summary>
/// An extension to deflate with a 64KB window. Not supported by #Zip
/// </summary>
Deflate64 = 9,
/// <summary>
/// Not supported by #Zip
/// </summary>
BZip2 = 11,
/// <summary>
/// WinZip special for AES encryption, Not supported by #Zip
/// </summary>
WinZipAES = 99,
}
/// <summary>
/// Defines the contents of the general bit flags field for an archive entry.
/// </summary>
[Flags]
enum GeneralBitFlags : int
{
/// <summary>
/// If set indicates that the file is encrypted
/// </summary>
Encrypted = 0x0001,
/// <summary>
/// Two bits defining the compression method (only for Method 6 Imploding and 8,9 Deflating)
/// </summary>
Method = 0x0006,
/// <summary>
/// If set a trailing data desciptor is appended to the entry data
/// </summary>
Descriptor = 0x0008,
Reserved = 0x0010,
/// <summary>
/// If set indicates the file contains Pkzip compressed patched data.
/// </summary>
Patched = 0x0020,
/// <summary>
/// If set strong encryption has been used for this entry.
/// </summary>
StrongEncryption = 0x0040,
/// <summary>
/// Reserved by PKWare for enhanced compression.
/// </summary>
EnhancedCompress = 0x1000,
/// <summary>
/// If set indicates that values in the local header are masked to hide
/// their actual values.
/// </summary>
/// <remarks>
/// Used when encrypting ht ecentral directory contents.
/// </remarks>
HeaderMasked = 0x2000
}
/// <summary>
/// This class contains constants used for Zip format files
/// </summary>
public sealed class ZipConstants
{
/// <summary>
/// The version made by field for entries in the central header when created by this library
/// </summary>
/// <remarks>
/// This is also the Zip version for the library when comparing against the version required to extract
/// for an entry. See <see cref="ZipInputStream.CanDecompressEntry">ZipInputStream.CanDecompressEntry</see>.
/// </remarks>
public const int VERSION_MADE_BY = 20;
/// <summary>
/// The minimum version required to support strong encryption
/// </summary>
public const int VERSION_STRONG_ENCRYPTION = 50;
// The local entry header
/// <summary>
/// Size of local entry header (excluding variable length fields at end)
/// </summary>
public const int LOCHDR = 30;
/// <summary>
/// Signature for local entry header
/// </summary>
public const int LOCSIG = 'P' | ('K' << 8) | (3 << 16) | (4 << 24);
/// <summary>
/// Offset of version to extract in local entry header
/// </summary>
public const int LOCVER = 4;
/// <summary>
/// Offset of general purpose flags in local entry header
/// </summary>
public const int LOCFLG = 6;
/// <summary>
/// Offset of compression method in local entry header
/// </summary>
public const int LOCHOW = 8;
/// <summary>
/// Offset of last mod file time + date in local entry header
/// </summary>
public const int LOCTIM = 10;
/// <summary>
/// Offset of crc-32 in local entry header
/// </summary>
public const int LOCCRC = 14;
/// <summary>
/// Offset of compressed size in local entry header
/// </summary>
public const int LOCSIZ = 18;
/// <summary>
/// Offset of uncompressed size in local entry header
/// </summary>
public const int LOCLEN = 22;
/// <summary>
/// Offset of file name length in local entry header
/// </summary>
public const int LOCNAM = 26;
/// <summary>
/// Offset of extra field length in local entry header
/// </summary>
public const int LOCEXT = 28;
/// <summary>
/// Signature for spanning entry
/// </summary>
public const int SPANNINGSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24);
/// <summary>
/// Signature for temporary spanning entry
/// </summary>
public const int SPANTEMPSIG = 'P' | ('K' << 8) | ('0' << 16) | ('0' << 24);
/// <summary>
/// Signature for data descriptor
/// </summary>
/// <remarks>
/// This is only used where the length, Crc, or compressed size isnt known when the
/// entry is created and the output stream doesnt support seeking.
/// The local entry cannot be 'patched' with the correct values in this case
/// so the values are recorded after the data prefixed by this header, as well as in the central directory.
/// </remarks>
public const int EXTSIG = 'P' | ('K' << 8) | (7 << 16) | (8 << 24);
/// <summary>
/// Size of data descriptor
/// </summary>
public const int EXTHDR = 16;
/// <summary>
/// Offset of crc-32 in data descriptor
/// </summary>
public const int EXTCRC = 4;
/// <summary>
/// Offset of compressed size in data descriptor
/// </summary>
public const int EXTSIZ = 8;
/// <summary>
/// Offset of uncompressed length in data descriptor
/// </summary>
public const int EXTLEN = 12;
/// <summary>
/// Signature for central header
/// </summary>
public const int CENSIG = 'P' | ('K' << 8) | (1 << 16) | (2 << 24);
/// <summary>
/// Size of central header entry
/// </summary>
public const int CENHDR = 46;
/// <summary>
/// Offset of version made by in central file header
/// </summary>
public const int CENVEM = 4;
/// <summary>
/// Offset of version needed to extract in central file header
/// </summary>
public const int CENVER = 6;
/// <summary>
/// Offset of general purpose bit flag in central file header
/// </summary>
public const int CENFLG = 8;
/// <summary>
/// Offset of compression method in central file header
/// </summary>
public const int CENHOW = 10;
/// <summary>
/// Offset of time/date in central file header
/// </summary>
public const int CENTIM = 12;
/// <summary>
/// Offset of crc-32 in central file header
/// </summary>
public const int CENCRC = 16;
/// <summary>
/// Offset of compressed size in central file header
/// </summary>
public const int CENSIZ = 20;
/// <summary>
/// Offset of uncompressed size in central file header
/// </summary>
public const int CENLEN = 24;
/// <summary>
/// Offset of file name length in central file header
/// </summary>
public const int CENNAM = 28;
/// <summary>
/// Offset of extra field length in central file header
/// </summary>
public const int CENEXT = 30;
/// <summary>
/// Offset of file comment length in central file header
/// </summary>
public const int CENCOM = 32;
/// <summary>
/// Offset of disk start number in central file header
/// </summary>
public const int CENDSK = 34;
/// <summary>
/// Offset of internal file attributes in central file header
/// </summary>
public const int CENATT = 36;
/// <summary>
/// Offset of external file attributes in central file header
/// </summary>
public const int CENATX = 38;
/// <summary>
/// Offset of relative offset of local header in central file header
/// </summary>
public const int CENOFF = 42;
/// <summary>
/// Signature for Zip64 central file header
/// </summary>
public const int CENSIG64 = 'P' | ('K' << 8) | (6 << 16) | (6 << 24);
/// <summary>
/// Central header digitial signature
/// </summary>
public const int CENDIGITALSIG = 'P' | ('K' << 8) | (5 << 16) | (5 << 24);
// The entries at the end of central directory
/// <summary>
/// End of central directory record signature
/// </summary>
public const int ENDSIG = 'P' | ('K' << 8) | (5 << 16) | (6 << 24);
/// <summary>
/// Size of end of central record (excluding variable fields)
/// </summary>
public const int ENDHDR = 22;
// The following two fields are missing in SUN JDK
/// <summary>
/// Offset of number of this disk
/// </summary>
public const int ENDNRD = 4;
/// <summary>
/// Offset of number of disk with start of central directory
/// </summary>
public const int ENDDCD = 6;
/// <summary>
/// Offset of number of entries in the central directory of this disk
/// </summary>
public const int ENDSUB = 8;
/// <summary>
/// Offset of total number of entries in the central directory
/// </summary>
public const int ENDTOT = 10;
/// <summary>
/// Offset of size of central directory
/// </summary>
public const int ENDSIZ = 12;
/// <summary>
/// Offset of offset of start of central directory with respect to starting disk number
/// </summary>
public const int ENDOFF = 16;
/// <summary>
/// Offset of ZIP file comment length
/// </summary>
public const int ENDCOM = 20;
/// <summary>
/// Size of cryptographic header stored before entry data
/// </summary>
public const int CRYPTO_HEADER_SIZE = 12;
#if !COMPACT_FRAMEWORK
static int defaultCodePage = 0;
/// <summary>
/// Default encoding used for string conversion. 0 gives the default system Ansi code page.
/// Dont use unicode encodings if you want to be Zip compatible!
/// Using the default code page isnt the full solution neccessarily
/// there are many variable factors, codepage 850 is often a good choice for
/// European users, however be careful about compatability.
/// </summary>
public static int DefaultCodePage {
get {
return defaultCodePage;
}
set {
defaultCodePage = value;
}
}
#endif
/// <summary>
/// Convert a portion of a byte array to a string.
/// </summary>
/// <param name="data">
/// Data to convert to string
/// </param>
/// <param name="length">
/// Number of bytes to convert starting from index 0
/// </param>
/// <returns>
/// data[0]..data[length - 1] converted to a string
/// </returns>
public static string ConvertToString(byte[] data, int length)
{
#if COMPACT_FRAMEWORK
return Encoding.ASCII.GetString(data, 0, length);
#else
return Encoding.GetEncoding(DefaultCodePage).GetString(data, 0, length);
#endif
}
/// <summary>
/// Convert byte array to string
/// </summary>
/// <param name="data">
/// Byte array to convert
/// </param>
/// <returns>
/// <paramref name="data">data</paramref>converted to a string
/// </returns>
public static string ConvertToString(byte[] data)
{
return ConvertToString(data, data.Length);
}
/// <summary>
/// Convert a string to a byte array
/// </summary>
/// <param name="str">
/// String to convert to an array
/// </param>
/// <returns>Converted array</returns>
public static byte[] ConvertToArray(string str)
{
#if COMPACT_FRAMEWORK
return Encoding.ASCII.GetBytes(str);
#else
return Encoding.GetEncoding(DefaultCodePage).GetBytes(str);
#endif
}
}
}
|
kk141242/siteserver
|
source/BaiRong.Core/ThirdParty/Compression/Zip/ZipConstants.cs
|
C#
|
gpl-3.0
| 13,195 |
/**
** file: default.css
** label: Default MP Layout
** columns: 1
** description: The default layout for MoneyPress.
**
**/
/* Product Rows */
.csl_themes-row {
clear: both;
min-width: 852px;
}
/* Product Box Header */
div#content div.csl_themes-product h3 {
margin: 0px 0px 3px 0px;
}
/* Product Zoom */
div.csl_themes-product div.csl_themes-left div.csl_themes-zoombox {
background: url("../images/General_icons16.png")
no-repeat scroll
-41px 0px
transparent;
height:20px;
width: 20px;
float: left;
cursor: pointer;
margin: 0px;
padding: 0px;
overflow: hidden;
}
div.csl_themes-zoombox a.thickbox {
padding: 0px 5px;
text-decoration: none;
}
.csl_themes-product {
float: left;
background-color: #FFFFFF;
border: 1px solid #E4E4E4;
margin: 10px 2px;
padding: 0px;
min-height: 155px;
width: 600px;
}
.csl_themes-product div {
padding: 0 0 0 5px;
}
#content .csl_themes-product h3 {
background: none repeat scroll 0 0 #F4F4F4;
font-family:Verdana, Helvetica, Sans-Serif;
font-size: 14px;
font-weight: bold;
margin: 0;
padding: 6px;
}
.csl_themes-product img {
float: left;
padding: 0 5px 5px 0;
max-width: 150px;
max-height: 120px;
}
.csl_themes-product li {
list-style: none;
}
/* Product Description List Items */
div.csl_themes-prod_desc {
float: left;
}
div.csl_themes-prod_desc_entry {
clear:both;
}
div.csl_themes-prod_desc_label {
float: left;
width: 150px;
text-align: right;
}
div.csl_themes-prod_desc_value {
float:left;
text-align:left;
}
|
wp-plugins/moneypress-ebay-edition-r2
|
css/default.css
|
CSS
|
gpl-3.0
| 1,673 |
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "delay_estimator_wrapper.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "delay_estimator.h"
#include "delay_estimator_internal.h"
#include "compile_assert_c.h"
// Only bit |kBandFirst| through bit |kBandLast| are processed and
// |kBandFirst| - |kBandLast| must be < 32.
enum { kBandFirst = 12 };
enum { kBandLast = 43 };
static __inline uint32_t SetBit(uint32_t in, int pos) {
uint32_t mask = (1 << pos);
uint32_t out = (in | mask);
return out;
}
// Calculates the mean recursively. Same version as WebRtc_MeanEstimatorFix(),
// but for float.
//
// Inputs:
// - new_value : New additional value.
// - scale : Scale for smoothing (should be less than 1.0).
//
// Input/Output:
// - mean_value : Pointer to the mean value for updating.
//
static void MeanEstimatorFloat(float new_value,
float scale,
float* mean_value) {
assert(scale < 1.0f);
*mean_value += (new_value - *mean_value) * scale;
}
// Computes the binary spectrum by comparing the input |spectrum| with a
// |threshold_spectrum|. Float and fixed point versions.
//
// Inputs:
// - spectrum : Spectrum of which the binary spectrum should be
// calculated.
// - threshold_spectrum : Threshold spectrum with which the input
// spectrum is compared.
// Return:
// - out : Binary spectrum.
//
static uint32_t BinarySpectrumFix(uint16_t* spectrum,
SpectrumType* threshold_spectrum,
int q_domain,
int* threshold_initialized) {
int i = kBandFirst;
uint32_t out = 0;
assert(q_domain < 16);
if (!(*threshold_initialized)) {
// Set the |threshold_spectrum| to half the input |spectrum| as starting
// value. This speeds up the convergence.
for (i = kBandFirst; i <= kBandLast; i++) {
if (spectrum[i] > 0) {
// Convert input spectrum from Q(|q_domain|) to Q15.
int32_t spectrum_q15 = ((int32_t) spectrum[i]) << (15 - q_domain);
threshold_spectrum[i].int32_ = (spectrum_q15 >> 1);
*threshold_initialized = 1;
}
}
}
for (i = kBandFirst; i <= kBandLast; i++) {
// Convert input spectrum from Q(|q_domain|) to Q15.
int32_t spectrum_q15 = ((int32_t) spectrum[i]) << (15 - q_domain);
// Update the |threshold_spectrum|.
WebRtc_MeanEstimatorFix(spectrum_q15, 6, &(threshold_spectrum[i].int32_));
// Convert |spectrum| at current frequency bin to a binary value.
if (spectrum_q15 > threshold_spectrum[i].int32_) {
out = SetBit(out, i - kBandFirst);
}
}
return out;
}
static uint32_t BinarySpectrumFloat(float* spectrum,
SpectrumType* threshold_spectrum,
int* threshold_initialized) {
int i = kBandFirst;
uint32_t out = 0;
const float kScale = 1 / 64.0;
if (!(*threshold_initialized)) {
// Set the |threshold_spectrum| to half the input |spectrum| as starting
// value. This speeds up the convergence.
for (i = kBandFirst; i <= kBandLast; i++) {
if (spectrum[i] > 0.0f) {
threshold_spectrum[i].float_ = (spectrum[i] / 2);
*threshold_initialized = 1;
}
}
}
for (i = kBandFirst; i <= kBandLast; i++) {
// Update the |threshold_spectrum|.
MeanEstimatorFloat(spectrum[i], kScale, &(threshold_spectrum[i].float_));
// Convert |spectrum| at current frequency bin to a binary value.
if (spectrum[i] > threshold_spectrum[i].float_) {
out = SetBit(out, i - kBandFirst);
}
}
return out;
}
void WebRtc_FreeDelayEstimatorFarend(void* handle) {
DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
if (handle == NULL) {
return;
}
free(self->mean_far_spectrum);
self->mean_far_spectrum = NULL;
WebRtc_FreeBinaryDelayEstimatorFarend(self->binary_farend);
self->binary_farend = NULL;
free(self);
}
void* WebRtc_CreateDelayEstimatorFarend(int spectrum_size, int history_size) {
DelayEstimatorFarend* self = NULL;
// Check if the sub band used in the delay estimation is small enough to fit
// the binary spectra in a uint32_t.
COMPILE_ASSERT(kBandLast - kBandFirst < 32);
if (spectrum_size >= kBandLast) {
self = malloc(sizeof(DelayEstimator));
}
if (self != NULL) {
int memory_fail = 0;
// Allocate memory for the binary far-end spectrum handling.
self->binary_farend = WebRtc_CreateBinaryDelayEstimatorFarend(history_size);
memory_fail |= (self->binary_farend == NULL);
// Allocate memory for spectrum buffers.
self->mean_far_spectrum = malloc(spectrum_size * sizeof(SpectrumType));
memory_fail |= (self->mean_far_spectrum == NULL);
self->spectrum_size = spectrum_size;
if (memory_fail) {
WebRtc_FreeDelayEstimatorFarend(self);
self = NULL;
}
}
return self;
}
int WebRtc_InitDelayEstimatorFarend(void* handle) {
DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
if (self == NULL) {
return -1;
}
// Initialize far-end part of binary delay estimator.
WebRtc_InitBinaryDelayEstimatorFarend(self->binary_farend);
// Set averaged far and near end spectra to zero.
memset(self->mean_far_spectrum, 0,
sizeof(SpectrumType) * self->spectrum_size);
// Reset initialization indicators.
self->far_spectrum_initialized = 0;
return 0;
}
int WebRtc_AddFarSpectrumFix(void* handle, uint16_t* far_spectrum,
int spectrum_size, int far_q) {
DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
uint32_t binary_spectrum = 0;
if (self == NULL) {
return -1;
}
if (far_spectrum == NULL) {
// Empty far end spectrum.
return -1;
}
if (spectrum_size != self->spectrum_size) {
// Data sizes don't match.
return -1;
}
if (far_q > 15) {
// If |far_q| is larger than 15 we cannot guarantee no wrap around.
return -1;
}
// Get binary spectrum.
binary_spectrum = BinarySpectrumFix(far_spectrum, self->mean_far_spectrum,
far_q, &(self->far_spectrum_initialized));
WebRtc_AddBinaryFarSpectrum(self->binary_farend, binary_spectrum);
return 0;
}
int WebRtc_AddFarSpectrumFloat(void* handle, float* far_spectrum,
int spectrum_size) {
DelayEstimatorFarend* self = (DelayEstimatorFarend*) handle;
uint32_t binary_spectrum = 0;
if (self == NULL) {
return -1;
}
if (far_spectrum == NULL) {
// Empty far end spectrum.
return -1;
}
if (spectrum_size != self->spectrum_size) {
// Data sizes don't match.
return -1;
}
// Get binary spectrum.
binary_spectrum = BinarySpectrumFloat(far_spectrum, self->mean_far_spectrum,
&(self->far_spectrum_initialized));
WebRtc_AddBinaryFarSpectrum(self->binary_farend, binary_spectrum);
return 0;
}
void WebRtc_FreeDelayEstimator(void* handle) {
DelayEstimator* self = (DelayEstimator*) handle;
if (handle == NULL) {
return;
}
free(self->mean_near_spectrum);
self->mean_near_spectrum = NULL;
WebRtc_FreeBinaryDelayEstimator(self->binary_handle);
self->binary_handle = NULL;
free(self);
}
void* WebRtc_CreateDelayEstimator(void* farend_handle, int lookahead) {
DelayEstimator* self = NULL;
DelayEstimatorFarend* farend = (DelayEstimatorFarend*) farend_handle;
if (farend_handle != NULL) {
self = malloc(sizeof(DelayEstimator));
}
if (self != NULL) {
int memory_fail = 0;
// Allocate memory for the farend spectrum handling.
self->binary_handle =
WebRtc_CreateBinaryDelayEstimator(farend->binary_farend, lookahead);
memory_fail |= (self->binary_handle == NULL);
// Allocate memory for spectrum buffers.
self->mean_near_spectrum = malloc(farend->spectrum_size *
sizeof(SpectrumType));
memory_fail |= (self->mean_near_spectrum == NULL);
self->spectrum_size = farend->spectrum_size;
if (memory_fail) {
WebRtc_FreeDelayEstimator(self);
self = NULL;
}
}
return self;
}
int WebRtc_InitDelayEstimator(void* handle) {
DelayEstimator* self = (DelayEstimator*) handle;
if (self == NULL) {
return -1;
}
// Initialize binary delay estimator.
WebRtc_InitBinaryDelayEstimator(self->binary_handle);
// Set averaged far and near end spectra to zero.
memset(self->mean_near_spectrum, 0,
sizeof(SpectrumType) * self->spectrum_size);
// Reset initialization indicators.
self->near_spectrum_initialized = 0;
return 0;
}
int WebRtc_DelayEstimatorProcessFix(void* handle,
uint16_t* near_spectrum,
int spectrum_size,
int near_q) {
DelayEstimator* self = (DelayEstimator*) handle;
uint32_t binary_spectrum = 0;
if (self == NULL) {
return -1;
}
if (near_spectrum == NULL) {
// Empty near end spectrum.
return -1;
}
if (spectrum_size != self->spectrum_size) {
// Data sizes don't match.
return -1;
}
if (near_q > 15) {
// If |near_q| is larger than 15 we cannot guarantee no wrap around.
return -1;
}
// Get binary spectra.
binary_spectrum = BinarySpectrumFix(near_spectrum,
self->mean_near_spectrum,
near_q,
&(self->near_spectrum_initialized));
return WebRtc_ProcessBinarySpectrum(self->binary_handle, binary_spectrum);
}
int WebRtc_DelayEstimatorProcessFloat(void* handle,
float* near_spectrum,
int spectrum_size) {
DelayEstimator* self = (DelayEstimator*) handle;
uint32_t binary_spectrum = 0;
if (self == NULL) {
return -1;
}
if (near_spectrum == NULL) {
// Empty near end spectrum.
return -1;
}
if (spectrum_size != self->spectrum_size) {
// Data sizes don't match.
return -1;
}
// Get binary spectrum.
binary_spectrum = BinarySpectrumFloat(near_spectrum, self->mean_near_spectrum,
&(self->near_spectrum_initialized));
return WebRtc_ProcessBinarySpectrum(self->binary_handle, binary_spectrum);
}
int WebRtc_last_delay(void* handle) {
DelayEstimator* self = (DelayEstimator*) handle;
if (self == NULL) {
return -1;
}
return WebRtc_binary_last_delay(self->binary_handle);
}
int WebRtc_last_delay_quality(void* handle) {
DelayEstimator* self = (DelayEstimator*) handle;
if (self == NULL) {
return -1;
}
return WebRtc_binary_last_delay_quality(self->binary_handle);
}
|
li-zhipeng/audio
|
webrtc_aec/libwebrtc_aec/delay_estimator_wrapper.c
|
C
|
gpl-3.0
| 11,289 |
using System;
using System.Collections;
using Server;
namespace Server.Mobiles
{
public class VarietyDealer : BaseVendor
{
private ArrayList m_SBInfos = new ArrayList();
protected override ArrayList SBInfos { get { return m_SBInfos; } }
[Constructable]
public VarietyDealer()
: base( "the variety dealer" )
{
}
public override void InitSBInfo()
{
m_SBInfos.Add( new SBVarietyDealer() );
}
public VarietyDealer( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
/*int version = */reader.ReadInt();
}
}
}
|
xrunuo/xrunuo
|
Scripts/Distro/Mobiles/Vendors/NPC/VarietyDealer.cs
|
C#
|
gpl-3.0
| 806 |
-----------------------------------
-- Area: Apollyon (38)
-- Mob: Apollyon_Sapling
-----------------------------------
-- require("scripts/zones/Apollyon/MobIDs");
-----------------------------------
-- onMobInitialize
-----------------------------------
function onMobInitialize(mob)
end;
-----------------------------------
-- onMobSpawn
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
end;
-----------------------------------
-- onMobFight
-----------------------------------
function onMobFight(mob,target)
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
end;
|
salamader/ffxi-a
|
scripts/zones/Apollyon/mobs/Apollyon_Sapling.lua
|
Lua
|
gpl-3.0
| 800 |
namespace SiteServer.CMS.Core.Create
{
public class CreateTaskManager
{
private static readonly CreateTaskManagerForDb CreateTaskManagerForDb = new CreateTaskManagerForDb();
private static readonly CreateTaskManagerForMomery CreateTaskManagerForMomery = new CreateTaskManagerForMomery();
private CreateTaskManager() { }
public static ICreateTaskManager Instance => ServiceManager.IsServiceOnline
? (ICreateTaskManager) CreateTaskManagerForDb
: CreateTaskManagerForMomery;
}
}
|
ColgateKas/cms
|
source/SiteServer.CMS/Core/Create/CreateTaskManager.cs
|
C#
|
gpl-3.0
| 549 |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
import re
from collections import Counter
from lxml.html.builder import OL, UL, SPAN
from calibre.ebooks.docx.block_styles import ParagraphStyle
from calibre.ebooks.docx.char_styles import RunStyle
from calibre.ebooks.docx.names import XPath, get
STYLE_MAP = {
'aiueo': 'hiragana',
'aiueoFullWidth': 'hiragana',
'hebrew1': 'hebrew',
'iroha': 'katakana-iroha',
'irohaFullWidth': 'katakana-iroha',
'lowerLetter': 'lower-alpha',
'lowerRoman': 'lower-roman',
'none': 'none',
'upperLetter': 'upper-alpha',
'upperRoman': 'upper-roman',
'chineseCounting': 'cjk-ideographic',
'decimalZero': 'decimal-leading-zero',
}
class Level(object):
def __init__(self, lvl=None):
self.restart = None
self.start = 0
self.fmt = 'decimal'
self.para_link = None
self.paragraph_style = self.character_style = None
self.is_numbered = False
self.num_template = None
if lvl is not None:
self.read_from_xml(lvl)
def copy(self):
ans = Level()
for x in ('restart', 'start', 'fmt', 'para_link', 'paragraph_style', 'character_style', 'is_numbered', 'num_template'):
setattr(ans, x, getattr(self, x))
return ans
def format_template(self, counter, ilvl):
def sub(m):
x = int(m.group(1)) - 1
if x > ilvl or x not in counter:
return ''
return '%d' % (counter[x] - (0 if x == ilvl else 1))
return re.sub(r'%(\d+)', sub, self.num_template).rstrip() + '\xa0'
def read_from_xml(self, lvl, override=False):
for lr in XPath('./w:lvlRestart[@w:val]')(lvl):
try:
self.restart = int(get(lr, 'w:val'))
except (TypeError, ValueError):
pass
for lr in XPath('./w:start[@w:val]')(lvl):
try:
self.start = int(get(lr, 'w:val'))
except (TypeError, ValueError):
pass
lt = None
for lr in XPath('./w:lvlText[@w:val]')(lvl):
lt = get(lr, 'w:val')
for lr in XPath('./w:numFmt[@w:val]')(lvl):
val = get(lr, 'w:val')
if val == 'bullet':
self.is_numbered = False
self.fmt = {'\uf0a7':'square', 'o':'circle'}.get(lt, 'disc')
else:
self.is_numbered = True
self.fmt = STYLE_MAP.get(val, 'decimal')
if lt and re.match(r'%\d+\.$', lt) is None:
self.num_template = lt
for lr in XPath('./w:pStyle[@w:val]')(lvl):
self.para_link = get(lr, 'w:val')
for pPr in XPath('./w:pPr')(lvl):
ps = ParagraphStyle(pPr)
if self.paragraph_style is None:
self.paragraph_style = ps
else:
self.paragraph_style.update(ps)
for rPr in XPath('./w:rPr')(lvl):
ps = RunStyle(rPr)
if self.character_style is None:
self.character_style = ps
else:
self.character_style.update(ps)
class NumberingDefinition(object):
def __init__(self, parent=None):
self.levels = {}
if parent is not None:
for lvl in XPath('./w:lvl')(parent):
try:
ilvl = int(get(lvl, 'w:ilvl', 0))
except (TypeError, ValueError):
ilvl = 0
self.levels[ilvl] = Level(lvl)
def copy(self):
ans = NumberingDefinition()
for l, lvl in self.levels.iteritems():
ans.levels[l] = lvl.copy()
return ans
class Numbering(object):
def __init__(self):
self.definitions = {}
self.instances = {}
self.counters = {}
def __call__(self, root, styles):
' Read all numbering style definitions '
lazy_load = {}
for an in XPath('./w:abstractNum[@w:abstractNumId]')(root):
an_id = get(an, 'w:abstractNumId')
nsl = XPath('./w:numStyleLink[@w:val]')(an)
if nsl:
lazy_load[an_id] = get(nsl[0], 'w:val')
else:
nd = NumberingDefinition(an)
self.definitions[an_id] = nd
def create_instance(n, definition):
nd = definition.copy()
for lo in XPath('./w:lvlOverride')(n):
ilvl = get(lo, 'w:ilvl')
for lvl in XPath('./w:lvl')(lo)[:1]:
nilvl = get(lvl, 'w:ilvl')
ilvl = nilvl if ilvl is None else ilvl
alvl = nd.levels.get(ilvl, None)
if alvl is None:
alvl = Level()
alvl.read_from_xml(lvl, override=True)
return nd
next_pass = {}
for n in XPath('./w:num[@w:numId]')(root):
an_id = None
num_id = get(n, 'w:numId')
for an in XPath('./w:abstractNumId[@w:val]')(n):
an_id = get(an, 'w:val')
d = self.definitions.get(an_id, None)
if d is None:
next_pass[num_id] = (an_id, n)
continue
self.instances[num_id] = create_instance(n, d)
numbering_links = styles.numbering_style_links
for an_id, style_link in lazy_load.iteritems():
num_id = numbering_links[style_link]
self.definitions[an_id] = self.instances[num_id].copy()
for num_id, (an_id, n) in next_pass.iteritems():
d = self.definitions.get(an_id, None)
if d is not None:
self.instances[num_id] = create_instance(n, d)
for num_id, d in self.instances.iteritems():
self.counters[num_id] = Counter({lvl:d.levels[lvl].start for lvl in d.levels})
def get_pstyle(self, num_id, style_id):
d = self.instances.get(num_id, None)
if d is not None:
for ilvl, lvl in d.levels.iteritems():
if lvl.para_link == style_id:
return ilvl
def get_para_style(self, num_id, lvl):
d = self.instances.get(num_id, None)
if d is not None:
lvl = d.levels.get(lvl, None)
return getattr(lvl, 'paragraph_style', None)
def update_counter(self, counter, levelnum, levels):
counter[levelnum] += 1
for ilvl, lvl in levels.iteritems():
restart = lvl.restart
if (restart is None and ilvl == levelnum + 1) or restart == levelnum + 1:
counter[ilvl] = lvl.start
def apply_markup(self, items, body, styles, object_map):
for p, num_id, ilvl in items:
d = self.instances.get(num_id, None)
if d is not None:
lvl = d.levels.get(ilvl, None)
if lvl is not None:
counter = self.counters[num_id]
p.tag = 'li'
p.set('value', '%s' % counter[ilvl])
p.set('list-lvl', str(ilvl))
p.set('list-id', num_id)
if lvl.num_template is not None:
val = lvl.format_template(counter, ilvl)
p.set('list-template', val)
self.update_counter(counter, ilvl, d.levels)
templates = {}
def commit(current_run):
if not current_run:
return
start = current_run[0]
parent = start.getparent()
idx = parent.index(start)
d = self.instances[start.get('list-id')]
ilvl = int(start.get('list-lvl'))
lvl = d.levels[ilvl]
lvlid = start.get('list-id') + start.get('list-lvl')
wrap = (OL if lvl.is_numbered else UL)('\n\t')
has_template = 'list-template' in start.attrib
if has_template:
wrap.set('lvlid', lvlid)
else:
wrap.set('class', styles.register({'list-style-type': lvl.fmt}, 'list'))
parent.insert(idx, wrap)
last_val = None
for child in current_run:
wrap.append(child)
child.tail = '\n\t'
if has_template:
span = SPAN()
span.text = child.text
child.text = None
for gc in child:
span.append(gc)
child.append(span)
span = SPAN(child.get('list-template'))
last = templates.get(lvlid, '')
if span.text and len(span.text) > len(last):
templates[lvlid] = span.text
child.insert(0, span)
for attr in ('list-lvl', 'list-id', 'list-template'):
child.attrib.pop(attr, None)
val = int(child.get('value'))
if last_val == val - 1 or wrap.tag == 'ul':
child.attrib.pop('value')
last_val = val
current_run[-1].tail = '\n'
del current_run[:]
parents = set()
for child in body.iterdescendants('li'):
parents.add(child.getparent())
for parent in parents:
current_run = []
for child in parent:
if child.tag == 'li':
if current_run:
last = current_run[-1]
if (last.get('list-id') , last.get('list-lvl')) != (child.get('list-id'), child.get('list-lvl')):
commit(current_run)
current_run.append(child)
else:
commit(current_run)
commit(current_run)
for wrap in body.xpath('//ol[@lvlid]'):
lvlid = wrap.attrib.pop('lvlid')
wrap.tag = 'div'
text = ''
maxtext = templates.get(lvlid, '').replace('.', '')[:-1]
for li in wrap.iterchildren('li'):
t = li[0].text
if t and len(t) > len(text):
text = t
for i, li in enumerate(wrap.iterchildren('li')):
li.tag = 'div'
li.attrib.pop('value', None)
li.set('style', 'display:table-row')
obj = object_map[li]
bs = styles.para_cache[obj]
if i == 0:
m = len(maxtext) # Move the table left to simulate the behavior of a list (number is to the left of text margin)
wrap.set('style', 'display:table; margin-left: -%dem; padding-left: %s' % (m, bs.css.get('margin-left', 0)))
bs.css.pop('margin-left', None)
for child in li:
child.set('style', 'display:table-cell')
|
sss/calibre-at-bzr
|
src/calibre/ebooks/docx/numbering.py
|
Python
|
gpl-3.0
| 11,065 |
/*
YUI 3.13.0 (build 508226d)
Copyright 2013 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
.yui3-scrollview{position:relative;overflow:hidden;-webkit-user-select:none;-moz-user-select:none}.yui3-scrollview-hidden{display:none}.yui3-scrollview-content{position:relative}#yui3-css-stamp.skin-night-scrollview-base{display:none}
|
ouyangyu/fdmoodle
|
lib/yuilib/3.13.0/scrollview-base/assets/skins/night/scrollview-base.css
|
CSS
|
gpl-3.0
| 388 |
/*
* ====================================================================
* JAFFA - Java Application Framework For All
*
* Copyright (C) 2002 JAFFA Development Group
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Redistribution and use of this software and associated documentation ("Software"),
* with or without modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain copyright statements and notices.
* Redistributions must also contain a copy of this document.
* 2. 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.
* 3. The name "JAFFA" must not be used to endorse or promote products derived from
* this Software without prior written permission. For written permission,
* please contact mail to: [email protected].
* 4. Products derived from this Software may not be called "JAFFA" nor may "JAFFA"
* appear in their names without prior written permission.
* 5. Due credit should be given to the JAFFA Project (http://jaffa.sourceforge.net).
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
* ITS 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.
* ====================================================================
*/
package org.jaffa.presentation.portlet.widgets.tests;
import org.jaffa.presentation.portlet.FormBase;
import org.jaffa.presentation.portlet.widgets.model.DropDownModel;
import org.jaffa.presentation.portlet.widgets.controller.DropDownController;
import org.jaffa.presentation.portlet.widgets.model.WidgetModel;
import org.apache.log4j.*;
/**
*
* @author GautamJ
* @version
*/
public class DropDownForm extends FormBase {
private static Logger log = Logger.getLogger(DropDownForm.class);
public static final String NAME = "dropDownForm";
private String m_fieldWithCachedModel = null;
private String m_fieldWithValidation = null;
private DropDownModel w_fieldLinkedToCCAndCached = null;
private DropDownModel w_fieldLinkedToCC = null;
private DropDownModel w_fieldWithCachedModel = null;
private DropDownModel w_fieldWithValidation = null;
// **** fieldLinkedToCCAndCached ****
public String getFieldLinkedToCCAndCached() {
return ( (DropDownComponent) getComponent() ).getFieldLinkedToCCAndCached();
}
public void setFieldLinkedToCCAndCached(String value) {
( (DropDownComponent) getComponent() ).setFieldLinkedToCCAndCached(value);
}
public WidgetModel getFieldLinkedToCCAndCachedWM() {
if (w_fieldLinkedToCCAndCached == null) {
w_fieldLinkedToCCAndCached = (DropDownModel) getWidgetCache().getModel("fieldLinkedToCCAndCached");
if (w_fieldLinkedToCCAndCached == null) {
w_fieldLinkedToCCAndCached = new DropDownModel(getFieldLinkedToCCAndCached());
getWidgetCache().addModel("fieldLinkedToCCAndCached", w_fieldLinkedToCCAndCached);
}
}
return w_fieldLinkedToCCAndCached;
}
public void setFieldLinkedToCCAndCachedWV(String value) {
DropDownModel m = (DropDownModel) getFieldLinkedToCCAndCachedWM();
DropDownController.updateModel(value, m);
}
// **** fieldLinkedToCC ****
public String getFieldLinkedToCC() {
return ( (DropDownComponent) getComponent() ).getFieldLinkedToCC();
}
public void setFieldLinkedToCC(String value) {
( (DropDownComponent) getComponent() ).setFieldLinkedToCC(value);
}
public WidgetModel getFieldLinkedToCCWM() {
if (w_fieldLinkedToCC == null) {
w_fieldLinkedToCC = new DropDownModel(getFieldLinkedToCC());
}
return w_fieldLinkedToCC;
}
public void setFieldLinkedToCCWV(String value) {
DropDownModel m = (DropDownModel) getFieldLinkedToCCWM();
DropDownController.updateModel(value, m);
}
// **** fieldWithCachedModel ****
public String getFieldWithCachedModel() {
return m_fieldWithCachedModel;
}
public void setFieldWithCachedModel(String value) {
m_fieldWithCachedModel = value;
if (w_fieldWithCachedModel != null)
setFieldWithCachedModelWV((new Boolean(value)).toString());
}
public WidgetModel getFieldWithCachedModelWM() {
if (w_fieldWithCachedModel == null) {
w_fieldWithCachedModel = (DropDownModel) getWidgetCache().getModel("fieldWithCachedModel");
if (w_fieldWithCachedModel == null) {
w_fieldWithCachedModel = new DropDownModel(getFieldWithCachedModel());
getWidgetCache().addModel("fieldWithCachedModel", w_fieldWithCachedModel);
}
}
return w_fieldWithCachedModel;
}
public void setFieldWithCachedModelWV(String value) {
DropDownModel m = (DropDownModel) getFieldWithCachedModelWM();
DropDownController.updateModel(value, m);
}
// **** fieldWithValidation ****
public String getFieldWithValidation() {
return m_fieldWithValidation;
}
public void setFieldWithValidation(String value) {
m_fieldWithValidation = value;
if (w_fieldWithValidation != null)
setFieldWithValidationWV((new Boolean(value)).toString());
}
public WidgetModel getFieldWithValidationWM() {
if (w_fieldWithValidation == null) {
w_fieldWithValidation = new DropDownModel(getFieldWithValidation());
// add some dynamic options
w_fieldWithValidation.addOption("FredLabel", "FredValue");
}
return w_fieldWithValidation;
}
public void setFieldWithValidationWV(String value) {
DropDownModel m = (DropDownModel) getFieldWithValidationWM();
DropDownController.updateModel(value, m);
}
public void initForm() {
super.initForm();
m_fieldWithCachedModel = "FWCMValue1";
m_fieldWithValidation = "FWVValue2";
}
// @todo:validate
}
|
snavaneethan1/jaffa-framework
|
jaffa-core/source/httpunittest/java/org/jaffa/presentation/portlet/widgets/tests/DropDownForm.java
|
Java
|
gpl-3.0
| 7,513 |
-----------------------------------
-- Area: West Sarutabaruta (S) (95)
-- Mob: Crawler
-----------------------------------
-- require("scripts/zones/West_Sarutabaruta_[S]/MobIDs");
-----------------------------------
-- onMobInitialize
-----------------------------------
function onMobInitialize(mob)
end;
-----------------------------------
-- onMobSpawn
-----------------------------------
function onMobSpawn(mob)
end;
-----------------------------------
-- onMobEngaged
-----------------------------------
function onMobEngaged(mob,target)
end;
-----------------------------------
-- onMobFight
-----------------------------------
function onMobFight(mob,target)
end;
-----------------------------------
-- onMobDeath
-----------------------------------
function onMobDeath(mob,killer)
end;
|
Fatalerror66/ffxi-a
|
scripts/zones/West_Sarutabaruta_[S]/mobs/Crawler.lua
|
Lua
|
gpl-3.0
| 817 |
/*
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h"
#include "webrtc/test/testsupport/fileutils.h"
namespace webrtc {
namespace testing {
namespace bwe {
#if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
std::vector<BweTestConfig::EstimatorConfig> SingleEstimatorConfig() {
static const RemoteBitrateEstimatorFactory factory =
AbsoluteSendTimeRemoteBitrateEstimatorFactory();
std::vector<BweTestConfig::EstimatorConfig> result;
result.push_back(BweTestConfig::EstimatorConfig("AST", &factory));
return result;
}
std::vector<const PacketSenderFactory*> AdaptiveVideoSenderFactories(
uint32_t count) {
static const AdaptiveVideoPacketSenderFactory factories[] = {
AdaptiveVideoPacketSenderFactory(30.00f, 150, 0x1234, 0.13f),
AdaptiveVideoPacketSenderFactory(30.00f, 300, 0x3456, 0.26f),
AdaptiveVideoPacketSenderFactory(15.00f, 600, 0x4567, 0.39f),
};
assert(count <= sizeof(factories) / sizeof(factories[0]));
std::vector<const PacketSenderFactory*> result;
for (uint32_t i = 0; i < count; ++i) {
result.push_back(&factories[i]);
}
return result;
}
BweTestConfig MakeAdaptiveBweTestConfig(uint32_t sender_count) {
BweTestConfig result = {
AdaptiveVideoSenderFactories(sender_count), SingleEstimatorConfig()
};
return result;
}
// This test fixture is used to instantiate tests running with adaptive video
// senders.
class BweSimulation : public BweTest {
public:
BweSimulation() : BweTest() {}
virtual ~BweSimulation() {}
private:
DISALLOW_COPY_AND_ASSIGN(BweSimulation);
};
INSTANTIATE_TEST_CASE_P(VideoSendersTest, BweSimulation,
::testing::Values(MakeAdaptiveBweTestConfig(1),
MakeAdaptiveBweTestConfig(3)));
TEST_P(BweSimulation, SprintUplinkTest) {
VerboseLogging(true);
RateCounterFilter counter1(this, "sender_output");
TraceBasedDeliveryFilter filter(this, "link_capacity");
RateCounterFilter counter2(this, "receiver_input");
ASSERT_TRUE(filter.Init(test::ResourcePath("sprint-uplink", "rx")));
RunFor(60 * 1000);
}
TEST_P(BweSimulation, Verizon4gDownlinkTest) {
VerboseLogging(true);
RateCounterFilter counter1(this, "sender_output");
TraceBasedDeliveryFilter filter(this, "link_capacity");
RateCounterFilter counter2(this, "receiver_input");
ASSERT_TRUE(filter.Init(test::ResourcePath("verizon4g-downlink", "rx")));
RunFor(22 * 60 * 1000);
}
#endif // BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
} // namespace bwe
} // namespace testing
} // namespace webrtc
|
liyouchang/webrtc-qt
|
webrtc/modules/remote_bitrate_estimator/bwe_simulations.cc
|
C++
|
gpl-3.0
| 3,002 |
/*
NSPasteboard.h
Class to transfer data to and from the pasteboard server
Copyright (C) 1996 Free Software Foundation, Inc.
Author: Scott Christley <[email protected]>
Date: 1996
Author: Richard Frith-Macdonald <[email protected]>
This file is part of the GNUstep GUI Library.
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 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; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _GNUstep_H_NSPasteboard
#define _GNUstep_H_NSPasteboard
#import <GNUstepBase/GSVersionMacros.h>
#import <Foundation/NSObject.h>
#import <AppKit/AppKitDefines.h>
#if defined(__cplusplus)
extern "C" {
#endif
@class NSString;
@class NSArray;
@class NSData;
@class NSFileWrapper;
/**
* Pasteboard contains string data as written by
* [NSPasteboard-setString:forType:] or [NSPasteboard-setPropertyList:forType:]
*/
APPKIT_EXPORT NSString *NSStringPboardType;
/**
* Pasteboard contains color information
*/
APPKIT_EXPORT NSString *NSColorPboardType;
/**
* Pasteboard contains generic file content information (serialized)
* as written by [NSPasteboard-writeFileContents:] or
* [NSPasteboard-writeFileWrapper:]
*/
APPKIT_EXPORT NSString *NSFileContentsPboardType;
/**
* Pasteboard contains an array of filenames (serialized)
* as written by [NSPasteboard-setPropertyList:forType:]
*/
APPKIT_EXPORT NSString *NSFilenamesPboardType;
/**
* Pasteboard contains font color information
*/
APPKIT_EXPORT NSString *NSFontPboardType;
/**
* Pasteboard contains ruler color information
*/
APPKIT_EXPORT NSString *NSRulerPboardType;
/**
* Pasteboard contains postscript code
*/
APPKIT_EXPORT NSString *NSPostScriptPboardType;
/**
* Pasteboard contains tabular text.
*/
APPKIT_EXPORT NSString *NSTabularTextPboardType;
/**
* Pasteboard contains text in rich text format.
*/
APPKIT_EXPORT NSString *NSRTFPboardType;
/**
* Pasteboard contains text in rich text format with additional info
*/
APPKIT_EXPORT NSString *NSRTFDPboardType;
/**
* Pasteboard contains a TIFF image
*/
APPKIT_EXPORT NSString *NSTIFFPboardType;
/**
* Pasteboard contains a link to data in some document
*/
APPKIT_EXPORT NSString *NSDataLinkPboardType;
/**
* Pasteboard contains general binary data
*/
APPKIT_EXPORT NSString *NSGeneralPboardType;
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
/**
* Pasteboard contains a PDF document
*/
APPKIT_EXPORT NSString *NSPDFPboardType;
/**
* Pasteboard contains a PICT diagram document
*/
APPKIT_EXPORT NSString *NSPICTPboardType;
/**
* Pasteboard contains a URL
*/
APPKIT_EXPORT NSString *NSURLPboardType;
/**
* Pasteboard contains HTML data
*/
APPKIT_EXPORT NSString *NSHTMLPboardType;
/**
* Pasteboard contains VCard (address book) data
*/
APPKIT_EXPORT NSString *NSVCardPboardType;
/**
* Pasteboard contains promised files
*/
APPKIT_EXPORT NSString *NSFilesPromisePboardType;
#endif
/**
* The pasteboard used for drag and drop information.
*/
APPKIT_EXPORT NSString *NSDragPboard;
/**
* The pasteboard used search and replace editing operations.
*/
APPKIT_EXPORT NSString *NSFindPboard;
/**
* The pasteboard used for cutting and pasting font information.
*/
APPKIT_EXPORT NSString *NSFontPboard;
/**
* The general purpose pasteboard (mostly used for cut and paste)
*/
APPKIT_EXPORT NSString *NSGeneralPboard;
/**
* The pasteboard used for cutting and pasting ruler information.
*/
APPKIT_EXPORT NSString *NSRulerPboard;
/**
* Exception raised when communication with the pasteboard server fails.
*/
APPKIT_EXPORT NSString *NSPasteboardCommunicationException;
@interface NSPasteboard : NSObject
{
NSString *name; // The name of this pasteboard.
int changeCount; // What we think the current count is.
id target; // Proxy to the object in the server.
id owner; // Local pasteboard owner.
BOOL useHistory; // Want strict OPENSTEP?
}
//
// Creating and Releasing an NSPasteboard Object
//
+ (NSPasteboard*) generalPasteboard;
+ (NSPasteboard*) pasteboardWithName: (NSString*)aName;
+ (NSPasteboard*) pasteboardWithUniqueName;
- (void) releaseGlobally;
//
// Getting Data in Different Formats
//
+ (NSPasteboard*) pasteboardByFilteringData: (NSData*)data
ofType: (NSString*)type;
+ (NSPasteboard*) pasteboardByFilteringFile: (NSString*)filename;
+ (NSPasteboard*) pasteboardByFilteringTypesInPasteboard: (NSPasteboard*)pboard;
+ (NSArray*) typesFilterableTo: (NSString*)type;
//
// Referring to a Pasteboard by Name
//
- (NSString*) name;
//
// Writing Data
//
- (int) addTypes: (NSArray*)newTypes
owner: (id)newOwner;
- (int) declareTypes: (NSArray*)newTypes
owner: (id)newOwner;
- (BOOL) setData: (NSData*)data
forType: (NSString*)dataType;
- (BOOL) setPropertyList: (id)propertyList
forType: (NSString*)dataType;
- (BOOL) setString: (NSString*)string
forType: (NSString*)dataType;
- (BOOL) writeFileContents: (NSString*)filename;
- (BOOL) writeFileWrapper: (NSFileWrapper*)wrapper;
//
// Determining Types
//
- (NSString*) availableTypeFromArray: (NSArray*)types;
- (NSArray*) types;
//
// Reading Data
//
- (int) changeCount;
- (NSData*) dataForType: (NSString*)dataType;
- (id) propertyListForType: (NSString*)dataType;
- (NSString*) readFileContentsType: (NSString*)type
toFile: (NSString*)filename;
- (NSFileWrapper*) readFileWrapper;
- (NSString*) stringForType: (NSString*)dataType;
@end
/**
* The NSPasteboardOwner informal protocal defines the messages that
* the pasteboard system will send to a pasteboard owner if they are
* implemented. These are needed to support lazy provision of
* pasteboard data.
*/
@interface NSObject (NSPasteboardOwner)
/**
* This method is called by the pasteboard system when it does not have
* the data that has been asked for ... the pasteboard owner should
* supply the data to the pasteboard by calling -setData:forType: or one
* of the related methods.
*/
- (void) pasteboard: (NSPasteboard*)sender
provideDataForType: (NSString*)type;
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
/**
* Implemented where GNUstep pasteboard extensions are required.<br />
* This method is called by the pasteboard system when it does not have
* the data that has been asked for ... the pasteboard owner should
* supply the data to the pasteboard by calling -setData:forType: or one
* of the related methods.
*/
- (void) pasteboard: (NSPasteboard*)sender
provideDataForType: (NSString*)type
andVersion: (int)version;
#endif
/**
* This method is called by the pasteboard system when another object
* takes ownership of the pasteboard ... it lets the previous owner
* know that it is no longer required to supply data.
*/
- (void) pasteboardChangedOwner: (NSPasteboard*)sender;
@end
@interface NSPasteboard (GNUstepExtensions)
+ (NSString*) mimeTypeForPasteboardType: (NSString*)type;
+ (NSString*) pasteboardTypeForMimeType: (NSString*)mimeType;
- (void) setChangeCount: (int)count;
- (void) setHistory: (unsigned)length;
@end
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
#import <Foundation/NSURL.h>
@interface NSURL (NSPasteboard)
+ (NSURL*) URLFromPasteboard: (NSPasteboard*)pasteBoard;
- (void) writeToPasteboard: (NSPasteboard*)pasteBoard;
@end
#endif
//
// Return File-related Pasteboard Types
//
APPKIT_EXPORT NSString *NSCreateFileContentsPboardType(NSString *fileType);
APPKIT_EXPORT NSString *NSCreateFilenamePboardType(NSString *fileType);
APPKIT_EXPORT NSString *NSGetFileType(NSString *pboardType);
APPKIT_EXPORT NSArray *NSGetFileTypes(NSArray *pboardTypes);
#if defined(__cplusplus)
}
#endif
#endif // _GNUstep_H_NSPasteboard
|
bethp0413/gnustep-gui
|
Headers/AppKit/NSPasteboard.h
|
C
|
gpl-3.0
| 8,278 |
import leon.invariant._
import leon.instrumentation._
object QuickSort {
sealed abstract class List
case class Cons(head:BigInt,tail:List) extends List
case class Nil() extends List
def size(l:List): BigInt = {l match {
case Nil() => 0
case Cons(x,xs) => 1 + size(xs)
}}
case class Triple(fst:List,snd:List, trd: List)
def append(aList:List,bList:List): List = {aList match {
case Nil() => bList
case Cons(x, xs) => Cons(x,append(xs,bList))
}} ensuring(res => size(res) == size(aList) + size(bList) && tmpl((a,b) => steps <= a*size(aList) +b))
def partition(n:BigInt,l:List) : Triple = (l match {
case Nil() => Triple(Nil(), Nil(), Nil())
case Cons(x,xs) => {
val t = partition(n,xs)
if (n < x) Triple(t.fst, t.snd, Cons(x,t.trd))
else if(n == x) Triple(t.fst, Cons(x,t.snd), t.trd)
else Triple(Cons(x,t.fst), t.snd, t.trd)
}
}) ensuring(res => (size(l) == size(res.fst) + size(res.snd) + size(res.trd)) && tmpl((a,b) => steps <= a*size(l) +b))
//Unable to prove n^2 upper bound :-(
def quickSort(l:List): List = (l match {
case Nil() => Nil()
case Cons(x,Nil()) => l
case Cons(x,xs) => {
val t = partition(x, xs)
append(append(quickSort(t.fst), Cons(x, t.snd)), quickSort(t.trd))
}
case _ => l
})
//ensuring(res => size(l) == size(res) && tmpl((a,b,c,d) => steps <= a*(size(l)*size(l)) + c*size(l) + d))
}
|
epfl-lara/leon
|
testcases/orb-testcases/timing/QuickSort.scala
|
Scala
|
gpl-3.0
| 1,425 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="robots" content="index, follow, all" />
<title>Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\HttpDigestFactory | </title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css">
</head>
<body id="class">
<div class="header">
<ul>
<li><a href="../../../../../../classes.html">Classes</a></li>
<li><a href="../../../../../../namespaces.html">Namespaces</a></li>
<li><a href="../../../../../../interfaces.html">Interfaces</a></li>
<li><a href="../../../../../../traits.html">Traits</a></li>
<li><a href="../../../../../../doc-index.html">Index</a></li>
</ul>
<div id="title"></div>
<div class="type">Class</div>
<h1><a href="../Factory.html">Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory</a>\HttpDigestFactory</h1>
</div>
<div class="content">
<p> class
<strong>HttpDigestFactory</strong> implements
<a href="SecurityFactoryInterface.html"><abbr title="Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface">SecurityFactoryInterface</abbr></a></p>
<div class="description">
<p>HttpDigestFactory creates services for HTTP digest authentication.</p>
<p>
</p>
</div>
<h2>Methods</h2>
<table>
<tr>
<td class="type">
</td>
<td class="last">
<a href="HttpDigestFactory.html#method_create">create</a>(<a href="../../../../../Component/DependencyInjection/ContainerBuilder.html"><abbr title="Symfony\Component\DependencyInjection\ContainerBuilder">ContainerBuilder</abbr></a> $container, $id, $config, $userProvider, $defaultEntryPoint)
<p>
</p>
</td>
<td></td>
</tr>
<tr>
<td class="type">
</td>
<td class="last">
<a href="HttpDigestFactory.html#method_getPosition">getPosition</a>()
<p>
</p>
</td>
<td></td>
</tr>
<tr>
<td class="type">
</td>
<td class="last">
<a href="HttpDigestFactory.html#method_getKey">getKey</a>()
<p>
</p>
</td>
<td></td>
</tr>
<tr>
<td class="type">
</td>
<td class="last">
<a href="HttpDigestFactory.html#method_addConfiguration">addConfiguration</a>(<a href="../../../../../Component/Config/Definition/Builder/NodeDefinition.html"><abbr title="Symfony\Component\Config\Definition\Builder\NodeDefinition">NodeDefinition</abbr></a> $node)
<p>
</p>
</td>
<td></td>
</tr>
</table>
<h2>Details</h2>
<h3 id="method_create">
<div class="location">at line 27</div>
<code> public
<strong>create</strong>(<a href="../../../../../Component/DependencyInjection/ContainerBuilder.html"><abbr title="Symfony\Component\DependencyInjection\ContainerBuilder">ContainerBuilder</abbr></a> $container, $id, $config, $userProvider, $defaultEntryPoint)</code>
</h3>
<div class="details">
<p>
</p>
<p>
</p>
<div class="tags">
<h4>Parameters</h4>
<table>
<tr>
<td><a href="../../../../../Component/DependencyInjection/ContainerBuilder.html"><abbr title="Symfony\Component\DependencyInjection\ContainerBuilder">ContainerBuilder</abbr></a></td>
<td>$container</td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>$id</td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>$config</td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>$userProvider</td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>$defaultEntryPoint</td>
<td>
</td>
</tr>
</table>
</div>
</div>
<h3 id="method_getPosition">
<div class="location">at line 49</div>
<code> public
<strong>getPosition</strong>()</code>
</h3>
<div class="details">
<p>
</p>
<p>
</p>
<div class="tags">
</div>
</div>
<h3 id="method_getKey">
<div class="location">at line 54</div>
<code> public
<strong>getKey</strong>()</code>
</h3>
<div class="details">
<p>
</p>
<p>
</p>
<div class="tags">
</div>
</div>
<h3 id="method_addConfiguration">
<div class="location">at line 59</div>
<code> public
<strong>addConfiguration</strong>(<a href="../../../../../Component/Config/Definition/Builder/NodeDefinition.html"><abbr title="Symfony\Component\Config\Definition\Builder\NodeDefinition">NodeDefinition</abbr></a> $node)</code>
</h3>
<div class="details">
<p>
</p>
<p>
</p>
<div class="tags">
<h4>Parameters</h4>
<table>
<tr>
<td><a href="../../../../../Component/Config/Definition/Builder/NodeDefinition.html"><abbr title="Symfony\Component\Config\Definition\Builder\NodeDefinition">NodeDefinition</abbr></a></td>
<td>$node</td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated by <a href="http://sami.sensiolabs.org/" target="_top">Sami, the API Documentation Generator</a>.
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-89393-6']);
_gaq.push(['_setDomainName', '.symfony.com']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
|
rafaelgou/the-phpjs-local-docs-collection
|
symfony2/api/2.5/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/HttpDigestFactory.html
|
HTML
|
gpl-3.0
| 7,345 |
package com.github.bordertech.wcomponents.util;
import junit.framework.Assert;
import org.junit.After;
import org.junit.Test;
/**
* Factory_Test - JUnit tests for {@link Factory}.
*
* @author Yiannis Paschalidis.
* @since 1.0.0
*/
public class Factory_Test {
@After
public void restoreConfig() {
Config.reset();
}
@Test
public void testImplementationExists() {
Assert.assertFalse("No implementation should exist", Factory.implementationExists(
TestInterface.class));
final String key = ConfigurationProperties.FACTORY_PREFIX + TestInterface.class.getName();
Config.getInstance().setProperty(key, " ");
Assert.assertFalse("No implementation should exist", Factory.implementationExists(
TestInterface.class));
Config.getInstance().setProperty(key, TestInterfaceImpl.class.getName());
Assert.assertTrue("An implementation should exist", Factory.implementationExists(
TestInterface.class));
}
@Test(expected = SystemException.class)
public void testNewInstanceNoImpl() {
Factory.newInstance(TestInterface.class);
}
@Test
public void testNewInstanceWithImpl() {
Config.getInstance().setProperty(ConfigurationProperties.FACTORY_PREFIX + TestInterface.class.getName(),
TestInterfaceImpl.class.getName());
Assert.assertTrue("Should be an instanceof TestInterface", Factory.newInstance(
TestInterface.class) instanceof TestInterface);
}
/**
* A test interface to use with the factory.
*/
public interface TestInterface {
}
/**
* An implementation of the test interface.
*/
public static final class TestInterfaceImpl implements TestInterface {
}
}
|
marksreeves/wcomponents
|
wcomponents-core/src/test/java/com/github/bordertech/wcomponents/util/Factory_Test.java
|
Java
|
gpl-3.0
| 1,620 |
url: http://sanskrit.uohyd.ac.in/cgi-bin/scl/sandhi_splitter/sandhi_splitter.cgi?encoding=Unicode&sandhi_type=s&word=पुत्रस्तु<div id='finalout' style='border-style:solid; border-width:1px;padding:10px;color:blue;font-size:14px;height:200px'>पुत्रस्तु = <a title = "पुत्र पुं 1 एक">पुत्रः</a>+<a title = "तु अव्य">तु</a>/<script type="text/javascript">
function toggleMe(a){
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block";document.getElementById("more").style.display="none"; document.getElementById("less").style.display="block";
}
else{
e.style.display="none";document.getElementById("less").style.display="none"; document.getElementById("more").style.display="block";
}
return true;
}
</script>
<input type="button" onclick="return toggleMe('para1')" value="More" id="more"> <input type="button" onclick="return toggleMe('para1')" value="Less" id="less" style="display:none;" > <div id="para1" style="display:none; height:15px; border-style:none;border-width:1px;">
<a title = "पुत्र पुं 1 एक">पुत्रः</a>+<a title = "तु अव्य">तु</a>/<a title = "पुत्र पुं 8 एक/पुत्र नपुं 8 एक">पुत्र</a>+<a title = "स्तु नपुं 1 एक/स्तु नपुं 2 एक/स्तु नपुं 8 एक">स्तु</a>/</div><br />
|
sanskritiitd/sanskrit
|
uohCorpus.fil/uoh/uoh.filteredcorpus.txt_output/k.jali-2_ext.txt.out.dict_7025_sam.html
|
HTML
|
gpl-3.0
| 1,504 |
/* OggEnc
**
** This program is distributed under the GNU General Public License, version 2.
** A copy of this license is included with this source.
**
** Copyright 2000-2002, Michael Smith <[email protected]>
**
** Portions from Vorbize, (c) Kenneth Arnold <[email protected]>
** and libvorbis examples, (c) Monty <[email protected]>
**/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "platform.h"
#include <vorbis/vorbisenc.h>
#include "encode.h"
#include "i18n.h"
#define READSIZE 1024
int oe_write_page(ogg_page *page, FILE *fp);
#define SETD(toset) \
do {\
if(sscanf(opts[i].val, "%lf", &dval) != 1)\
fprintf(stderr, "For option %s, couldn't read value %s as double\n",\
opts[i].arg, opts[i].val);\
else\
toset = dval;\
} while(0)
#define SETL(toset) \
do {\
if(sscanf(opts[i].val, "%ld", &lval) != 1)\
fprintf(stderr, "For option %s, couldn't read value %s as integer\n",\
opts[i].arg, opts[i].val);\
else\
toset = lval;\
} while(0)
static void set_advanced_encoder_options(adv_opt *opts, int count,
vorbis_info *vi)
{
int hard = 0;
int avg = 0;
struct ovectl_ratemanage_arg ai;
int i;
double dval;
long lval;
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_GET, &ai);
for(i=0; i < count; i++) {
fprintf(stderr, _("Setting advanced encoder option \"%s\" to %s\n"),
opts[i].arg, opts[i].val);
if(!strcmp(opts[i].arg, "bitrate_average_window")) {
SETD(ai.bitrate_av_window);
avg = 1;
}
else if(!strcmp(opts[i].arg, "bitrate_average_window_center")) {
SETD(ai.bitrate_av_window_center);
avg = 1;
}
else if(!strcmp(opts[i].arg, "bitrate_average_low")) {
SETL(ai.bitrate_av_lo);
avg = 1;
}
else if(!strcmp(opts[i].arg, "bitrate_average_high")) {
SETL(ai.bitrate_av_hi);
avg = 1;
}
else if(!strcmp(opts[i].arg, "bitrate_hard_min")) {
SETL(ai.bitrate_hard_min);
hard = 1;
}
else if(!strcmp(opts[i].arg, "bitrate_hard_max")) {
SETL(ai.bitrate_hard_max);
hard = 1;
}
else if(!strcmp(opts[i].arg, "bitrate_hard_window")) {
SETD(ai.bitrate_hard_window);
hard = 1;
}
else if(!strcmp(opts[i].arg, "impulse_noisetune")) {
double val;
SETD(val);
vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &val);
}
else if(!strcmp(opts[i].arg, "lowpass_frequency")) {
double prev, new;
SETD(new);
vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_GET, &prev);
vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &new);
fprintf(stderr, _("Changed lowpass frequency from %f kHz to %f kHz\n"), prev, new);
}
else {
fprintf(stderr, _("Unrecognised advanced option \"%s\"\n"),
opts[i].arg);
}
}
if(hard)
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_HARD, &ai);
if(avg)
vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE_AVG, &ai);
}
int oe_encode(oe_enc_opt *opt)
{
ogg_stream_state os;
ogg_page og;
ogg_packet op;
vorbis_dsp_state vd;
vorbis_block vb;
vorbis_info vi;
long samplesdone=0;
int eos;
long bytes_written = 0, packetsdone=0;
double time_elapsed;
int ret=0;
TIMER *timer;
if(opt->channels > 255) {
fprintf(stderr, _("255 channels should be enough for anyone. (Sorry, vorbis doesn't support more)\n"));
return 1;
}
/* get start time. */
timer = timer_start();
if(!opt->managed && (opt->min_bitrate>=0 || opt->max_bitrate>=0)){
fprintf(stderr, _("Requesting a minimum or maximum bitrate requires --managed\n"));
return 1;
}
/* if we had no quality or bitrate spec at all from the user, use
the default quality with no management --Monty 20020711 */
if(opt->bitrate < 0 && opt->min_bitrate < 0 && opt->max_bitrate < 0){
opt->quality_set=1;
}
opt->start_encode(opt->infilename, opt->filename, opt->bitrate, opt->quality,
opt->quality_set, opt->managed, opt->min_bitrate, opt->max_bitrate);
/* Have vorbisenc choose a mode for us */
vorbis_info_init(&vi);
if(opt->quality_set > 0){
if(vorbis_encode_setup_vbr(&vi, opt->channels, opt->rate, opt->quality)){
fprintf(stderr, _("Mode initialisation failed: invalid parameters for quality\n"));
vorbis_info_clear(&vi);
return 1;
}
/* do we have optional hard quality restrictions? */
if(opt->max_bitrate > 0 || opt->min_bitrate > 0){
struct ovectl_ratemanage_arg ai;
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_GET, &ai);
ai.bitrate_hard_min=opt->min_bitrate;
ai.bitrate_hard_max=opt->max_bitrate;
ai.management_active=1;
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_SET, &ai);
}
}else {
if(vorbis_encode_setup_managed(&vi, opt->channels, opt->rate,
opt->max_bitrate>0?opt->max_bitrate*1000:-1,
opt->bitrate*1000,
opt->min_bitrate>0?opt->min_bitrate*1000:-1)){
fprintf(stderr, _("Mode initialisation failed: invalid parameters for bitrate\n"));
vorbis_info_clear(&vi);
return 1;
}
}
if(opt->managed && opt->bitrate < 0)
{
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_AVG, NULL);
}
else if(!opt->managed)
{
/* Turn off management entirely (if it was turned on). */
vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE_SET, NULL);
}
set_advanced_encoder_options(opt->advopt, opt->advopt_count, &vi);
vorbis_encode_setup_init(&vi);
/* Now, set up the analysis engine, stream encoder, and other
preparation before the encoding begins.
*/
vorbis_analysis_init(&vd,&vi);
vorbis_block_init(&vd,&vb);
ogg_stream_init(&os, opt->serialno);
/* Now, build the three header packets and send through to the stream
output stage (but defer actual file output until the main encode loop) */
{
ogg_packet header_main;
ogg_packet header_comments;
ogg_packet header_codebooks;
int result;
/* Build the packets */
vorbis_analysis_headerout(&vd,opt->comments,
&header_main,&header_comments,&header_codebooks);
/* And stream them out */
ogg_stream_packetin(&os,&header_main);
ogg_stream_packetin(&os,&header_comments);
ogg_stream_packetin(&os,&header_codebooks);
while((result = ogg_stream_flush(&os, &og)))
{
if(!result) break;
ret = oe_write_page(&og, opt->out);
if(ret != og.header_len + og.body_len)
{
opt->error(_("Failed writing header to output stream\n"));
ret = 1;
goto cleanup; /* Bail and try to clean up stuff */
}
}
}
eos = 0;
/* Main encode loop - continue until end of file */
while(!eos)
{
float **buffer = vorbis_analysis_buffer(&vd, READSIZE);
long samples_read = opt->read_samples(opt->readdata,
buffer, READSIZE);
if(samples_read ==0)
/* Tell the library that we wrote 0 bytes - signalling the end */
vorbis_analysis_wrote(&vd,0);
else
{
samplesdone += samples_read;
/* Call progress update every 10 pages */
if(packetsdone>=10)
{
double time;
packetsdone = 0;
time = timer_time(timer);
opt->progress_update(opt->filename, opt->total_samples_per_channel,
samplesdone, time);
}
/* Tell the library how many samples (per channel) we wrote
into the supplied buffer */
vorbis_analysis_wrote(&vd, samples_read);
}
/* While we can get enough data from the library to analyse, one
block at a time... */
while(vorbis_analysis_blockout(&vd,&vb)==1)
{
/* Do the main analysis, creating a packet */
vorbis_analysis(&vb, NULL);
vorbis_bitrate_addblock(&vb);
while(vorbis_bitrate_flushpacket(&vd, &op))
{
/* Add packet to bitstream */
ogg_stream_packetin(&os,&op);
packetsdone++;
/* If we've gone over a page boundary, we can do actual output,
so do so (for however many pages are available) */
while(!eos)
{
int result = ogg_stream_pageout(&os,&og);
if(!result) break;
ret = oe_write_page(&og, opt->out);
if(ret != og.header_len + og.body_len)
{
opt->error(_("Failed writing data to output stream\n"));
ret = 1;
goto cleanup; /* Bail */
}
else
bytes_written += ret;
if(ogg_page_eos(&og))
eos = 1;
}
}
}
}
ret = 0; /* Success, set return value to 0 since other things reuse it
* for nefarious purposes. */
/* Cleanup time */
cleanup:
ogg_stream_clear(&os);
vorbis_block_clear(&vb);
vorbis_dsp_clear(&vd);
vorbis_info_clear(&vi);
time_elapsed = timer_time(timer);
opt->end_encode(opt->filename, time_elapsed, opt->rate, samplesdone, bytes_written);
timer_clear(timer);
return ret;
}
void update_statistics_full(char *fn, long total, long done, double time)
{
static char *spinner="|/-\\";
static int spinpoint = 0;
double remain_time;
int minutes=0,seconds=0;
remain_time = time/((double)done/(double)total) - time;
minutes = ((int)remain_time)/60;
seconds = (int)(remain_time - (double)((int)remain_time/60)*60);
fprintf(stderr, "\r");
fprintf(stderr, _("\t[%5.1f%%] [%2dm%.2ds remaining] %c"),
done*100.0/total, minutes, seconds, spinner[spinpoint++%4]);
}
void update_statistics_notime(char *fn, long total, long done, double time)
{
static char *spinner="|/-\\";
static int spinpoint =0;
fprintf(stderr, "\r");
fprintf(stderr, _("\tEncoding [%2dm%.2ds so far] %c"),
((int)time)/60, (int)(time - (double)((int)time/60)*60),
spinner[spinpoint++%4]);
}
int oe_write_page(ogg_page *page, FILE *fp)
{
int written;
written = fwrite(page->header,1,page->header_len, fp);
written += fwrite(page->body,1,page->body_len, fp);
return written;
}
void final_statistics(char *fn, double time, int rate, long samples, long bytes)
{
double speed_ratio;
if(fn)
fprintf(stderr, _("\n\nDone encoding file \"%s\"\n"), fn);
else
fprintf(stderr, _("\n\nDone encoding.\n"));
speed_ratio = (double)samples / (double)rate / time;
fprintf(stderr, _("\n\tFile length: %dm %04.1fs\n"),
(int)(samples/rate/60),
samples/rate -
floor(samples/rate/60)*60);
fprintf(stderr, _("\tElapsed time: %dm %04.1fs\n"),
(int)(time/60),
time - floor(time/60)*60);
fprintf(stderr, _("\tRate: %.4f\n"), speed_ratio);
fprintf(stderr, _("\tAverage bitrate: %.1f kb/s\n\n"),
8./1000.*((double)bytes/((double)samples/(double)rate)));
}
void final_statistics_null(char *fn, double time, int rate, long samples,
long bytes)
{
/* Don't do anything, this is just a placeholder function for quiet mode */
}
void update_statistics_null(char *fn, long total, long done, double time)
{
/* So is this */
}
void encode_error(char *errmsg)
{
fprintf(stderr, "\n%s\n", errmsg);
}
static void print_brconstraints(int min, int max)
{
if(min > 0 && max > 0)
fprintf(stderr, "(min %d kbps, max %d kbps)", min,max);
else if(min > 0)
fprintf(stderr, "(min %d kbps, no max)", min);
else if(max > 0)
fprintf(stderr, "(no min, max %d kbps)", max);
else
fprintf(stderr, "(no min or max)");
}
void start_encode_full(char *fn, char *outfn, int bitrate, float quality, int qset,
int managed, int min, int max)
{
if(bitrate>0){
if(managed>0){
fprintf(stderr, _("Encoding %s%s%s to \n "
"%s%s%s \nat average bitrate %d kbps "),
fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
bitrate);
print_brconstraints(min,max);
fprintf(stderr, ", \nusing full bitrate management engine\n");
} else {
fprintf(stderr, _("Encoding %s%s%s to \n %s%s%s \nat approximate bitrate %d kbps (VBR encoding enabled)\n"),
fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
bitrate);
}
}else{
if(qset>0){
if(managed>0){
fprintf(stderr, _("Encoding %s%s%s to \n %s%s%s \nat quality level %2.2f using constrained VBR "),
fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
quality * 10);
print_brconstraints(min,max);
fprintf(stderr, "\n");
}else{
fprintf(stderr, _("Encoding %s%s%s to \n %s%s%s \nat quality %2.2f\n"),
fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"",
quality * 10);
}
}else{
fprintf(stderr, _("Encoding %s%s%s to \n %s%s%s \nusing bitrate management "),
fn?"\"":"", fn?fn:_("standard input"), fn?"\"":"",
outfn?"\"":"", outfn?outfn:_("standard output"), outfn?"\"":"");
print_brconstraints(min,max);
fprintf(stderr, "\n");
}
}
}
void start_encode_null(char *fn, char *outfn, int bitrate, float quality, int qset,
int managed, int min, int max)
{
}
|
mikemakuch/muzikbrowzer
|
3rdparty/ogg/vorbis-tools-1.0/oggenc/encode.c
|
C
|
gpl-3.0
| 13,294 |
/**
* Internal representation of a Jasmine suite.
*
* @constructor
* @param {jasmine.Env} env
* @param {String} description
* @param {Function} specDefinitions
* @param {jasmine.Suite} parentSuite
*/
jasmine.Suite = function(env, description, specDefinitions, parentSuite) {
var self = this;
self.id = env.nextSuiteId ? env.nextSuiteId() : null;
self.description = description;
self.queue = new jasmine.Queue(env);
self.parentSuite = parentSuite;
self.env = env;
self.before_ = [];
self.after_ = [];
self.specs_ = [];
};
jasmine.Suite.prototype.getFullName = function() {
var fullName = this.description;
for (var parentSuite = this.parentSuite; parentSuite; parentSuite = parentSuite.parentSuite) {
fullName = parentSuite.description + ' ' + fullName;
}
return fullName;
};
jasmine.Suite.prototype.finish = function(onComplete) {
this.env.reporter.reportSuiteResults(this);
this.finished = true;
if (typeof(onComplete) == 'function') {
onComplete();
}
};
jasmine.Suite.prototype.beforeEach = function(beforeEachFunction) {
beforeEachFunction.typeName = 'beforeEach';
this.before_.push(beforeEachFunction);
};
jasmine.Suite.prototype.afterEach = function(afterEachFunction) {
afterEachFunction.typeName = 'afterEach';
this.after_.push(afterEachFunction);
};
jasmine.Suite.prototype.results = function() {
return this.queue.results();
};
jasmine.Suite.prototype.add = function(block) {
if (block instanceof jasmine.Suite) {
this.env.currentRunner().addSuite(block);
} else {
this.specs_.push(block);
}
this.queue.add(block);
};
jasmine.Suite.prototype.specs = function() {
return this.specs_;
};
jasmine.Suite.prototype.execute = function(onComplete) {
var self = this;
this.queue.start(function () {
self.finish(onComplete);
});
};
|
jevy/MyMapNow
|
vendor/plugins/jasmine/src/Suite.js
|
JavaScript
|
gpl-3.0
| 1,827 |
# Contributing to FFCS on The Go
**:+1: :tada: First off, thanks for taking the time to contribute! :tada: :+1:**
## Starting to Contribute
- Make sure you create an issue before sending PR. Issue can be anything a bug or a feature request.
- Wait for someone to assign the issue to you before you start working on it.
- The PR must be on gh-pages and NOT master.
|
sangeeth96/VIT-Time-Table-Visualizer
|
.github/CONTRIBUTING.md
|
Markdown
|
gpl-3.0
| 368 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Mon Aug 09 16:58:57 PDT 1999 -->
<TITLE>
: Class ConvertColor
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> <FONT ID="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/CompressSetup.html"><B>PREV CLASS</B></A>
<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/Fwddct.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="ConvertColor.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.sun.jimi.core.encoder.jpg</FONT>
<BR>
Class ConvertColor</H2>
<PRE>
java.lang.Object
|
+--<B>com.sun.jimi.core.encoder.jpg.ConvertColor</B>
</PRE>
<HR>
<DL>
<DT>public class <B>ConvertColor</B><DT>extends java.lang.Object</DL>
<P>
<HR>
<P>
<!-- ======== INNER CLASS SUMMARY ======== -->
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/Shared.html">Shared</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/ConvertColor.html#shared">shared</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/ConvertColor.html#ConvertColor(com.sun.jimi.core.encoder.jpg.Shared)">ConvertColor</A></B>(<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/Shared.html">Shared</A> shared)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/ConvertColor.html#get_grayscale_rows(com.sun.jimi.core.encoder.jpg.CompressInfo, int, short[][][])">get_grayscale_rows</A></B>(<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/CompressInfo.html">CompressInfo</A> cinfo,
int rows_to_read,
short[][][] image_data)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/ConvertColor.html#get_rgb_ycc_rows(com.sun.jimi.core.encoder.jpg.CompressInfo, int, short[][][])">get_rgb_ycc_rows</A></B>(<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/CompressInfo.html">CompressInfo</A> cinfo,
int rows_to_read,
short[][][] image_data)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/ConvertColor.html#rgb_ycc_init(com.sun.jimi.core.encoder.jpg.CompressInfo)">rgb_ycc_init</A></B>(<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/CompressInfo.html">CompressInfo</A> cinfo)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/ConvertColor.html#scaleToInt(double)">scaleToInt</A></B>(double f)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" ID="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" ID="TableRowColor">
<TD><CODE>clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="shared"><!-- --></A><H3>
shared</H3>
<PRE>
protected <A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/Shared.html">Shared</A> <B>shared</B></PRE>
<DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="ConvertColor(com.sun.jimi.core.encoder.jpg.Shared)"><!-- --></A><H3>
ConvertColor</H3>
<PRE>
public <B>ConvertColor</B>(<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/Shared.html">Shared</A> shared)</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" ID="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="scaleToInt(double)"><!-- --></A><H3>
scaleToInt</H3>
<PRE>
public static int <B>scaleToInt</B>(double f)</PRE>
<DL>
</DL>
<HR>
<A NAME="rgb_ycc_init(com.sun.jimi.core.encoder.jpg.CompressInfo)"><!-- --></A><H3>
rgb_ycc_init</H3>
<PRE>
public void <B>rgb_ycc_init</B>(<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/CompressInfo.html">CompressInfo</A> cinfo)</PRE>
<DL>
</DL>
<HR>
<A NAME="get_rgb_ycc_rows(com.sun.jimi.core.encoder.jpg.CompressInfo, int, short[][][])"><!-- --></A><H3>
get_rgb_ycc_rows</H3>
<PRE>
public void <B>get_rgb_ycc_rows</B>(<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/CompressInfo.html">CompressInfo</A> cinfo,
int rows_to_read,
short[][][] image_data)
throws <A HREF="../../../../../../com/sun/jimi/core/JimiException.html">JimiException</A></PRE>
<DL>
</DL>
<HR>
<A NAME="get_grayscale_rows(com.sun.jimi.core.encoder.jpg.CompressInfo, int, short[][][])"><!-- --></A><H3>
get_grayscale_rows</H3>
<PRE>
public void <B>get_grayscale_rows</B>(<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/CompressInfo.html">CompressInfo</A> cinfo,
int rows_to_read,
short[][][] image_data)
throws <A HREF="../../../../../../com/sun/jimi/core/JimiException.html">JimiException</A></PRE>
<DL>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" ID="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT ID="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" ID="NavBarCell1Rev"> <FONT ID="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" ID="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/CompressSetup.html"><B>PREV CLASS</B></A>
<A HREF="../../../../../../com/sun/jimi/core/encoder/jpg/Fwddct.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" ID="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="ConvertColor.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" ID="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>
|
ShuttleworthFoundation/tuxlab-Cookbook
|
libs/Jimi/docs/html/api/com/sun/jimi/core/encoder/jpg/ConvertColor.html
|
HTML
|
gpl-3.0
| 12,777 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file at
# https://www.github.com/GoogleCloudPlatform/magic-modules
#
# ----------------------------------------------------------------------------
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ["preview"],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: gcp_sql_database
description:
- Represents a SQL database inside the Cloud SQL instance, hosted in Google's cloud.
short_description: Creates a GCP Database
version_added: 2.7
author: Google Inc. (@googlecloudplatform)
requirements:
- python >= 2.6
- requests >= 2.18.4
- google-auth >= 1.3.0
options:
state:
description:
- Whether the given object should exist in GCP
choices:
- present
- absent
default: present
charset:
description:
- The MySQL charset value.
required: false
collation:
description:
- The MySQL collation value.
required: false
name:
description:
- The name of the database in the Cloud SQL instance.
- This does not include the project ID or instance name.
required: false
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
- 'This field represents a link to a Instance resource in GCP. It can be specified
in two ways. First, you can place in the name of the resource here as a string
Alternatively, you can add `register: name-of-resource` to a gcp_sql_instance
task and then set this instance field to "{{ name-of-resource }}"'
required: true
extends_documentation_fragment: gcp
'''
EXAMPLES = '''
- name: create a instance
gcp_sql_instance:
name: "{{resource_name}}-3"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: instance
- name: create a database
gcp_sql_database:
name: "test_object"
charset: utf8
instance: "{{ instance }}"
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
charset:
description:
- The MySQL charset value.
returned: success
type: str
collation:
description:
- The MySQL collation value.
returned: success
type: str
name:
description:
- The name of the database in the Cloud SQL instance.
- This does not include the project ID or instance name.
returned: success
type: str
instance:
description:
- The name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: str
'''
################################################################################
# Imports
################################################################################
from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict
import json
import time
################################################################################
# Main
################################################################################
def main():
"""Main function"""
module = GcpModule(
argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'),
charset=dict(type='str'),
collation=dict(type='str'),
name=dict(type='str'),
instance=dict(required=True)
)
)
if not module.params['scopes']:
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
state = module.params['state']
kind = 'sql#database'
fetch = fetch_resource(module, self_link(module), kind)
changed = False
if fetch:
if state == 'present':
if is_different(module, fetch):
update(module, self_link(module), kind)
fetch = fetch_resource(module, self_link(module), kind)
changed = True
else:
delete(module, self_link(module), kind)
fetch = {}
changed = True
else:
if state == 'present':
fetch = create(module, collection(module), kind)
changed = True
else:
fetch = {}
fetch.update({'changed': changed})
module.exit_json(**fetch)
def create(module, link, kind):
auth = GcpSession(module, 'sql')
return wait_for_operation(module, auth.post(link, resource_to_request(module)))
def update(module, link, kind):
auth = GcpSession(module, 'sql')
return wait_for_operation(module, auth.put(link, resource_to_request(module)))
def delete(module, link, kind):
auth = GcpSession(module, 'sql')
return wait_for_operation(module, auth.delete(link))
def resource_to_request(module):
request = {
u'kind': 'sql#database',
u'charset': module.params.get('charset'),
u'collation': module.params.get('collation'),
u'name': module.params.get('name')
}
return_vals = {}
for k, v in request.items():
if v or v is False:
return_vals[k] = v
return return_vals
def fetch_resource(module, link, kind, allow_not_found=True):
auth = GcpSession(module, 'sql')
return return_if_object(module, auth.get(link), kind, allow_not_found)
def self_link(module):
res = {
'project': module.params['project'],
'instance': replace_resource_dict(module.params['instance'], 'name'),
'name': module.params['name']
}
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases/{name}".format(**res)
def collection(module):
res = {
'project': module.params['project'],
'instance': replace_resource_dict(module.params['instance'], 'name')
}
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**res)
def return_if_object(module, response, kind, allow_not_found=False):
# If not found, return nothing.
if allow_not_found and response.status_code == 404:
return None
# If no content, return nothing.
if response.status_code == 204:
return None
# SQL only: return on 403 if not exist
if allow_not_found and response.status_code == 403:
return None
try:
result = response.json()
except getattr(json.decoder, 'JSONDecodeError', ValueError) as inst:
module.fail_json(msg="Invalid JSON response with error: %s" % inst)
if navigate_hash(result, ['error', 'errors']):
module.fail_json(msg=navigate_hash(result, ['error', 'errors']))
return result
def is_different(module, response):
request = resource_to_request(module)
response = response_to_hash(module, response)
# Remove all output-only from response.
response_vals = {}
for k, v in response.items():
if k in request:
response_vals[k] = v
request_vals = {}
for k, v in request.items():
if k in response:
request_vals[k] = v
return GcpRequest(request_vals) != GcpRequest(response_vals)
# Remove unnecessary properties from the response.
# This is for doing comparisons with Ansible's current parameters.
def response_to_hash(module, response):
return {
u'charset': response.get(u'charset'),
u'collation': response.get(u'collation'),
u'name': response.get(u'name')
}
def async_op_url(module, extra_data=None):
if extra_data is None:
extra_data = {}
url = "https://www.googleapis.com/sql/v1beta4/projects/{project}/operations/{op_id}"
combined = extra_data.copy()
combined.update(module.params)
return url.format(**combined)
def wait_for_operation(module, response):
op_result = return_if_object(module, response, 'sql#operation')
if op_result is None:
return {}
status = navigate_hash(op_result, ['status'])
wait_done = wait_for_completion(status, op_result, module)
return fetch_resource(module, navigate_hash(wait_done, ['targetLink']), 'sql#database')
def wait_for_completion(status, op_result, module):
op_id = navigate_hash(op_result, ['name'])
op_uri = async_op_url(module, {'op_id': op_id})
while status != 'DONE':
raise_if_errors(op_result, ['error', 'errors'], 'message')
time.sleep(1.0)
op_result = fetch_resource(module, op_uri, 'sql#operation')
status = navigate_hash(op_result, ['status'])
return op_result
def raise_if_errors(response, err_path, module):
errors = navigate_hash(response, err_path)
if errors is not None:
module.fail_json(msg=errors)
if __name__ == '__main__':
main()
|
gregdek/ansible
|
lib/ansible/modules/cloud/google/gcp_sql_database.py
|
Python
|
gpl-3.0
| 9,727 |
using System;
using Server;
using Server.Items;
namespace Server.Mobiles
{
[CorpseName( "an efreet corpse" )]
public class Efreet : BaseCreature
{
[Constructable]
public Efreet()
: base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
Name = "an efreet";
Body = 131;
BaseSoundID = 768;
SetStr( 326, 355 );
SetDex( 266, 285 );
SetInt( 171, 195 );
SetHits( 196, 213 );
SetDamage( 11, 13 );
SetDamageType( ResistanceType.Physical, 0 );
SetDamageType( ResistanceType.Fire, 50 );
SetDamageType( ResistanceType.Energy, 50 );
SetResistance( ResistanceType.Physical, 50, 60 );
SetResistance( ResistanceType.Fire, 60, 70 );
SetResistance( ResistanceType.Poison, 30, 40 );
SetResistance( ResistanceType.Energy, 40, 50 );
SetSkill( SkillName.EvalInt, 60.1, 75.0 );
SetSkill( SkillName.Magery, 60.1, 75.0 );
SetSkill( SkillName.MagicResist, 60.1, 75.0 );
SetSkill( SkillName.Tactics, 60.1, 80.0 );
SetSkill( SkillName.Wrestling, 60.1, 80.0 );
Fame = 10000;
Karma = -10000;
}
public override void GenerateLoot()
{
AddLoot( LootPack.Rich );
AddLoot( LootPack.Average );
AddLoot( LootPack.Gems );
if ( 0.02 > Utility.RandomDouble() )
{
switch ( Utility.Random( 5 ) )
{
case 0: PackItem( new DaemonArms() ); break;
case 1: PackItem( new DaemonChest() ); break;
case 2: PackItem( new DaemonGloves() ); break;
case 3: PackItem( new DaemonLegs() ); break;
case 4: PackItem( new DaemonHelm() ); break;
}
}
}
public override int TreasureMapLevel { get { return 4; } }
public override bool BleedImmune { get { return true; } }
public Efreet( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
/*int version = */
reader.ReadInt();
}
}
}
|
xrunuo/xrunuo
|
Scripts/Distro/Mobiles/Monsters/Elemental/Magic/Efreet.cs
|
C#
|
gpl-3.0
| 2,083 |
/*
* Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2016 Cppcheck team.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "token.h"
#include "errorlogger.h"
#include "settings.h"
#include "symboldatabase.h"
#include "utils.h"
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <string>
#include <iostream>
#include <cctype>
#include <sstream>
#include <map>
#include <stack>
#include <algorithm>
Token::Token(Token **t) :
tokensBack(t),
_next(0),
_previous(0),
_link(0),
_scope(0),
_function(0), // Initialize whole union
_varId(0),
_fileIndex(0),
_linenr(0),
_progressValue(0),
_tokType(eNone),
_flags(0),
_astOperand1(nullptr),
_astOperand2(nullptr),
_astParent(nullptr),
_originalName(nullptr),
valuetype(nullptr)
{
}
Token::~Token()
{
delete _originalName;
delete valuetype;
}
void Token::update_property_info()
{
if (!_str.empty()) {
if (_str == "true" || _str == "false")
_tokType = eBoolean;
else if (_str[0] == '_' || std::isalpha((unsigned char)_str[0])) { // Name
if (_varId)
_tokType = eVariable;
else if (_tokType != eVariable && _tokType != eFunction && _tokType != eType && _tokType != eKeyword)
_tokType = eName;
} else if (std::isdigit((unsigned char)_str[0]) || (_str.length() > 1 && _str[0] == '-' && std::isdigit((unsigned char)_str[1])))
_tokType = eNumber;
else if (_str.length() > 1 && _str[0] == '"' && _str.back() == '"')
_tokType = eString;
else if (_str.length() > 1 && _str[0] == '\'' && _str.back() == '\'')
_tokType = eChar;
else if (_str == "=" || _str == "<<=" || _str == ">>=" ||
(_str.size() == 2U && _str[1] == '=' && std::strchr("+-*/%&^|", _str[0])))
_tokType = eAssignmentOp;
else if (_str.size() == 1 && _str.find_first_of(",[]()?:") != std::string::npos)
_tokType = eExtendedOp;
else if (_str=="<<" || _str==">>" || (_str.size()==1 && _str.find_first_of("+-*/%") != std::string::npos))
_tokType = eArithmeticalOp;
else if (_str.size() == 1 && _str.find_first_of("&|^~") != std::string::npos)
_tokType = eBitOp;
else if (_str.size() <= 2 &&
(_str == "&&" ||
_str == "||" ||
_str == "!"))
_tokType = eLogicalOp;
else if (_str.size() <= 2 && !_link &&
(_str == "==" ||
_str == "!=" ||
_str == "<" ||
_str == "<=" ||
_str == ">" ||
_str == ">="))
_tokType = eComparisonOp;
else if (_str.size() == 2 &&
(_str == "++" ||
_str == "--"))
_tokType = eIncDecOp;
else if (_str.size() == 1 && (_str.find_first_of("{}") != std::string::npos || (_link && _str.find_first_of("<>") != std::string::npos)))
_tokType = eBracket;
else
_tokType = eOther;
} else {
_tokType = eNone;
}
update_property_isStandardType();
}
namespace {
const std::set<std::string> stdTypes = make_container<std::set<std::string> >() <<
"bool" << "char" << "char16_t" << "char32_t" << "double" << "float" << "int" << "long" << "short" << "size_t" << "void" << "wchar_t";
}
void Token::update_property_isStandardType()
{
isStandardType(false);
if (_str.size() < 3)
return;
if (stdTypes.find(_str)!=stdTypes.end()) {
isStandardType(true);
_tokType = eType;
}
}
bool Token::isUpperCaseName() const
{
if (!isName())
return false;
for (size_t i = 0; i < _str.length(); ++i) {
if (std::islower(_str[i]))
return false;
}
return true;
}
void Token::concatStr(std::string const& b)
{
_str.erase(_str.length() - 1);
_str.append(b.begin() + 1, b.end());
update_property_info();
}
std::string Token::strValue() const
{
assert(_tokType == eString);
std::string ret(_str.substr(1, _str.length() - 2));
std::string::size_type pos = 0U;
while ((pos = ret.find('\\', pos)) != std::string::npos) {
ret.erase(pos,1U);
if (ret[pos] >= 'a') {
if (ret[pos] == 'n')
ret[pos] = '\n';
else if (ret[pos] == 'r')
ret[pos] = '\r';
else if (ret[pos] == 't')
ret[pos] = '\t';
}
if (ret[pos] == '0')
return ret.substr(0,pos);
pos++;
}
return ret;
}
void Token::deleteNext(unsigned long index)
{
while (_next && index) {
Token *n = _next;
_next = n->next();
delete n;
--index;
}
if (_next)
_next->previous(this);
else if (tokensBack)
*tokensBack = this;
}
void Token::swapWithNext()
{
if (_next) {
std::swap(_str, _next->_str);
std::swap(_tokType, _next->_tokType);
std::swap(_flags, _next->_flags);
std::swap(_varId, _next->_varId);
std::swap(_fileIndex, _next->_fileIndex);
std::swap(_link, _next->_link);
std::swap(_scope, _next->_scope);
std::swap(_function, _next->_function);
std::swap(_originalName, _next->_originalName);
std::swap(values, _next->values);
std::swap(_progressValue, _next->_progressValue);
}
}
void Token::deleteThis()
{
if (_next) { // Copy next to this and delete next
_str = _next->_str;
_tokType = _next->_tokType;
_flags = _next->_flags;
_varId = _next->_varId;
_fileIndex = _next->_fileIndex;
_linenr = _next->_linenr;
_link = _next->_link;
_scope = _next->_scope;
_function = _next->_function;
_variable = _next->_variable;
_type = _next->_type;
if (_next->_originalName) {
delete _originalName;
_originalName = _next->_originalName;
_next->_originalName = nullptr;
}
values = _next->values;
if (_link)
_link->link(this);
deleteNext();
} else if (_previous && _previous->_previous) { // Copy previous to this and delete previous
_str = _previous->_str;
_tokType = _previous->_tokType;
_flags = _previous->_flags;
_varId = _previous->_varId;
_fileIndex = _previous->_fileIndex;
_linenr = _previous->_linenr;
_link = _previous->_link;
_scope = _previous->_scope;
_function = _previous->_function;
_variable = _previous->_variable;
_type = _previous->_type;
if (_previous->_originalName) {
delete _originalName;
_originalName = _previous->_originalName;
_previous->_originalName = nullptr;
}
values = _previous->values;
if (_link)
_link->link(this);
Token* toDelete = _previous;
_previous = _previous->_previous;
_previous->_next = this;
delete toDelete;
} else {
// We are the last token in the list, we can't delete
// ourselves, so just make us empty
str("");
}
}
void Token::replace(Token *replaceThis, Token *start, Token *end)
{
// Fix the whole in the old location of start and end
if (start->previous())
start->previous()->next(end->next());
if (end->next())
end->next()->previous(start->previous());
// Move start and end to their new location
if (replaceThis->previous())
replaceThis->previous()->next(start);
if (replaceThis->next())
replaceThis->next()->previous(end);
start->previous(replaceThis->previous());
end->next(replaceThis->next());
if (end->tokensBack && *(end->tokensBack) == end) {
while (end->next())
end = end->next();
*(end->tokensBack) = end;
}
// Update _progressValue, fileIndex and linenr
for (Token *tok = start; tok != end->next(); tok = tok->next())
tok->_progressValue = replaceThis->_progressValue;
// Delete old token, which is replaced
delete replaceThis;
}
const Token *Token::tokAt(int index) const
{
const Token *tok = this;
while (index > 0 && tok) {
tok = tok->next();
--index;
}
while (index < 0 && tok) {
tok = tok->previous();
++index;
}
return tok;
}
const Token *Token::linkAt(int index) const
{
const Token *tok = this->tokAt(index);
if (!tok) {
throw InternalError(this, "Internal error. Token::linkAt called with index outside the tokens range.");
}
return tok->link();
}
const std::string &Token::strAt(int index) const
{
const Token *tok = this->tokAt(index);
return tok ? tok->_str : emptyString;
}
static int multiComparePercent(const Token *tok, const char*& haystack, bool emptyStringFound, unsigned int varid)
{
++haystack;
// Compare only the first character of the string for optimization reasons
switch (haystack[0]) {
case '\0':
case ' ':
case '|':
//simple '%' character
haystack += 1;
if (tok->isArithmeticalOp() && tok->str() == "%")
return 1;
break;
case 'v':
if (haystack[3] == '%') { // %var%
haystack += 4;
if (tok->varId() != 0)
return 1;
} else { // %varid%
if (varid == 0) {
throw InternalError(tok, "Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers");
}
haystack += 6;
if (tok->varId() == varid)
return 1;
}
break;
case 't':
// Type (%type%)
{
haystack += 5;
if (tok->isName() && tok->varId() == 0 && !tok->isKeyword())
return 1;
}
break;
case 'a':
// Accept any token (%any%) or assign (%assign%)
{
if (haystack[3] == '%') { // %any%
haystack += 4;
return 1;
} else { // %assign%
haystack += 7;
if (tok->isAssignmentOp())
return 1;
}
}
break;
case 'n':
// Number (%num%) or name (%name%)
{
if (haystack[4] == '%') { // %name%
haystack += 5;
if (tok->isName())
return 1;
} else {
haystack += 4;
if (tok->isNumber())
return 1;
}
}
break;
case 'c': {
haystack += 1;
// Character (%char%)
if (haystack[0] == 'h') {
haystack += 4;
if (tok->tokType() == Token::eChar)
return 1;
}
// Const operator (%cop%)
else if (haystack[1] == 'p') {
haystack += 3;
if (tok->isConstOp())
return 1;
}
// Comparison operator (%comp%)
else {
haystack += 4;
if (tok->isComparisonOp())
return 1;
}
}
break;
case 's':
// String (%str%)
{
haystack += 4;
if (tok->tokType() == Token::eString)
return 1;
}
break;
case 'b':
// Bool (%bool%)
{
haystack += 5;
if (tok->isBoolean())
return 1;
}
break;
case 'o': {
++haystack;
if (haystack[1] == '%') {
// Op (%op%)
if (haystack[0] == 'p') {
haystack += 2;
if (tok->isOp())
return 1;
}
// Or (%or%)
else {
haystack += 2;
if (tok->tokType() == Token::eBitOp && tok->str() == "|")
return 1;
}
}
// Oror (%oror%)
else {
haystack += 4;
if (tok->tokType() == Token::eLogicalOp && tok->str() == "||")
return 1;
}
}
break;
default:
//unknown %cmd%, abort
throw InternalError(tok, "Unexpected command");
}
if (*haystack == '|')
haystack += 1;
else if (*haystack == ' ' || *haystack == '\0')
return emptyStringFound ? 0 : -1;
else
return -1;
return 0xFFFF;
}
int Token::multiCompare(const Token *tok, const char *haystack, unsigned int varid)
{
bool emptyStringFound = false;
const char *needle = tok->str().c_str();
const char *needlePointer = needle;
for (;;) {
if (needlePointer == needle && haystack[0] == '%' && haystack[1] != '|' && haystack[1] != '\0' && haystack[1] != ' ') {
int ret = multiComparePercent(tok, haystack, emptyStringFound, varid);
if (ret < 2)
return ret;
} else if (*haystack == '|') {
if (*needlePointer == 0) {
// If needle is at the end, we have a match.
return 1;
} else if (needlePointer == needle) {
// If needlePointer was not increased at all, we had a empty
// string in the haystack
emptyStringFound = true;
}
needlePointer = needle;
++haystack;
} else if (*needlePointer == *haystack) {
if (*needlePointer == '\0')
return 1;
++needlePointer;
++haystack;
} else if (*haystack == ' ' || *haystack == '\0') {
if (needlePointer == needle)
return 0;
break;
}
// If haystack and needle don't share the same character,
// find next '|' character.
else {
needlePointer = needle;
do {
++haystack;
} while (*haystack != ' ' && *haystack != '|' && *haystack);
if (*haystack == ' ' || *haystack == '\0') {
return emptyStringFound ? 0 : -1;
}
++haystack;
}
}
if (*needlePointer == '\0')
return 1;
// If empty string was found earlier from the haystack
if (emptyStringFound)
return 0;
return -1;
}
bool Token::simpleMatch(const Token *tok, const char pattern[])
{
if (!tok)
return false; // shortcut
const char *current = pattern;
const char *next = std::strchr(pattern, ' ');
if (!next)
next = pattern + std::strlen(pattern);
while (*current) {
std::size_t length = next - current;
if (!tok || length != tok->_str.length() || std::strncmp(current, tok->_str.c_str(), length))
return false;
current = next;
if (*next) {
next = std::strchr(++current, ' ');
if (!next)
next = current + std::strlen(current);
}
tok = tok->next();
}
return true;
}
bool Token::firstWordEquals(const char *str, const char *word)
{
for (;;) {
if (*str != *word) {
return (*str == ' ' && *word == 0);
} else if (*str == 0)
break;
++str;
++word;
}
return true;
}
const char *Token::chrInFirstWord(const char *str, char c)
{
for (;;) {
if (*str == ' ' || *str == 0)
return 0;
if (*str == c)
return str;
++str;
}
}
bool Token::Match(const Token *tok, const char pattern[], unsigned int varid)
{
const char *p = pattern;
while (*p) {
// Skip spaces in pattern..
while (*p == ' ')
++p;
// No token => Success!
if (*p == '\0')
break;
if (!tok) {
// If we have no tokens, pattern "!!else" should return true
if (p[0] == '!' && p[1] == '!' && p[2] != '\0') {
while (*p && *p != ' ')
++p;
continue;
} else
return false;
}
// [.. => search for a one-character token..
if (p[0] == '[' && chrInFirstWord(p, ']')) {
if (tok->str().length() != 1)
return false;
const char *temp = p+1;
bool chrFound = false;
unsigned int count = 0;
while (*temp && *temp != ' ') {
if (*temp == ']') {
++count;
}
else if (*temp == tok->str()[0]) {
chrFound = true;
break;
}
++temp;
}
if (count > 1 && tok->str()[0] == ']')
chrFound = true;
if (!chrFound)
return false;
p = temp;
while (*p && *p != ' ')
++p;
}
// Parse "not" options. Token can be anything except the given one
else if (p[0] == '!' && p[1] == '!' && p[2] != '\0') {
p += 2;
if (firstWordEquals(p, tok->str().c_str()))
return false;
while (*p && *p != ' ')
++p;
}
// Parse multi options, such as void|int|char (accept token which is one of these 3)
else {
int res = multiCompare(tok, p, varid);
if (res == 0) {
// Empty alternative matches, use the same token on next round
while (*p && *p != ' ')
++p;
continue;
} else if (res == -1) {
// No match
return false;
}
}
while (*p && *p != ' ')
++p;
tok = tok->next();
}
// The end of the pattern has been reached and nothing wrong has been found
return true;
}
std::size_t Token::getStrLength(const Token *tok)
{
assert(tok != nullptr);
assert(tok->_tokType == eString);
std::size_t len = 0;
std::string::const_iterator it = tok->str().begin() + 1U;
const std::string::const_iterator end = tok->str().end() - 1U;
while (it != end) {
if (*it == '\\') {
++it;
// string ends at '\0'
if (*it == '0')
return len;
}
if (*it == '\0')
return len;
++it;
++len;
}
return len;
}
std::size_t Token::getStrSize(const Token *tok)
{
assert(tok != nullptr && tok->tokType() == eString);
const std::string &str = tok->str();
unsigned int sizeofstring = 1U;
for (unsigned int i = 1U; i < str.size() - 1U; i++) {
if (str[i] == '\\')
++i;
++sizeofstring;
}
return sizeofstring;
}
std::string Token::getCharAt(const Token *tok, std::size_t index)
{
assert(tok != nullptr);
std::string::const_iterator it = tok->str().begin() + 1U;
const std::string::const_iterator end = tok->str().end() - 1U;
while (it != end) {
if (index == 0) {
if (*it == '\0')
return "\\0";
std::string ret(1, *it);
if (*it == '\\') {
++it;
ret += *it;
}
return ret;
}
if (*it == '\\')
++it;
++it;
--index;
}
assert(index == 0);
return "\\0";
}
void Token::move(Token *srcStart, Token *srcEnd, Token *newLocation)
{
/**[newLocation] -> b -> c -> [srcStart] -> [srcEnd] -> f */
// Fix the gap, which tokens to be moved will leave
srcStart->previous()->next(srcEnd->next());
srcEnd->next()->previous(srcStart->previous());
// Fix the tokens to be moved
srcEnd->next(newLocation->next());
srcStart->previous(newLocation);
// Fix the tokens at newLocation
newLocation->next()->previous(srcEnd);
newLocation->next(srcStart);
// Update _progressValue
for (Token *tok = srcStart; tok != srcEnd->next(); tok = tok->next())
tok->_progressValue = newLocation->_progressValue;
}
Token* Token::nextArgument() const
{
for (const Token* tok = this; tok; tok = tok->next()) {
if (tok->str() == ",")
return tok->next();
else if (tok->link() && Token::Match(tok, "(|{|[|<"))
tok = tok->link();
else if (Token::Match(tok, ")|;"))
return nullptr;
}
return nullptr;
}
Token* Token::nextArgumentBeforeCreateLinks2() const
{
for (const Token* tok = this; tok; tok = tok->next()) {
if (tok->str() == ",")
return tok->next();
else if (tok->link() && Token::Match(tok, "(|{|["))
tok = tok->link();
else if (tok->str() == "<") {
const Token* temp = tok->findClosingBracket();
if (temp)
tok = temp;
} else if (Token::Match(tok, ")|;"))
return nullptr;
}
return nullptr;
}
Token* Token::nextTemplateArgument() const
{
for (const Token* tok = this; tok; tok = tok->next()) {
if (tok->str() == ",")
return tok->next();
else if (tok->link() && Token::Match(tok, "(|{|[|<"))
tok = tok->link();
else if (Token::Match(tok, ">|;"))
return nullptr;
}
return nullptr;
}
const Token * Token::findClosingBracket() const
{
const Token *closing = nullptr;
if (_str == "<") {
unsigned int depth = 0;
for (closing = this; closing != nullptr; closing = closing->next()) {
if (Token::Match(closing, "{|[|(")) {
closing = closing->link();
if (!closing)
return nullptr; // #6803
} else if (Token::Match(closing, "}|]|)|;"))
break;
else if (closing->str() == "<")
++depth;
else if (closing->str() == ">") {
if (--depth == 0)
break;
} else if (closing->str() == ">>") {
if (--depth == 0)
break;
if (--depth == 0)
break;
}
}
}
return closing;
}
Token * Token::findClosingBracket()
{
// return value of const function
return const_cast<Token*>(const_cast<const Token*>(this)->findClosingBracket());
}
//---------------------------------------------------------------------------
const Token *Token::findsimplematch(const Token *startTok, const char pattern[])
{
for (const Token* tok = startTok; tok; tok = tok->next()) {
if (Token::simpleMatch(tok, pattern))
return tok;
}
return 0;
}
const Token *Token::findsimplematch(const Token *startTok, const char pattern[], const Token *end)
{
for (const Token* tok = startTok; tok && tok != end; tok = tok->next()) {
if (Token::simpleMatch(tok, pattern))
return tok;
}
return nullptr;
}
const Token *Token::findmatch(const Token *startTok, const char pattern[], unsigned int varId)
{
for (const Token* tok = startTok; tok; tok = tok->next()) {
if (Token::Match(tok, pattern, varId))
return tok;
}
return nullptr;
}
const Token *Token::findmatch(const Token *startTok, const char pattern[], const Token *end, unsigned int varId)
{
for (const Token* tok = startTok; tok && tok != end; tok = tok->next()) {
if (Token::Match(tok, pattern, varId))
return tok;
}
return nullptr;
}
void Token::insertToken(const std::string &tokenStr, const std::string &originalNameStr, bool prepend)
{
//TODO: Find a solution for the first token on the list
if (prepend && !this->previous())
return;
Token *newToken;
if (_str.empty())
newToken = this;
else
newToken = new Token(tokensBack);
newToken->str(tokenStr);
if (!originalNameStr.empty())
newToken->originalName(originalNameStr);
newToken->_linenr = _linenr;
newToken->_fileIndex = _fileIndex;
newToken->_progressValue = _progressValue;
if (newToken != this) {
if (prepend) {
/*if (this->previous())*/ {
newToken->previous(this->previous());
newToken->previous()->next(newToken);
} /*else if (tokensFront?) {
*tokensFront? = newToken;
}*/
this->previous(newToken);
newToken->next(this);
} else {
if (this->next()) {
newToken->next(this->next());
newToken->next()->previous(newToken);
} else if (tokensBack) {
*tokensBack = newToken;
}
this->next(newToken);
newToken->previous(this);
}
}
}
void Token::eraseTokens(Token *begin, const Token *end)
{
if (!begin || begin == end)
return;
while (begin->next() && begin->next() != end) {
begin->deleteNext();
}
}
void Token::createMutualLinks(Token *begin, Token *end)
{
assert(begin != nullptr);
assert(end != nullptr);
assert(begin != end);
begin->link(end);
end->link(begin);
}
void Token::printOut(const char *title) const
{
if (title && title[0])
std::cout << "\n### " << title << " ###\n";
std::cout << stringifyList(true, true, true, true, true, 0, 0) << std::endl;
}
void Token::printOut(const char *title, const std::vector<std::string> &fileNames) const
{
if (title && title[0])
std::cout << "\n### " << title << " ###\n";
std::cout << stringifyList(true, true, true, true, true, &fileNames, 0) << std::endl;
}
void Token::stringify(std::ostream& os, bool varid, bool attributes, bool macro) const
{
if (attributes) {
if (isUnsigned())
os << "unsigned ";
else if (isSigned())
os << "signed ";
if (isComplex())
os << "_Complex ";
if (isLong()) {
if (_tokType == eString || _tokType == eChar)
os << "L";
else
os << "long ";
}
}
if (macro && isExpandedMacro())
os << "$";
if (_str[0] != '\"' || _str.find('\0') == std::string::npos)
os << _str;
else {
for (std::size_t i = 0U; i < _str.size(); ++i) {
if (_str[i] == '\0')
os << "\\0";
else
os << _str[i];
}
}
if (varid && _varId != 0)
os << '@' << _varId;
}
std::string Token::stringifyList(bool varid, bool attributes, bool linenumbers, bool linebreaks, bool files, const std::vector<std::string>* fileNames, const Token* end) const
{
if (this == end)
return "";
std::ostringstream ret;
unsigned int lineNumber = _linenr;
unsigned int fileInd = files ? ~0U : _fileIndex;
std::map<int, unsigned int> lineNumbers;
for (const Token *tok = this; tok != end; tok = tok->next()) {
bool fileChange = false;
if (tok->_fileIndex != fileInd) {
if (fileInd != ~0U) {
lineNumbers[fileInd] = tok->_fileIndex;
}
fileInd = tok->_fileIndex;
if (files) {
ret << "\n\n##file ";
if (fileNames && fileNames->size() > tok->_fileIndex)
ret << fileNames->at(tok->_fileIndex);
else
ret << fileInd;
}
lineNumber = lineNumbers[fileInd];
fileChange = true;
}
if (linebreaks && (lineNumber != tok->linenr() || fileChange)) {
if (lineNumber+4 < tok->linenr() && fileInd == tok->_fileIndex) {
ret << '\n' << lineNumber+1 << ":\n|\n";
ret << tok->linenr()-1 << ":\n";
ret << tok->linenr() << ": ";
} else {
while (lineNumber < tok->linenr()) {
++lineNumber;
ret << '\n';
if (linenumbers) {
ret << lineNumber << ':';
if (lineNumber == tok->linenr())
ret << ' ';
}
}
}
lineNumber = tok->linenr();
}
tok->stringify(ret, varid, attributes, attributes); // print token
if (tok->next() != end && (!linebreaks || (tok->next()->linenr() <= tok->linenr() && tok->next()->fileIndex() == tok->fileIndex())))
ret << ' ';
}
if (linebreaks && files)
ret << '\n';
return ret.str();
}
std::string Token::stringifyList(const Token* end, bool attributes) const
{
return stringifyList(false, attributes, false, false, false, 0, end);
}
std::string Token::stringifyList(bool varid) const
{
return stringifyList(varid, false, true, true, true, 0, 0);
}
void Token::astOperand1(Token *tok)
{
const Token* const root = tok;
if (_astOperand1)
_astOperand1->_astParent = nullptr;
// goto parent operator
if (tok) {
while (tok->_astParent) {
if (tok->_astParent == this || tok->_astParent == root) // #6838/#6726 avoid hang on garbage code
throw InternalError(this, "Internal error. Token::astOperand1() cyclic dependency.");
tok = tok->_astParent;
}
tok->_astParent = this;
}
_astOperand1 = tok;
}
void Token::astOperand2(Token *tok)
{
const Token* const root = tok;
if (_astOperand2)
_astOperand2->_astParent = nullptr;
// goto parent operator
if (tok) {
while (tok->_astParent) {
//std::cout << tok << " -> " << tok->_astParent ;
if (tok->_astParent == this || tok->_astParent == root) // #6838/#6726 avoid hang on garbage code
throw InternalError(this, "Internal error. Token::astOperand2() cyclic dependency.");
tok = tok->_astParent;
}
tok->_astParent = this;
}
_astOperand2 = tok;
}
bool Token::isCalculation() const
{
if (!Token::Match(this, "%cop%|++|--"))
return false;
if (Token::Match(this, "*|&")) {
// dereference or address-of?
if (!this->astOperand2())
return false;
if (this->astOperand2()->str() == "[")
return false;
// type specification?
std::stack<const Token *> operands;
operands.push(this);
while (!operands.empty()) {
const Token *op = operands.top();
operands.pop();
if (op->isNumber() || op->varId() > 0)
return true;
if (op->astOperand1())
operands.push(op->astOperand1());
if (op->astOperand2())
operands.push(op->astOperand2());
else if (Token::Match(op, "*|&"))
return false;
}
// type specification => return false
return false;
}
return true;
}
bool Token::isUnaryPreOp() const
{
if (!astOperand1() || astOperand2())
return false;
if (!Token::Match(this, "++|--"))
return true;
const Token *tokbefore = _previous;
const Token *tokafter = _next;
for (int distance = 1; distance < 10 && tokbefore; distance++) {
if (tokbefore == _astOperand1)
return false;
if (tokafter == _astOperand1)
return true;
tokbefore = tokbefore->_previous;
tokafter = tokafter->_previous;
}
return false; // <- guess
}
std::string Token::expressionString() const
{
const Token * const top = this;
const Token *start = top;
while (start->astOperand1() &&
(start->astOperand2() || !start->isUnaryPreOp() || Token::simpleMatch(start, "( )")))
start = start->astOperand1();
const Token *end = top;
while (end->astOperand1() && (end->astOperand2() || end->isUnaryPreOp())) {
if (Token::Match(end,"(|[") &&
!(Token::Match(end, "( %type%") && !end->astOperand2())) {
end = end->link();
break;
}
end = end->astOperand2() ? end->astOperand2() : end->astOperand1();
}
// move start to lpar in such expression: '(*it).x'
int par = 0;
for (const Token *tok = start; tok && tok != end; tok = tok->next()) {
if (tok->str() == "(")
++par;
else if (tok->str() == ")") {
if (par == 0)
start = tok->link();
else
--par;
}
}
// move end to rpar in such expression: '2>(x+1)'
par = 0;
for (const Token *tok = end; tok && tok != start; tok = tok->previous()) {
if (tok->str() == ")")
++par;
else if (tok->str() == "(") {
if (par == 0)
end = tok->link();
else
--par;
}
}
std::string ret;
for (const Token *tok = start; tok && tok != end; tok = tok->next()) {
ret += tok->str();
if (Token::Match(tok, "%name%|%num% %name%|%num%"))
ret += " ";
}
return ret + end->str();
}
static void astStringXml(const Token *tok, std::size_t indent, std::ostream &out)
{
const std::string strindent(indent, ' ');
out << strindent << "<token str=\"" << tok->str() << '\"';
if (tok->varId() > 0U)
out << " varId=\"" << MathLib::toString(tok->varId()) << '\"';
if (tok->variable())
out << " variable=\"" << tok->variable() << '\"';
if (tok->function())
out << " function=\"" << tok->function() << '\"';
if (!tok->values.empty())
out << " values=\"" << &tok->values << '\"';
if (!tok->astOperand1() && !tok->astOperand2()) {
out << "/>" << std::endl;
}
else {
out << '>' << std::endl;
if (tok->astOperand1())
astStringXml(tok->astOperand1(), indent+2U, out);
if (tok->astOperand2())
astStringXml(tok->astOperand2(), indent+2U, out);
out << strindent << "</token>" << std::endl;
}
}
void Token::printAst(bool verbose, bool xml, std::ostream &out) const
{
std::set<const Token *> printed;
for (const Token *tok = this; tok; tok = tok->next()) {
if (!tok->_astParent && tok->_astOperand1) {
if (printed.empty() && !xml)
out << "\n\n##AST" << std::endl;
else if (printed.find(tok) != printed.end())
continue;
printed.insert(tok);
if (xml) {
out << "<ast scope=\"" << tok->scope() << "\" fileIndex=\"" << tok->fileIndex() << "\" linenr=\"" << tok->linenr() << "\">" << std::endl;
astStringXml(tok, 2U, out);
out << "</ast>" << std::endl;
} else if (verbose)
out << tok->astStringVerbose(0,0) << std::endl;
else
out << tok->astString(" ") << std::endl;
if (tok->str() == "(")
tok = tok->link();
}
}
}
static std::string indent(const unsigned int indent1, const unsigned int indent2)
{
std::string ret(indent1,' ');
for (unsigned int i = indent1; i < indent2; i += 2)
ret += "| ";
return ret;
}
std::string Token::astStringVerbose(const unsigned int indent1, const unsigned int indent2) const
{
std::string ret;
if (isExpandedMacro())
ret += '$';
ret += _str;
if (valuetype)
ret += " \'" + valuetype->str() + '\'';
ret += '\n';
if (_astOperand1) {
unsigned int i1 = indent1, i2 = indent2 + 2;
if (indent1==indent2 && !_astOperand2)
i1 += 2;
ret += indent(indent1,indent2) + (_astOperand2 ? "|-" : "`-") + _astOperand1->astStringVerbose(i1,i2);
}
if (_astOperand2) {
unsigned int i1 = indent1, i2 = indent2 + 2;
if (indent1==indent2)
i1 += 2;
ret += indent(indent1,indent2) + "`-" + _astOperand2->astStringVerbose(i1,i2);
}
return ret;
}
void Token::printValueFlow(bool xml, std::ostream &out) const
{
unsigned int line = 0;
if (xml)
out << " <valueflow>" << std::endl;
else
out << "\n\n##Value flow" << std::endl;
for (const Token *tok = this; tok; tok = tok->next()) {
if (tok->values.empty())
continue;
if (xml)
out << " <values id=\"" << &tok->values << "\">" << std::endl;
else if (line != tok->linenr())
out << "Line " << tok->linenr() << std::endl;
line = tok->linenr();
if (!xml) {
out << " " << tok->str() << (tok->values.front().isKnown() ? " always " : " possible ");
if (tok->values.size() > 1U)
out << '{';
}
for (std::list<ValueFlow::Value>::const_iterator it=tok->values.begin(); it!=tok->values.end(); ++it) {
if (xml) {
out << " <value ";
if (it->tokvalue)
out << "tokvalue=\"" << it->tokvalue << '\"';
else
out << "intvalue=\"" << it->intvalue << '\"';
if (it->condition)
out << " condition-line=\"" << it->condition->linenr() << '\"';
if (it->isKnown())
out << " known=\"true\"";
else if (it->isPossible())
out << " possible=\"true\"";
out << "/>" << std::endl;
}
else {
if (it != tok->values.begin())
out << ",";
if (it->tokvalue)
out << it->tokvalue->str();
else
out << it->intvalue;
}
}
if (xml)
out << " </values>" << std::endl;
else if (tok->values.size() > 1U)
out << '}' << std::endl;
else
out << std::endl;
}
if (xml)
out << " </valueflow>" << std::endl;
}
const ValueFlow::Value * Token::getValueLE(const MathLib::bigint val, const Settings *settings) const
{
const ValueFlow::Value *ret = nullptr;
std::list<ValueFlow::Value>::const_iterator it;
for (it = values.begin(); it != values.end(); ++it) {
if (it->intvalue <= val && !it->tokvalue) {
if (!ret || ret->inconclusive || (ret->condition && !it->inconclusive))
ret = &(*it);
if (!ret->inconclusive && !ret->condition)
break;
}
}
if (settings && ret) {
if (ret->inconclusive && !settings->inconclusive)
return nullptr;
if (ret->condition && !settings->isEnabled("warning"))
return nullptr;
}
return ret;
}
const ValueFlow::Value * Token::getValueGE(const MathLib::bigint val, const Settings *settings) const
{
const ValueFlow::Value *ret = nullptr;
std::list<ValueFlow::Value>::const_iterator it;
for (it = values.begin(); it != values.end(); ++it) {
if (it->intvalue >= val && !it->tokvalue) {
if (!ret || ret->inconclusive || (ret->condition && !it->inconclusive))
ret = &(*it);
if (!ret->inconclusive && !ret->condition)
break;
}
}
if (settings && ret) {
if (ret->inconclusive && !settings->inconclusive)
return nullptr;
if (ret->condition && !settings->isEnabled("warning"))
return nullptr;
}
return ret;
}
const Token *Token::getValueTokenMinStrSize() const
{
const Token *ret = nullptr;
std::size_t minsize = ~0U;
std::list<ValueFlow::Value>::const_iterator it;
for (it = values.begin(); it != values.end(); ++it) {
if (it->tokvalue && it->tokvalue->tokType() == Token::eString) {
std::size_t size = getStrSize(it->tokvalue);
if (!ret || size < minsize) {
minsize = size;
ret = it->tokvalue;
}
}
}
return ret;
}
const Token *Token::getValueTokenMaxStrLength() const
{
const Token *ret = nullptr;
std::size_t maxlength = 0U;
std::list<ValueFlow::Value>::const_iterator it;
for (it = values.begin(); it != values.end(); ++it) {
if (it->tokvalue && it->tokvalue->tokType() == Token::eString) {
std::size_t length = getStrLength(it->tokvalue);
if (!ret || length > maxlength) {
maxlength = length;
ret = it->tokvalue;
}
}
}
return ret;
}
static const Scope *getfunctionscope(const Scope *s)
{
while (s && s->type != Scope::eFunction)
s = s->nestedIn;
return s;
}
const Token *Token::getValueTokenDeadPointer() const
{
const Scope * const functionscope = getfunctionscope(this->scope());
std::list<ValueFlow::Value>::const_iterator it;
for (it = values.begin(); it != values.end(); ++it) {
// Is this a pointer alias?
if (!it->tokvalue || it->tokvalue->str() != "&")
continue;
// Get variable
const Token *vartok = it->tokvalue->astOperand1();
if (!vartok || !vartok->isName() || !vartok->variable())
continue;
const Variable * const var = vartok->variable();
if (var->isStatic() || var->isReference())
continue;
if (!var->scope())
return nullptr; // #6804
if (var->scope()->type == Scope::eUnion && var->scope()->nestedIn == this->scope())
continue;
// variable must be in same function (not in subfunction)
if (functionscope != getfunctionscope(var->scope()))
continue;
// Is variable defined in this scope or upper scope?
const Scope *s = this->scope();
while ((s != nullptr) && (s != var->scope()))
s = s->nestedIn;
if (!s)
return it->tokvalue;
}
return nullptr;
}
void Token::assignProgressValues(Token *tok)
{
unsigned int total_count = 0;
for (Token *tok2 = tok; tok2; tok2 = tok2->next())
++total_count;
unsigned int count = 0;
for (Token *tok2 = tok; tok2; tok2 = tok2->next())
tok2->_progressValue = count++ * 100 / total_count;
}
void Token::setValueType(ValueType *vt)
{
if (vt != valuetype) {
delete valuetype;
valuetype = vt;
}
}
|
tdmaav/cppcheck
|
lib/token.cpp
|
C++
|
gpl-3.0
| 42,904 |
-- 15
-- NNCA
-- Added NOT NULL to column term in table terms
CREATE TABLE "artists" (
"artist_id" TEXT PRIMARY KEY
)
CREATE TABLE "mbtags" (
"mbtag" TEXT PRIMARY KEY
)
CREATE TABLE "terms" (
"term" TEXT PRIMARY KEY NOT NULL
)
CREATE TABLE "artist_mbtag" (
"artist_id" TEXT REFERENCES "artists" ("artist_id"),
"mbtag" TEXT REFERENCES "mbtags" ("mbtag")
)
CREATE TABLE "artist_term" (
"artist_id" TEXT REFERENCES "artists" ("artist_id"),
"term" TEXT REFERENCES "terms" ("term")
)
|
schemaanalyst-team/schemaanalyst
|
src/paper/ineffectivemutants/manualevaluation/mutants/ArtistTerm_Postgres/15.sql
|
SQL
|
gpl-3.0
| 496 |
/*!
* Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.2.0');
src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.2.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff?v=4.2.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.2.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.2.0#fontawesomeregular') format('svg');
font-weight: normal;
font-style: normal;
}
.fa {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.fa-lg {
font-size: 1.33333333em;
line-height: .75em;
vertical-align: -15%;
}
.fa-2x {
font-size: 2em;
}
.fa-3x {
font-size: 3em;
}
.fa-4x {
font-size: 4em;
}
.fa-5x {
font-size: 5em;
}
.fa-fw {
width: 1.28571429em;
text-align: center;
}
.fa-ul {
padding-left: 0;
margin-left: 2.14285714em;
list-style-type: none;
}
.fa-ul > li {
position: relative;
}
.fa-li {
position: absolute;
left: -2.14285714em;
width: 2.14285714em;
top: .14285714em;
text-align: center;
}
.fa-li.fa-lg {
left: -1.85714286em;
}
.fa-border {
padding: .2em .25em .15em;
border: solid .08em #eee;
border-radius: .1em;
}
.pull-right {
float: right;
}
.pull-left {
float: left;
}
.fa.pull-left {
margin-right: .3em;
}
.fa.pull-right {
margin-left: .3em;
}
.fa-spin {
-webkit-animation: fa-spin 2s infinite linear;
animation: fa-spin 2s infinite linear;
}
@-webkit-keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
@keyframes fa-spin {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(359deg);
transform: rotate(359deg);
}
}
.fa-rotate-90 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.fa-rotate-180 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
-webkit-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.fa-rotate-270 {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
-webkit-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
}
.fa-flip-horizontal {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
-webkit-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
transform: scale(-1, 1);
}
.fa-flip-vertical {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);
-webkit-transform: scale(1, -1);
-ms-transform: scale(1, -1);
transform: scale(1, -1);
}
:root .fa-rotate-90, :root .fa-rotate-180, :root .fa-rotate-270, :root .fa-flip-horizontal, :root .fa-flip-vertical {
filter: none;
}
.fa-stack {
position: relative;
display: inline-block;
width: 2em;
height: 2em;
line-height: 2em;
vertical-align: middle;
}
.fa-stack-1x, .fa-stack-2x {
position: absolute;
left: 0;
width: 100%;
text-align: center;
}
.fa-stack-1x {
line-height: inherit;
}
.fa-stack-2x {
font-size: 2em;
}
.fa-inverse {
color: #fff;
}
.fa-glass:before {
content: "\f000";
}
.fa-music:before {
content: "\f001";
}
.fa-search:before {
content: "\f002";
}
.fa-envelope-o:before {
content: "\f003";
}
.fa-heart:before {
content: "\f004";
}
.fa-star:before {
content: "\f005";
}
.fa-star-o:before {
content: "\f006";
}
.fa-user:before {
content: "\f007";
}
.fa-film:before {
content: "\f008";
}
.fa-th-large:before {
content: "\f009";
}
.fa-th:before {
content: "\f00a";
}
.fa-th-list:before {
content: "\f00b";
}
.fa-check:before {
content: "\f00c";
}
.fa-remove:before, .fa-close:before, .fa-times:before {
content: "\f00d";
}
.fa-search-plus:before {
content: "\f00e";
}
.fa-search-minus:before {
content: "\f010";
}
.fa-power-off:before {
content: "\f011";
}
.fa-signal:before {
content: "\f012";
}
.fa-gear:before, .fa-cog:before {
content: "\f013";
}
.fa-trash-o:before {
content: "\f014";
}
.fa-home:before {
content: "\f015";
}
.fa-file-o:before {
content: "\f016";
}
.fa-clock-o:before {
content: "\f017";
}
.fa-road:before {
content: "\f018";
}
.fa-download:before {
content: "\f019";
}
.fa-arrow-circle-o-down:before {
content: "\f01a";
}
.fa-arrow-circle-o-up:before {
content: "\f01b";
}
.fa-inbox:before {
content: "\f01c";
}
.fa-play-circle-o:before {
content: "\f01d";
}
.fa-rotate-right:before, .fa-repeat:before {
content: "\f01e";
}
.fa-refresh:before {
content: "\f021";
}
.fa-list-alt:before {
content: "\f022";
}
.fa-lock:before {
content: "\f023";
}
.fa-flag:before {
content: "\f024";
}
.fa-headphones:before {
content: "\f025";
}
.fa-volume-off:before {
content: "\f026";
}
.fa-volume-down:before {
content: "\f027";
}
.fa-volume-up:before {
content: "\f028";
}
.fa-qrcode:before {
content: "\f029";
}
.fa-barcode:before {
content: "\f02a";
}
.fa-tag:before {
content: "\f02b";
}
.fa-tags:before {
content: "\f02c";
}
.fa-book:before {
content: "\f02d";
}
.fa-bookmark:before {
content: "\f02e";
}
.fa-print:before {
content: "\f02f";
}
.fa-camera:before {
content: "\f030";
}
.fa-font:before {
content: "\f031";
}
.fa-bold:before {
content: "\f032";
}
.fa-italic:before {
content: "\f033";
}
.fa-text-height:before {
content: "\f034";
}
.fa-text-width:before {
content: "\f035";
}
.fa-align-left:before {
content: "\f036";
}
.fa-align-center:before {
content: "\f037";
}
.fa-align-right:before {
content: "\f038";
}
.fa-align-justify:before {
content: "\f039";
}
.fa-list:before {
content: "\f03a";
}
.fa-dedent:before, .fa-outdent:before {
content: "\f03b";
}
.fa-indent:before {
content: "\f03c";
}
.fa-video-camera:before {
content: "\f03d";
}
.fa-photo:before, .fa-image:before, .fa-picture-o:before {
content: "\f03e";
}
.fa-pencil:before {
content: "\f040";
}
.fa-map-marker:before {
content: "\f041";
}
.fa-adjust:before {
content: "\f042";
}
.fa-tint:before {
content: "\f043";
}
.fa-edit:before, .fa-pencil-square-o:before {
content: "\f044";
}
.fa-share-square-o:before {
content: "\f045";
}
.fa-check-square-o:before {
content: "\f046";
}
.fa-arrows:before {
content: "\f047";
}
.fa-step-backward:before {
content: "\f048";
}
.fa-fast-backward:before {
content: "\f049";
}
.fa-backward:before {
content: "\f04a";
}
.fa-play:before {
content: "\f04b";
}
.fa-pause:before {
content: "\f04c";
}
.fa-stop:before {
content: "\f04d";
}
.fa-forward:before {
content: "\f04e";
}
.fa-fast-forward:before {
content: "\f050";
}
.fa-step-forward:before {
content: "\f051";
}
.fa-eject:before {
content: "\f052";
}
.fa-chevron-left:before {
content: "\f053";
}
.fa-chevron-right:before {
content: "\f054";
}
.fa-plus-circle:before {
content: "\f055";
}
.fa-minus-circle:before {
content: "\f056";
}
.fa-times-circle:before {
content: "\f057";
}
.fa-check-circle:before {
content: "\f058";
}
.fa-question-circle:before {
content: "\f059";
}
.fa-info-circle:before {
content: "\f05a";
}
.fa-crosshairs:before {
content: "\f05b";
}
.fa-times-circle-o:before {
content: "\f05c";
}
.fa-check-circle-o:before {
content: "\f05d";
}
.fa-ban:before {
content: "\f05e";
}
.fa-arrow-left:before {
content: "\f060";
}
.fa-arrow-right:before {
content: "\f061";
}
.fa-arrow-up:before {
content: "\f062";
}
.fa-arrow-down:before {
content: "\f063";
}
.fa-mail-forward:before, .fa-share:before {
content: "\f064";
}
.fa-expand:before {
content: "\f065";
}
.fa-compress:before {
content: "\f066";
}
.fa-plus:before {
content: "\f067";
}
.fa-minus:before {
content: "\f068";
}
.fa-asterisk:before {
content: "\f069";
}
.fa-exclamation-circle:before {
content: "\f06a";
}
.fa-gift:before {
content: "\f06b";
}
.fa-leaf:before {
content: "\f06c";
}
.fa-fire:before {
content: "\f06d";
}
.fa-eye:before {
content: "\f06e";
}
.fa-eye-slash:before {
content: "\f070";
}
.fa-warning:before, .fa-exclamation-triangle:before {
content: "\f071";
}
.fa-plane:before {
content: "\f072";
}
.fa-calendar:before {
content: "\f073";
}
.fa-random:before {
content: "\f074";
}
.fa-comment:before {
content: "\f075";
}
.fa-magnet:before {
content: "\f076";
}
.fa-chevron-up:before {
content: "\f077";
}
.fa-chevron-down:before {
content: "\f078";
}
.fa-retweet:before {
content: "\f079";
}
.fa-shopping-cart:before {
content: "\f07a";
}
.fa-folder:before {
content: "\f07b";
}
.fa-folder-open:before {
content: "\f07c";
}
.fa-arrows-v:before {
content: "\f07d";
}
.fa-arrows-h:before {
content: "\f07e";
}
.fa-bar-chart-o:before, .fa-bar-chart:before {
content: "\f080";
}
.fa-twitter-square:before {
content: "\f081";
}
.fa-facebook-square:before {
content: "\f082";
}
.fa-camera-retro:before {
content: "\f083";
}
.fa-key:before {
content: "\f084";
}
.fa-gears:before, .fa-cogs:before {
content: "\f085";
}
.fa-comments:before {
content: "\f086";
}
.fa-thumbs-o-up:before {
content: "\f087";
}
.fa-thumbs-o-down:before {
content: "\f088";
}
.fa-star-half:before {
content: "\f089";
}
.fa-heart-o:before {
content: "\f08a";
}
.fa-sign-out:before {
content: "\f08b";
}
.fa-linkedin-square:before {
content: "\f08c";
}
.fa-thumb-tack:before {
content: "\f08d";
}
.fa-external-link:before {
content: "\f08e";
}
.fa-sign-in:before {
content: "\f090";
}
.fa-trophy:before {
content: "\f091";
}
.fa-github-square:before {
content: "\f092";
}
.fa-upload:before {
content: "\f093";
}
.fa-lemon-o:before {
content: "\f094";
}
.fa-phone:before {
content: "\f095";
}
.fa-square-o:before {
content: "\f096";
}
.fa-bookmark-o:before {
content: "\f097";
}
.fa-phone-square:before {
content: "\f098";
}
.fa-twitter:before {
content: "\f099";
}
.fa-facebook:before {
content: "\f09a";
}
.fa-github:before {
content: "\f09b";
}
.fa-unlock:before {
content: "\f09c";
}
.fa-credit-card:before {
content: "\f09d";
}
.fa-rss:before {
content: "\f09e";
}
.fa-hdd-o:before {
content: "\f0a0";
}
.fa-bullhorn:before {
content: "\f0a1";
}
.fa-bell:before {
content: "\f0f3";
}
.fa-certificate:before {
content: "\f0a3";
}
.fa-hand-o-right:before {
content: "\f0a4";
}
.fa-hand-o-left:before {
content: "\f0a5";
}
.fa-hand-o-up:before {
content: "\f0a6";
}
.fa-hand-o-down:before {
content: "\f0a7";
}
.fa-arrow-circle-left:before {
content: "\f0a8";
}
.fa-arrow-circle-right:before {
content: "\f0a9";
}
.fa-arrow-circle-up:before {
content: "\f0aa";
}
.fa-arrow-circle-down:before {
content: "\f0ab";
}
.fa-globe:before {
content: "\f0ac";
}
.fa-wrench:before {
content: "\f0ad";
}
.fa-tasks:before {
content: "\f0ae";
}
.fa-filter:before {
content: "\f0b0";
}
.fa-briefcase:before {
content: "\f0b1";
}
.fa-arrows-alt:before {
content: "\f0b2";
}
.fa-group:before, .fa-users:before {
content: "\f0c0";
}
.fa-chain:before, .fa-link:before {
content: "\f0c1";
}
.fa-cloud:before {
content: "\f0c2";
}
.fa-flask:before {
content: "\f0c3";
}
.fa-cut:before, .fa-scissors:before {
content: "\f0c4";
}
.fa-copy:before, .fa-files-o:before {
content: "\f0c5";
}
.fa-paperclip:before {
content: "\f0c6";
}
.fa-save:before, .fa-floppy-o:before {
content: "\f0c7";
}
.fa-square:before {
content: "\f0c8";
}
.fa-navicon:before, .fa-reorder:before, .fa-bars:before {
content: "\f0c9";
}
.fa-list-ul:before {
content: "\f0ca";
}
.fa-list-ol:before {
content: "\f0cb";
}
.fa-strikethrough:before {
content: "\f0cc";
}
.fa-underline:before {
content: "\f0cd";
}
.fa-table:before {
content: "\f0ce";
}
.fa-magic:before {
content: "\f0d0";
}
.fa-truck:before {
content: "\f0d1";
}
.fa-pinterest:before {
content: "\f0d2";
}
.fa-pinterest-square:before {
content: "\f0d3";
}
.fa-google-plus-square:before {
content: "\f0d4";
}
.fa-google-plus:before {
content: "\f0d5";
}
.fa-money:before {
content: "\f0d6";
}
.fa-caret-down:before {
content: "\f0d7";
}
.fa-caret-up:before {
content: "\f0d8";
}
.fa-caret-left:before {
content: "\f0d9";
}
.fa-caret-right:before {
content: "\f0da";
}
.fa-columns:before {
content: "\f0db";
}
.fa-unsorted:before, .fa-sort:before {
content: "\f0dc";
}
.fa-sort-down:before, .fa-sort-desc:before {
content: "\f0dd";
}
.fa-sort-up:before, .fa-sort-asc:before {
content: "\f0de";
}
.fa-envelope:before {
content: "\f0e0";
}
.fa-linkedin:before {
content: "\f0e1";
}
.fa-rotate-left:before, .fa-undo:before {
content: "\f0e2";
}
.fa-legal:before, .fa-gavel:before {
content: "\f0e3";
}
.fa-dashboard:before, .fa-tachometer:before {
content: "\f0e4";
}
.fa-comment-o:before {
content: "\f0e5";
}
.fa-comments-o:before {
content: "\f0e6";
}
.fa-flash:before, .fa-bolt:before {
content: "\f0e7";
}
.fa-sitemap:before {
content: "\f0e8";
}
.fa-umbrella:before {
content: "\f0e9";
}
.fa-paste:before, .fa-clipboard:before {
content: "\f0ea";
}
.fa-lightbulb-o:before {
content: "\f0eb";
}
.fa-exchange:before {
content: "\f0ec";
}
.fa-cloud-download:before {
content: "\f0ed";
}
.fa-cloud-upload:before {
content: "\f0ee";
}
.fa-user-md:before {
content: "\f0f0";
}
.fa-stethoscope:before {
content: "\f0f1";
}
.fa-suitcase:before {
content: "\f0f2";
}
.fa-bell-o:before {
content: "\f0a2";
}
.fa-coffee:before {
content: "\f0f4";
}
.fa-cutlery:before {
content: "\f0f5";
}
.fa-file-text-o:before {
content: "\f0f6";
}
.fa-building-o:before {
content: "\f0f7";
}
.fa-hospital-o:before {
content: "\f0f8";
}
.fa-ambulance:before {
content: "\f0f9";
}
.fa-medkit:before {
content: "\f0fa";
}
.fa-fighter-jet:before {
content: "\f0fb";
}
.fa-beer:before {
content: "\f0fc";
}
.fa-h-square:before {
content: "\f0fd";
}
.fa-plus-square:before {
content: "\f0fe";
}
.fa-angle-double-left:before {
content: "\f100";
}
.fa-angle-double-right:before {
content: "\f101";
}
.fa-angle-double-up:before {
content: "\f102";
}
.fa-angle-double-down:before {
content: "\f103";
}
.fa-angle-left:before {
content: "\f104";
}
.fa-angle-right:before {
content: "\f105";
}
.fa-angle-up:before {
content: "\f106";
}
.fa-angle-down:before {
content: "\f107";
}
.fa-desktop:before {
content: "\f108";
}
.fa-laptop:before {
content: "\f109";
}
.fa-tablet:before {
content: "\f10a";
}
.fa-mobile-phone:before, .fa-mobile:before {
content: "\f10b";
}
.fa-circle-o:before {
content: "\f10c";
}
.fa-quote-left:before {
content: "\f10d";
}
.fa-quote-right:before {
content: "\f10e";
}
.fa-spinner:before {
content: "\f110";
}
.fa-circle:before {
content: "\f111";
}
.fa-mail-reply:before, .fa-reply:before {
content: "\f112";
}
.fa-github-alt:before {
content: "\f113";
}
.fa-folder-o:before {
content: "\f114";
}
.fa-folder-open-o:before {
content: "\f115";
}
.fa-smile-o:before {
content: "\f118";
}
.fa-frown-o:before {
content: "\f119";
}
.fa-meh-o:before {
content: "\f11a";
}
.fa-gamepad:before {
content: "\f11b";
}
.fa-keyboard-o:before {
content: "\f11c";
}
.fa-flag-o:before {
content: "\f11d";
}
.fa-flag-checkered:before {
content: "\f11e";
}
.fa-terminal:before {
content: "\f120";
}
.fa-code:before {
content: "\f121";
}
.fa-mail-reply-all:before, .fa-reply-all:before {
content: "\f122";
}
.fa-star-half-empty:before, .fa-star-half-full:before, .fa-star-half-o:before {
content: "\f123";
}
.fa-location-arrow:before {
content: "\f124";
}
.fa-crop:before {
content: "\f125";
}
.fa-code-fork:before {
content: "\f126";
}
.fa-unlink:before, .fa-chain-broken:before {
content: "\f127";
}
.fa-question:before {
content: "\f128";
}
.fa-info:before {
content: "\f129";
}
.fa-exclamation:before {
content: "\f12a";
}
.fa-superscript:before {
content: "\f12b";
}
.fa-subscript:before {
content: "\f12c";
}
.fa-eraser:before {
content: "\f12d";
}
.fa-puzzle-piece:before {
content: "\f12e";
}
.fa-microphone:before {
content: "\f130";
}
.fa-microphone-slash:before {
content: "\f131";
}
.fa-shield:before {
content: "\f132";
}
.fa-calendar-o:before {
content: "\f133";
}
.fa-fire-extinguisher:before {
content: "\f134";
}
.fa-rocket:before {
content: "\f135";
}
.fa-maxcdn:before {
content: "\f136";
}
.fa-chevron-circle-left:before {
content: "\f137";
}
.fa-chevron-circle-right:before {
content: "\f138";
}
.fa-chevron-circle-up:before {
content: "\f139";
}
.fa-chevron-circle-down:before {
content: "\f13a";
}
.fa-html5:before {
content: "\f13b";
}
.fa-css3:before {
content: "\f13c";
}
.fa-anchor:before {
content: "\f13d";
}
.fa-unlock-alt:before {
content: "\f13e";
}
.fa-bullseye:before {
content: "\f140";
}
.fa-ellipsis-h:before {
content: "\f141";
}
.fa-ellipsis-v:before {
content: "\f142";
}
.fa-rss-square:before {
content: "\f143";
}
.fa-play-circle:before {
content: "\f144";
}
.fa-ticket:before {
content: "\f145";
}
.fa-minus-square:before {
content: "\f146";
}
.fa-minus-square-o:before {
content: "\f147";
}
.fa-level-up:before {
content: "\f148";
}
.fa-level-down:before {
content: "\f149";
}
.fa-check-square:before {
content: "\f14a";
}
.fa-pencil-square:before {
content: "\f14b";
}
.fa-external-link-square:before {
content: "\f14c";
}
.fa-share-square:before {
content: "\f14d";
}
.fa-compass:before {
content: "\f14e";
}
.fa-toggle-down:before, .fa-caret-square-o-down:before {
content: "\f150";
}
.fa-toggle-up:before, .fa-caret-square-o-up:before {
content: "\f151";
}
.fa-toggle-right:before, .fa-caret-square-o-right:before {
content: "\f152";
}
.fa-euro:before, .fa-eur:before {
content: "\f153";
}
.fa-gbp:before {
content: "\f154";
}
.fa-dollar:before, .fa-usd:before {
content: "\f155";
}
.fa-rupee:before, .fa-inr:before {
content: "\f156";
}
.fa-cny:before, .fa-rmb:before, .fa-yen:before, .fa-jpy:before {
content: "\f157";
}
.fa-ruble:before, .fa-rouble:before, .fa-rub:before {
content: "\f158";
}
.fa-won:before, .fa-krw:before {
content: "\f159";
}
.fa-bitcoin:before, .fa-btc:before {
content: "\f15a";
}
.fa-file:before {
content: "\f15b";
}
.fa-file-text:before {
content: "\f15c";
}
.fa-sort-alpha-asc:before {
content: "\f15d";
}
.fa-sort-alpha-desc:before {
content: "\f15e";
}
.fa-sort-amount-asc:before {
content: "\f160";
}
.fa-sort-amount-desc:before {
content: "\f161";
}
.fa-sort-numeric-asc:before {
content: "\f162";
}
.fa-sort-numeric-desc:before {
content: "\f163";
}
.fa-thumbs-up:before {
content: "\f164";
}
.fa-thumbs-down:before {
content: "\f165";
}
.fa-youtube-square:before {
content: "\f166";
}
.fa-youtube:before {
content: "\f167";
}
.fa-xing:before {
content: "\f168";
}
.fa-xing-square:before {
content: "\f169";
}
.fa-youtube-play:before {
content: "\f16a";
}
.fa-dropbox:before {
content: "\f16b";
}
.fa-stack-overflow:before {
content: "\f16c";
}
.fa-instagram:before {
content: "\f16d";
}
.fa-flickr:before {
content: "\f16e";
}
.fa-adn:before {
content: "\f170";
}
.fa-bitbucket:before {
content: "\f171";
}
.fa-bitbucket-square:before {
content: "\f172";
}
.fa-tumblr:before {
content: "\f173";
}
.fa-tumblr-square:before {
content: "\f174";
}
.fa-long-arrow-down:before {
content: "\f175";
}
.fa-long-arrow-up:before {
content: "\f176";
}
.fa-long-arrow-left:before {
content: "\f177";
}
.fa-long-arrow-right:before {
content: "\f178";
}
.fa-apple:before {
content: "\f179";
}
.fa-windows:before {
content: "\f17a";
}
.fa-android:before {
content: "\f17b";
}
.fa-linux:before {
content: "\f17c";
}
.fa-dribbble:before {
content: "\f17d";
}
.fa-skype:before {
content: "\f17e";
}
.fa-foursquare:before {
content: "\f180";
}
.fa-trello:before {
content: "\f181";
}
.fa-female:before {
content: "\f182";
}
.fa-male:before {
content: "\f183";
}
.fa-gittip:before {
content: "\f184";
}
.fa-sun-o:before {
content: "\f185";
}
.fa-moon-o:before {
content: "\f186";
}
.fa-archive:before {
content: "\f187";
}
.fa-bug:before {
content: "\f188";
}
.fa-vk:before {
content: "\f189";
}
.fa-weibo:before {
content: "\f18a";
}
.fa-renren:before {
content: "\f18b";
}
.fa-pagelines:before {
content: "\f18c";
}
.fa-stack-exchange:before {
content: "\f18d";
}
.fa-arrow-circle-o-right:before {
content: "\f18e";
}
.fa-arrow-circle-o-left:before {
content: "\f190";
}
.fa-toggle-left:before, .fa-caret-square-o-left:before {
content: "\f191";
}
.fa-dot-circle-o:before {
content: "\f192";
}
.fa-wheelchair:before {
content: "\f193";
}
.fa-vimeo-square:before {
content: "\f194";
}
.fa-turkish-lira:before, .fa-try:before {
content: "\f195";
}
.fa-plus-square-o:before {
content: "\f196";
}
.fa-space-shuttle:before {
content: "\f197";
}
.fa-slack:before {
content: "\f198";
}
.fa-envelope-square:before {
content: "\f199";
}
.fa-wordpress:before {
content: "\f19a";
}
.fa-openid:before {
content: "\f19b";
}
.fa-institution:before, .fa-bank:before, .fa-university:before {
content: "\f19c";
}
.fa-mortar-board:before, .fa-graduation-cap:before {
content: "\f19d";
}
.fa-yahoo:before {
content: "\f19e";
}
.fa-google:before {
content: "\f1a0";
}
.fa-reddit:before {
content: "\f1a1";
}
.fa-reddit-square:before {
content: "\f1a2";
}
.fa-stumbleupon-circle:before {
content: "\f1a3";
}
.fa-stumbleupon:before {
content: "\f1a4";
}
.fa-delicious:before {
content: "\f1a5";
}
.fa-digg:before {
content: "\f1a6";
}
.fa-pied-piper:before {
content: "\f1a7";
}
.fa-pied-piper-alt:before {
content: "\f1a8";
}
.fa-drupal:before {
content: "\f1a9";
}
.fa-joomla:before {
content: "\f1aa";
}
.fa-language:before {
content: "\f1ab";
}
.fa-fax:before {
content: "\f1ac";
}
.fa-building:before {
content: "\f1ad";
}
.fa-child:before {
content: "\f1ae";
}
.fa-paw:before {
content: "\f1b0";
}
.fa-spoon:before {
content: "\f1b1";
}
.fa-cube:before {
content: "\f1b2";
}
.fa-cubes:before {
content: "\f1b3";
}
.fa-behance:before {
content: "\f1b4";
}
.fa-behance-square:before {
content: "\f1b5";
}
.fa-steam:before {
content: "\f1b6";
}
.fa-steam-square:before {
content: "\f1b7";
}
.fa-recycle:before {
content: "\f1b8";
}
.fa-automobile:before, .fa-car:before {
content: "\f1b9";
}
.fa-cab:before, .fa-taxi:before {
content: "\f1ba";
}
.fa-tree:before {
content: "\f1bb";
}
.fa-spotify:before {
content: "\f1bc";
}
.fa-deviantart:before {
content: "\f1bd";
}
.fa-soundcloud:before {
content: "\f1be";
}
.fa-database:before {
content: "\f1c0";
}
.fa-file-pdf-o:before {
content: "\f1c1";
}
.fa-file-word-o:before {
content: "\f1c2";
}
.fa-file-excel-o:before {
content: "\f1c3";
}
.fa-file-powerpoint-o:before {
content: "\f1c4";
}
.fa-file-photo-o:before, .fa-file-picture-o:before, .fa-file-image-o:before {
content: "\f1c5";
}
.fa-file-zip-o:before, .fa-file-archive-o:before {
content: "\f1c6";
}
.fa-file-sound-o:before, .fa-file-audio-o:before {
content: "\f1c7";
}
.fa-file-movie-o:before, .fa-file-video-o:before {
content: "\f1c8";
}
.fa-file-code-o:before {
content: "\f1c9";
}
.fa-vine:before {
content: "\f1ca";
}
.fa-codepen:before {
content: "\f1cb";
}
.fa-jsfiddle:before {
content: "\f1cc";
}
.fa-life-bouy:before, .fa-life-buoy:before, .fa-life-saver:before, .fa-support:before, .fa-life-ring:before {
content: "\f1cd";
}
.fa-circle-o-notch:before {
content: "\f1ce";
}
.fa-ra:before, .fa-rebel:before {
content: "\f1d0";
}
.fa-ge:before, .fa-empire:before {
content: "\f1d1";
}
.fa-git-square:before {
content: "\f1d2";
}
.fa-git:before {
content: "\f1d3";
}
.fa-hacker-news:before {
content: "\f1d4";
}
.fa-tencent-weibo:before {
content: "\f1d5";
}
.fa-qq:before {
content: "\f1d6";
}
.fa-wechat:before, .fa-weixin:before {
content: "\f1d7";
}
.fa-send:before, .fa-paper-plane:before {
content: "\f1d8";
}
.fa-send-o:before, .fa-paper-plane-o:before {
content: "\f1d9";
}
.fa-history:before {
content: "\f1da";
}
.fa-circle-thin:before {
content: "\f1db";
}
.fa-header:before {
content: "\f1dc";
}
.fa-paragraph:before {
content: "\f1dd";
}
.fa-sliders:before {
content: "\f1de";
}
.fa-share-alt:before {
content: "\f1e0";
}
.fa-share-alt-square:before {
content: "\f1e1";
}
.fa-bomb:before {
content: "\f1e2";
}
.fa-soccer-ball-o:before, .fa-futbol-o:before {
content: "\f1e3";
}
.fa-tty:before {
content: "\f1e4";
}
.fa-binoculars:before {
content: "\f1e5";
}
.fa-plug:before {
content: "\f1e6";
}
.fa-slideshare:before {
content: "\f1e7";
}
.fa-twitch:before {
content: "\f1e8";
}
.fa-yelp:before {
content: "\f1e9";
}
.fa-newspaper-o:before {
content: "\f1ea";
}
.fa-wifi:before {
content: "\f1eb";
}
.fa-calculator:before {
content: "\f1ec";
}
.fa-paypal:before {
content: "\f1ed";
}
.fa-google-wallet:before {
content: "\f1ee";
}
.fa-cc-visa:before {
content: "\f1f0";
}
.fa-cc-mastercard:before {
content: "\f1f1";
}
.fa-cc-discover:before {
content: "\f1f2";
}
.fa-cc-amex:before {
content: "\f1f3";
}
.fa-cc-paypal:before {
content: "\f1f4";
}
.fa-cc-stripe:before {
content: "\f1f5";
}
.fa-bell-slash:before {
content: "\f1f6";
}
.fa-bell-slash-o:before {
content: "\f1f7";
}
.fa-trash:before {
content: "\f1f8";
}
.fa-copyright:before {
content: "\f1f9";
}
.fa-at:before {
content: "\f1fa";
}
.fa-eyedropper:before {
content: "\f1fb";
}
.fa-paint-brush:before {
content: "\f1fc";
}
.fa-birthday-cake:before {
content: "\f1fd";
}
.fa-area-chart:before {
content: "\f1fe";
}
.fa-pie-chart:before {
content: "\f200";
}
.fa-line-chart:before {
content: "\f201";
}
.fa-lastfm:before {
content: "\f202";
}
.fa-lastfm-square:before {
content: "\f203";
}
.fa-toggle-off:before {
content: "\f204";
}
.fa-toggle-on:before {
content: "\f205";
}
.fa-bicycle:before {
content: "\f206";
}
.fa-bus:before {
content: "\f207";
}
.fa-ioxhost:before {
content: "\f208";
}
.fa-angellist:before {
content: "\f209";
}
.fa-cc:before {
content: "\f20a";
}
.fa-shekel:before, .fa-sheqel:before, .fa-ils:before {
content: "\f20b";
}
.fa-meanpath:before {
content: "\f20c";
}
|
WSU-HELPLAB/OSBLE
|
OSBLE.Web/Content/font-awesome.min.css
|
CSS
|
gpl-3.0
| 30,183 |
/*
Yaaic - Yet Another Android IRC Client
Copyright 2009-2013 Sebastian Kaspari
This file is part of Yaaic.
Yaaic 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 3 of the License, or
(at your option) any later version.
Yaaic 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 Yaaic. If not, see <http://www.gnu.org/licenses/>.
*/
package indrora.atomic.model;
/**
* Helper class for constants used for bundle params (extras)
*
* @author Sebastian Kaspari <[email protected]>
*/
public class Extra {
public static final String SERVER = "server";
public static final String CONVERSATION = "conversation";
public static final String USERS = "users";
public static final String ALIASES = "aliases";
public static final String CHANNELS = "channels";
public static final String COMMANDS = "commands";
public static final String MESSAGE = "message";
public static final String USER = "user";
public static final String ACTION = "action";
public static final String NICKSERV_PASSWORD = "nickserv_password";
public static final String SASL_USER = "sasl_user";
public static final String SASL_PASSWORD = "sasl_password";
}
|
14mRh4X0r/Atomic
|
application/src/main/java/indrora/atomic/model/Extra.java
|
Java
|
gpl-3.0
| 1,522 |
module CryptBufferConcern
module PrettyPrint
def pp
puts pretty_hexstring
end
def pretty_hexstring
str = h.scan(/.{2}/).to_a.join(" ")
"0x#{h.upcase} (#{str.upcase})"
end
end
end
|
certainty/crypto-toolbox
|
lib/crypto-toolbox/crypt_buffer/concerns/pretty_print.rb
|
Ruby
|
gpl-3.0
| 222 |
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* 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 3 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, see http://gnu.org/licenses
*/
#include "common/system/system.h"
#include "common/config.h"
#include "common/make_unique.h"
#if defined(PLATFORM_WINDOWS)
#include "common/system/system_windows.h"
#elif defined(PLATFORM_LINUX)
#include "common/system/system_linux.h"
#elif defined(PLATFORM_MACOSX)
#include "common/system/system_macosx.h"
#else
#include "common/system/system_other.h"
#endif
#include <cassert>
#include <iostream>
#include <algorithm>
std::unique_ptr<CSystemUtils> CSystemUtils::Create()
{
std::unique_ptr<CSystemUtils> instance;
#if defined(PLATFORM_WINDOWS)
instance = MakeUnique<CSystemUtilsWindows>();
#elif defined(PLATFORM_LINUX)
instance = MakeUnique<CSystemUtilsLinux>();
#elif defined(PLATFORM_MACOSX)
instance = MakeUnique<CSystemUtilsMacOSX>();
#else
instance = MakeUnique<CSystemUtilsOther>();
#endif
return instance;
}
CSystemUtils::~CSystemUtils()
{}
SystemDialogResult CSystemUtils::ConsoleSystemDialog(SystemDialogType type, const std::string& title, const std::string& message)
{
switch (type)
{
case SDT_INFO:
std::cout << "INFO: ";
break;
case SDT_WARNING:
std::cout << "WARNING:";
break;
case SDT_ERROR:
std::cout << "ERROR: ";
break;
case SDT_YES_NO:
case SDT_OK_CANCEL:
std::cout << "QUESTION: ";
break;
}
std::cout << message << std::endl;
std::string line;
SystemDialogResult result = SDR_OK;
bool done = false;
while (!done)
{
switch (type)
{
case SDT_INFO:
case SDT_WARNING:
case SDT_ERROR:
std::cout << "Press ENTER to continue";
break;
case SDT_YES_NO:
std::cout << "Type 'Y' for Yes or 'N' for No";
break;
case SDT_OK_CANCEL:
std::cout << "Type 'O' for OK or 'C' for Cancel";
break;
}
std::getline(std::cin, line);
switch (type)
{
case SDT_INFO:
case SDT_WARNING:
case SDT_ERROR:
done = true;
break;
case SDT_YES_NO:
if (line == "Y" || line == "y")
{
result = SDR_YES;
done = true;
}
else if (line == "N" || line == "n")
{
result = SDR_NO;
done = true;
}
break;
case SDT_OK_CANCEL:
if (line == "O" || line == "o")
{
done = true;
result = SDR_OK;
}
else if (line == "C" || line == "c")
{
done = true;
result = SDR_CANCEL;
}
break;
}
}
return result;
}
SystemTimeStamp* CSystemUtils::CreateTimeStamp()
{
auto timeStamp = MakeUnique<SystemTimeStamp>();
SystemTimeStamp* timeStampPtr = timeStamp.get();
m_timeStamps.push_back(std::move(timeStamp));
return timeStampPtr;
}
void CSystemUtils::DestroyTimeStamp(SystemTimeStamp *stamp)
{
m_timeStamps.erase(std::remove_if(m_timeStamps.begin(), m_timeStamps.end(), [&](const std::unique_ptr<SystemTimeStamp>& timeStamp) { return timeStamp.get() == stamp; }));
}
void CSystemUtils::CopyTimeStamp(SystemTimeStamp *dst, SystemTimeStamp *src)
{
*dst = *src;
}
float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *after, SystemTimeUnit unit)
{
long long exact = TimeStampExactDiff(before, after);
float result = 0.0f;
if (unit == STU_SEC)
result = exact * 1e-9;
else if (unit == STU_MSEC)
result = exact * 1e-6;
else if (unit == STU_USEC)
result = exact * 1e-3;
else
assert(false);
return result;
}
std::string CSystemUtils::GetDataPath()
{
return COLOBOT_DEFAULT_DATADIR;
}
std::string CSystemUtils::GetLangPath()
{
return COLOBOT_I18N_DIR;
}
std::string CSystemUtils::GetSaveDir()
{
return std::string("saves");
}
|
MatiRg/colobot
|
src/common/system/system.cpp
|
C++
|
gpl-3.0
| 5,068 |
/**
* @file larpandoracontent/LArTwoDReco/LArClusterAssociation/ClusterMergingAlgorithm.h
*
* @brief Header file for the cluster merging algorithm class.
*
* $Log: $
*/
#ifndef LAR_CLUSTER_MERGING_ALGORITHM_H
#define LAR_CLUSTER_MERGING_ALGORITHM_H 1
#include "Pandora/Algorithm.h"
#include <unordered_map>
namespace lar_content
{
/**
* @brief ClusterMergingAlgorithm class
*/
class ClusterMergingAlgorithm : public pandora::Algorithm
{
protected:
virtual pandora::StatusCode Run();
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
typedef std::unordered_map<const pandora::Cluster *, pandora::ClusterList> ClusterMergeMap;
/**
* @brief Populate cluster vector with subset of cluster list, containing clusters judged to be clean
*
* @param pClusterList address of the cluster list
* @param clusterVector to receive the populated cluster vector
*/
virtual void GetListOfCleanClusters(const pandora::ClusterList *const pClusterList, pandora::ClusterVector &clusterVector) const = 0;
/**
* @brief Form associations between pointing clusters
*
* @param clusterVector the vector of clean clusters
* @param clusterMergeMap the matrix of cluster associations
*/
virtual void PopulateClusterMergeMap(const pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMap) const = 0;
/**
* @brief Merge associated clusters
*
* @param clusterVector the vector of clean clusters
* @param clusterMergeMap the matrix of cluster associations
*/
void MergeClusters(pandora::ClusterVector &clusterVector, ClusterMergeMap &clusterMergeMap) const;
/**
* @brief Collect up all clusters associations related to a given seed cluster
*
* @param pSeedCluster pointer to the initial cluster
* @param clusterMergeMap the map of cluster associations
* @param associatedClusterList the output list of associated clusters
*/
void CollectAssociatedClusters(const pandora::Cluster *const pSeedCluster, const ClusterMergeMap &clusterMergeMap,
pandora::ClusterList &associatedClusterList) const;
/**
* @brief Collect up all clusters associations related to a given seed cluster
*
* @param pSeedCluster pointer to the initial cluster
* @param pCurrentCluster pointer to the current cluster
* @param clusterMergeMap the map of cluster associations
* @param clusterVetoList the list of clusters that have already been merged
* @param associatedClusterList the output list of associated clusters
*/
void CollectAssociatedClusters(const pandora::Cluster *const pSeedCluster, const pandora::Cluster *const pCurrentCluster,
const ClusterMergeMap &clusterMergeMap, const pandora::ClusterSet &clusterVetoList, pandora::ClusterList &associatedClusterList) const;
/**
* @brief Sort the selected clusters, so that they have a well-defined ordering
*
* @param inputClusters the input vector of clusters
* @param outputClusters the output vector of clusters
*/
void GetSortedListOfCleanClusters(const pandora::ClusterVector &inputClusters, pandora::ClusterVector &outputClusters) const;
std::string m_inputClusterListName; ///< The name of the input cluster list. If not specified, will access current list.
};
} // namespace lar_content
#endif // #ifndef LAR_CLUSTER_MERGING_ALGORITHM_H
|
johnmarshall80/LArContent
|
larpandoracontent/LArTwoDReco/LArClusterAssociation/ClusterMergingAlgorithm.h
|
C
|
gpl-3.0
| 3,504 |
<!DOCTYPE html>
<!--
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.3.7
Version: 4.7.1
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: [email protected]
Follow: www.twitter.com/keenthemes
Dribbble: www.dribbble.com/keenthemes
Like: www.facebook.com/keenthemes
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
Renew Support: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>Metronic Admin Theme #4 | Basic Bootstrap Tables</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="Preview page of Metronic Admin Theme #4 for basic bootstrap tables with various options and styles" name="description" />
<meta content="" name="author" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME GLOBAL STYLES -->
<link href="../assets/global/css/components-rounded.min.css" rel="stylesheet" id="style_components" type="text/css" />
<link href="../assets/global/css/plugins.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME GLOBAL STYLES -->
<!-- BEGIN THEME LAYOUT STYLES -->
<link href="../assets/layouts/layout4/css/layout.min.css" rel="stylesheet" type="text/css" />
<link href="../assets/layouts/layout4/css/themes/default.min.css" rel="stylesheet" type="text/css" id="style_color" />
<link href="../assets/layouts/layout4/css/custom.min.css" rel="stylesheet" type="text/css" />
<!-- END THEME LAYOUT STYLES -->
<link rel="shortcut icon" href="favicon.ico" /> </head>
<!-- END HEAD -->
<body class="page-container-bg-solid page-header-fixed page-sidebar-closed-hide-logo">
<!-- BEGIN HEADER -->
<div class="page-header navbar navbar-fixed-top">
<!-- BEGIN HEADER INNER -->
<div class="page-header-inner ">
<!-- BEGIN LOGO -->
<div class="page-logo">
<a href="index.html">
<img src="../assets/layouts/layout4/img/logo-light.png" alt="logo" class="logo-default" /> </a>
<div class="menu-toggler sidebar-toggler">
<!-- DOC: Remove the above "hide" to enable the sidebar toggler button on header -->
</div>
</div>
<!-- END LOGO -->
<!-- BEGIN RESPONSIVE MENU TOGGLER -->
<a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse"> </a>
<!-- END RESPONSIVE MENU TOGGLER -->
<!-- BEGIN PAGE ACTIONS -->
<!-- DOC: Remove "hide" class to enable the page header actions -->
<div class="page-actions">
<div class="btn-group">
<button type="button" class="btn red-haze btn-sm dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<span class="hidden-sm hidden-xs">Actions </span>
<i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="javascript:;">
<i class="icon-docs"></i> New Post </a>
</li>
<li>
<a href="javascript:;">
<i class="icon-tag"></i> New Comment </a>
</li>
<li>
<a href="javascript:;">
<i class="icon-share"></i> Share </a>
</li>
<li class="divider"> </li>
<li>
<a href="javascript:;">
<i class="icon-flag"></i> Comments
<span class="badge badge-success">4</span>
</a>
</li>
<li>
<a href="javascript:;">
<i class="icon-users"></i> Feedbacks
<span class="badge badge-danger">2</span>
</a>
</li>
</ul>
</div>
</div>
<!-- END PAGE ACTIONS -->
<!-- BEGIN PAGE TOP -->
<div class="page-top">
<!-- BEGIN HEADER SEARCH BOX -->
<!-- DOC: Apply "search-form-expanded" right after the "search-form" class to have half expanded search box -->
<form class="search-form" action="page_general_search_2.html" method="GET">
<div class="input-group">
<input type="text" class="form-control input-sm" placeholder="Search..." name="query">
<span class="input-group-btn">
<a href="javascript:;" class="btn submit">
<i class="icon-magnifier"></i>
</a>
</span>
</div>
</form>
<!-- END HEADER SEARCH BOX -->
<!-- BEGIN TOP NAVIGATION MENU -->
<div class="top-menu">
<ul class="nav navbar-nav pull-right">
<li class="separator hide"> </li>
<!-- BEGIN NOTIFICATION DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<!-- DOC: Apply "dropdown-hoverable" class after "dropdown" and remove data-toggle="dropdown" data-hover="dropdown" data-close-others="true" attributes to enable hover dropdown mode -->
<!-- DOC: Remove "dropdown-hoverable" and add data-toggle="dropdown" data-hover="dropdown" data-close-others="true" attributes to the below A element with dropdown-toggle class -->
<li class="dropdown dropdown-extended dropdown-notification dropdown-dark" id="header_notification_bar">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-bell"></i>
<span class="badge badge-success"> 7 </span>
</a>
<ul class="dropdown-menu">
<li class="external">
<h3>
<span class="bold">12 pending</span> notifications</h3>
<a href="page_user_profile_1.html">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283">
<li>
<a href="javascript:;">
<span class="time">just now</span>
<span class="details">
<span class="label label-sm label-icon label-success">
<i class="fa fa-plus"></i>
</span> New user registered. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">3 mins</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span> Server #12 overloaded. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">10 mins</span>
<span class="details">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span> Server #2 not responding. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">14 hrs</span>
<span class="details">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span> Application error. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">2 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span> Database overloaded 68%. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">3 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span> A user IP blocked. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">4 days</span>
<span class="details">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span> Storage Server #4 not responding dfdfdfd. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">5 days</span>
<span class="details">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span> System Error. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">9 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span> Storage server failed. </span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END NOTIFICATION DROPDOWN -->
<li class="separator hide"> </li>
<!-- BEGIN INBOX DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-extended dropdown-inbox dropdown-dark" id="header_inbox_bar">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-envelope-open"></i>
<span class="badge badge-danger"> 4 </span>
</a>
<ul class="dropdown-menu">
<li class="external">
<h3>You have
<span class="bold">7 New</span> Messages</h3>
<a href="app_inbox.html">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 275px;" data-handle-color="#637283">
<li>
<a href="#">
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar2.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Lisa Wong </span>
<span class="time">Just Now </span>
</span>
<span class="message"> Vivamus sed auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="#">
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar3.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Richard Doe </span>
<span class="time">16 mins </span>
</span>
<span class="message"> Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="#">
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar1.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Bob Nilson </span>
<span class="time">2 hrs </span>
</span>
<span class="message"> Vivamus sed nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="#">
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar2.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Lisa Wong </span>
<span class="time">40 mins </span>
</span>
<span class="message"> Vivamus sed auctor 40% nibh congue nibh... </span>
</a>
</li>
<li>
<a href="#">
<span class="photo">
<img src="../assets/layouts/layout3/img/avatar3.jpg" class="img-circle" alt=""> </span>
<span class="subject">
<span class="from"> Richard Doe </span>
<span class="time">46 mins </span>
</span>
<span class="message"> Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END INBOX DROPDOWN -->
<li class="separator hide"> </li>
<!-- BEGIN TODO DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-extended dropdown-tasks dropdown-dark" id="header_task_bar">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-calendar"></i>
<span class="badge badge-primary"> 3 </span>
</a>
<ul class="dropdown-menu extended tasks">
<li class="external">
<h3>You have
<span class="bold">12 pending</span> tasks</h3>
<a href="?p=page_todo_2">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 275px;" data-handle-color="#637283">
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">New release v1.2 </span>
<span class="percent">30%</span>
</span>
<span class="progress">
<span style="width: 40%;" class="progress-bar progress-bar-success" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">40% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Application deployment</span>
<span class="percent">65%</span>
</span>
<span class="progress">
<span style="width: 65%;" class="progress-bar progress-bar-danger" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">65% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Mobile app release</span>
<span class="percent">98%</span>
</span>
<span class="progress">
<span style="width: 98%;" class="progress-bar progress-bar-success" aria-valuenow="98" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">98% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Database migration</span>
<span class="percent">10%</span>
</span>
<span class="progress">
<span style="width: 10%;" class="progress-bar progress-bar-warning" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">10% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Web server upgrade</span>
<span class="percent">58%</span>
</span>
<span class="progress">
<span style="width: 58%;" class="progress-bar progress-bar-info" aria-valuenow="58" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">58% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Mobile development</span>
<span class="percent">85%</span>
</span>
<span class="progress">
<span style="width: 85%;" class="progress-bar progress-bar-success" aria-valuenow="85" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">85% Complete</span>
</span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">New UI release</span>
<span class="percent">38%</span>
</span>
<span class="progress progress-striped">
<span style="width: 38%;" class="progress-bar progress-bar-important" aria-valuenow="18" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">38% Complete</span>
</span>
</span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END TODO DROPDOWN -->
<!-- BEGIN USER LOGIN DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-user dropdown-dark">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<span class="username username-hide-on-mobile"> Nick </span>
<!-- DOC: Do not remove below empty space( ) as its purposely used -->
<img alt="" class="img-circle" src="../assets/layouts/layout4/img/avatar9.jpg" /> </a>
<ul class="dropdown-menu dropdown-menu-default">
<li>
<a href="page_user_profile_1.html">
<i class="icon-user"></i> My Profile </a>
</li>
<li>
<a href="app_calendar.html">
<i class="icon-calendar"></i> My Calendar </a>
</li>
<li>
<a href="app_inbox.html">
<i class="icon-envelope-open"></i> My Inbox
<span class="badge badge-danger"> 3 </span>
</a>
</li>
<li>
<a href="app_todo_2.html">
<i class="icon-rocket"></i> My Tasks
<span class="badge badge-success"> 7 </span>
</a>
</li>
<li class="divider"> </li>
<li>
<a href="page_user_lock_1.html">
<i class="icon-lock"></i> Lock Screen </a>
</li>
<li>
<a href="page_user_login_1.html">
<i class="icon-key"></i> Log Out </a>
</li>
</ul>
</li>
<!-- END USER LOGIN DROPDOWN -->
<!-- BEGIN QUICK SIDEBAR TOGGLER -->
<li class="dropdown dropdown-extended quick-sidebar-toggler">
<span class="sr-only">Toggle Quick Sidebar</span>
<i class="icon-logout"></i>
</li>
<!-- END QUICK SIDEBAR TOGGLER -->
</ul>
</div>
<!-- END TOP NAVIGATION MENU -->
</div>
<!-- END PAGE TOP -->
</div>
<!-- END HEADER INNER -->
</div>
<!-- END HEADER -->
<!-- BEGIN HEADER & CONTENT DIVIDER -->
<div class="clearfix"> </div>
<!-- END HEADER & CONTENT DIVIDER -->
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- BEGIN SIDEBAR -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
<!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
<!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
<!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<ul class="page-sidebar-menu " data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
<li class="nav-item start ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-home"></i>
<span class="title">Dashboard</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item start ">
<a href="index.html" class="nav-link ">
<i class="icon-bar-chart"></i>
<span class="title">Dashboard 1</span>
</a>
</li>
<li class="nav-item start ">
<a href="dashboard_2.html" class="nav-link ">
<i class="icon-bulb"></i>
<span class="title">Dashboard 2</span>
<span class="badge badge-success">1</span>
</a>
</li>
<li class="nav-item start ">
<a href="dashboard_3.html" class="nav-link ">
<i class="icon-graph"></i>
<span class="title">Dashboard 3</span>
<span class="badge badge-danger">5</span>
</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">Features</h3>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-diamond"></i>
<span class="title">UI Features</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="ui_colors.html" class="nav-link ">
<span class="title">Color Library</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_metronic_grid.html" class="nav-link ">
<span class="title">Metronic Grid System</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_general.html" class="nav-link ">
<span class="title">General Components</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_buttons.html" class="nav-link ">
<span class="title">Buttons</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_buttons_spinner.html" class="nav-link ">
<span class="title">Spinner Buttons</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_confirmations.html" class="nav-link ">
<span class="title">Popover Confirmations</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_sweetalert.html" class="nav-link ">
<span class="title">Bootstrap Sweet Alerts</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_icons.html" class="nav-link ">
<span class="title">Font Icons</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_socicons.html" class="nav-link ">
<span class="title">Social Icons</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_typography.html" class="nav-link ">
<span class="title">Typography</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_tabs_accordions_navs.html" class="nav-link ">
<span class="title">Tabs, Accordions & Navs</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_timeline.html" class="nav-link ">
<span class="title">Timeline 1</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_timeline_2.html" class="nav-link ">
<span class="title">Timeline 2</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_timeline_horizontal.html" class="nav-link ">
<span class="title">Horizontal Timeline</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_tree.html" class="nav-link ">
<span class="title">Tree View</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<span class="title">Page Progress Bar</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="ui_page_progress_style_1.html" class="nav-link "> Flash </a>
</li>
<li class="nav-item ">
<a href="ui_page_progress_style_2.html" class="nav-link "> Big Counter </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="ui_blockui.html" class="nav-link ">
<span class="title">Block UI</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_bootstrap_growl.html" class="nav-link ">
<span class="title">Bootstrap Growl Notifications</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_notific8.html" class="nav-link ">
<span class="title">Notific8 Notifications</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_toastr.html" class="nav-link ">
<span class="title">Toastr Notifications</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_bootbox.html" class="nav-link ">
<span class="title">Bootbox Dialogs</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_alerts_api.html" class="nav-link ">
<span class="title">Metronic Alerts API</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_session_timeout.html" class="nav-link ">
<span class="title">Session Timeout</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_idle_timeout.html" class="nav-link ">
<span class="title">User Idle Timeout</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_modals.html" class="nav-link ">
<span class="title">Modals</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_extended_modals.html" class="nav-link ">
<span class="title">Extended Modals</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_tiles.html" class="nav-link ">
<span class="title">Tiles</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_datepaginator.html" class="nav-link ">
<span class="title">Date Paginator</span>
</a>
</li>
<li class="nav-item ">
<a href="ui_nestable.html" class="nav-link ">
<span class="title">Nestable List</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-puzzle"></i>
<span class="title">Components</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="components_date_time_pickers.html" class="nav-link ">
<span class="title">Date & Time Pickers</span>
</a>
</li>
<li class="nav-item ">
<a href="components_color_pickers.html" class="nav-link ">
<span class="title">Color Pickers</span>
<span class="badge badge-danger">2</span>
</a>
</li>
<li class="nav-item ">
<a href="components_select2.html" class="nav-link ">
<span class="title">Select2 Dropdowns</span>
</a>
</li>
<li class="nav-item ">
<a href="components_bootstrap_multiselect_dropdown.html" class="nav-link ">
<span class="title">Bootstrap Multiselect Dropdowns</span>
</a>
</li>
<li class="nav-item ">
<a href="components_bootstrap_select.html" class="nav-link ">
<span class="title">Bootstrap Select</span>
</a>
</li>
<li class="nav-item ">
<a href="components_multi_select.html" class="nav-link ">
<span class="title">Bootstrap Multiple Select</span>
</a>
</li>
<li class="nav-item ">
<a href="components_bootstrap_select_splitter.html" class="nav-link ">
<span class="title">Select Splitter</span>
</a>
</li>
<li class="nav-item ">
<a href="components_clipboard.html" class="nav-link ">
<span class="title">Clipboard</span>
</a>
</li>
<li class="nav-item ">
<a href="components_typeahead.html" class="nav-link ">
<span class="title">Typeahead Autocomplete</span>
</a>
</li>
<li class="nav-item ">
<a href="components_bootstrap_tagsinput.html" class="nav-link ">
<span class="title">Bootstrap Tagsinput</span>
</a>
</li>
<li class="nav-item ">
<a href="components_bootstrap_switch.html" class="nav-link ">
<span class="title">Bootstrap Switch</span>
<span class="badge badge-success">6</span>
</a>
</li>
<li class="nav-item ">
<a href="components_bootstrap_maxlength.html" class="nav-link ">
<span class="title">Bootstrap Maxlength</span>
</a>
</li>
<li class="nav-item ">
<a href="components_bootstrap_fileinput.html" class="nav-link ">
<span class="title">Bootstrap File Input</span>
</a>
</li>
<li class="nav-item ">
<a href="components_bootstrap_touchspin.html" class="nav-link ">
<span class="title">Bootstrap Touchspin</span>
</a>
</li>
<li class="nav-item ">
<a href="components_form_tools.html" class="nav-link ">
<span class="title">Form Widgets & Tools</span>
</a>
</li>
<li class="nav-item ">
<a href="components_context_menu.html" class="nav-link ">
<span class="title">Context Menu</span>
</a>
</li>
<li class="nav-item ">
<a href="components_editors.html" class="nav-link ">
<span class="title">Markdown & WYSIWYG Editors</span>
</a>
</li>
<li class="nav-item ">
<a href="components_code_editors.html" class="nav-link ">
<span class="title">Code Editors</span>
</a>
</li>
<li class="nav-item ">
<a href="components_ion_sliders.html" class="nav-link ">
<span class="title">Ion Range Sliders</span>
</a>
</li>
<li class="nav-item ">
<a href="components_noui_sliders.html" class="nav-link ">
<span class="title">NoUI Range Sliders</span>
</a>
</li>
<li class="nav-item ">
<a href="components_knob_dials.html" class="nav-link ">
<span class="title">Knob Circle Dials</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-settings"></i>
<span class="title">Form Stuff</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="form_controls.html" class="nav-link ">
<span class="title">Bootstrap Form
<br>Controls</span>
</a>
</li>
<li class="nav-item ">
<a href="form_controls_md.html" class="nav-link ">
<span class="title">Material Design
<br>Form Controls</span>
</a>
</li>
<li class="nav-item ">
<a href="form_validation.html" class="nav-link ">
<span class="title">Form Validation</span>
</a>
</li>
<li class="nav-item ">
<a href="form_validation_states_md.html" class="nav-link ">
<span class="title">Material Design
<br>Form Validation States</span>
</a>
</li>
<li class="nav-item ">
<a href="form_validation_md.html" class="nav-link ">
<span class="title">Material Design
<br>Form Validation</span>
</a>
</li>
<li class="nav-item ">
<a href="form_layouts.html" class="nav-link ">
<span class="title">Form Layouts</span>
</a>
</li>
<li class="nav-item ">
<a href="form_repeater.html" class="nav-link ">
<span class="title">Form Repeater</span>
</a>
</li>
<li class="nav-item ">
<a href="form_input_mask.html" class="nav-link ">
<span class="title">Form Input Mask</span>
</a>
</li>
<li class="nav-item ">
<a href="form_editable.html" class="nav-link ">
<span class="title">Form X-editable</span>
</a>
</li>
<li class="nav-item ">
<a href="form_wizard.html" class="nav-link ">
<span class="title">Form Wizard</span>
</a>
</li>
<li class="nav-item ">
<a href="form_icheck.html" class="nav-link ">
<span class="title">iCheck Controls</span>
</a>
</li>
<li class="nav-item ">
<a href="form_image_crop.html" class="nav-link ">
<span class="title">Image Cropping</span>
</a>
</li>
<li class="nav-item ">
<a href="form_fileupload.html" class="nav-link ">
<span class="title">Multiple File Upload</span>
</a>
</li>
<li class="nav-item ">
<a href="form_dropzone.html" class="nav-link ">
<span class="title">Dropzone File Upload</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-bulb"></i>
<span class="title">Elements</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="elements_steps.html" class="nav-link ">
<span class="title">Steps</span>
</a>
</li>
<li class="nav-item ">
<a href="elements_lists.html" class="nav-link ">
<span class="title">Lists</span>
</a>
</li>
<li class="nav-item ">
<a href="elements_ribbons.html" class="nav-link ">
<span class="title">Ribbons</span>
</a>
</li>
<li class="nav-item ">
<a href="elements_overlay.html" class="nav-link ">
<span class="title">Overlays</span>
</a>
</li>
<li class="nav-item ">
<a href="elements_cards.html" class="nav-link ">
<span class="title">User Cards</span>
</a>
</li>
</ul>
</li>
<li class="nav-item active open">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-briefcase"></i>
<span class="title">Tables</span>
<span class="selected"></span>
<span class="arrow open"></span>
</a>
<ul class="sub-menu">
<li class="nav-item active open">
<a href="table_static_basic.html" class="nav-link ">
<span class="title">Basic Tables</span>
<span class="selected"></span>
</a>
</li>
<li class="nav-item ">
<a href="table_static_responsive.html" class="nav-link ">
<span class="title">Responsive Tables</span>
</a>
</li>
<li class="nav-item ">
<a href="table_bootstrap.html" class="nav-link ">
<span class="title">Bootstrap Tables</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<span class="title">Datatables</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="table_datatables_managed.html" class="nav-link "> Managed Datatables </a>
</li>
<li class="nav-item ">
<a href="table_datatables_buttons.html" class="nav-link "> Buttons Extension </a>
</li>
<li class="nav-item ">
<a href="table_datatables_colreorder.html" class="nav-link "> Colreorder Extension </a>
</li>
<li class="nav-item ">
<a href="table_datatables_rowreorder.html" class="nav-link "> Rowreorder Extension </a>
</li>
<li class="nav-item ">
<a href="table_datatables_scroller.html" class="nav-link "> Scroller Extension </a>
</li>
<li class="nav-item ">
<a href="table_datatables_fixedheader.html" class="nav-link "> FixedHeader Extension </a>
</li>
<li class="nav-item ">
<a href="table_datatables_responsive.html" class="nav-link "> Responsive Extension </a>
</li>
<li class="nav-item ">
<a href="table_datatables_editable.html" class="nav-link "> Editable Datatables </a>
</li>
<li class="nav-item ">
<a href="table_datatables_ajax.html" class="nav-link "> Ajax Datatables </a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="?p=" class="nav-link nav-toggle">
<i class="icon-wallet"></i>
<span class="title">Portlets</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="portlet_boxed.html" class="nav-link ">
<span class="title">Boxed Portlets</span>
</a>
</li>
<li class="nav-item ">
<a href="portlet_light.html" class="nav-link ">
<span class="title">Light Portlets</span>
</a>
</li>
<li class="nav-item ">
<a href="portlet_solid.html" class="nav-link ">
<span class="title">Solid Portlets</span>
</a>
</li>
<li class="nav-item ">
<a href="portlet_ajax.html" class="nav-link ">
<span class="title">Ajax Portlets</span>
</a>
</li>
<li class="nav-item ">
<a href="portlet_draggable.html" class="nav-link ">
<span class="title">Draggable Portlets</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-bar-chart"></i>
<span class="title">Charts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="charts_amcharts.html" class="nav-link ">
<span class="title">amChart</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_flotcharts.html" class="nav-link ">
<span class="title">Flot Charts</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_flowchart.html" class="nav-link ">
<span class="title">Flow Charts</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_google.html" class="nav-link ">
<span class="title">Google Charts</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_echarts.html" class="nav-link ">
<span class="title">eCharts</span>
</a>
</li>
<li class="nav-item ">
<a href="charts_morris.html" class="nav-link ">
<span class="title">Morris Charts</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<span class="title">HighCharts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="charts_highcharts.html" class="nav-link "> HighCharts </a>
</li>
<li class="nav-item ">
<a href="charts_highstock.html" class="nav-link "> HighStock </a>
</li>
<li class="nav-item ">
<a href="charts_highmaps.html" class="nav-link "> HighMaps </a>
</li>
</ul>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-pointer"></i>
<span class="title">Maps</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="maps_google.html" class="nav-link ">
<span class="title">Google Maps</span>
</a>
</li>
<li class="nav-item ">
<a href="maps_vector.html" class="nav-link ">
<span class="title">Vector Maps</span>
</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">Layouts</h3>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-layers"></i>
<span class="title">Page Layouts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="layout_blank_page.html" class="nav-link ">
<span class="title">Blank Page</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_ajax_page.html" class="nav-link ">
<span class="title">Ajax Content Layout</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_language_bar.html" class="nav-link ">
<span class="title">Header Language Bar</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_footer_fixed.html" class="nav-link ">
<span class="title">Fixed Footer</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_boxed_page.html" class="nav-link ">
<span class="title">Boxed Page</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-feed"></i>
<span class="title">Sidebar Layouts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="layout_sidebar_menu_hover.html" class="nav-link ">
<span class="title">Hover Sidebar Menu</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_sidebar_reversed.html" class="nav-link ">
<span class="title">Reversed Sidebar Page</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_sidebar_fixed.html" class="nav-link ">
<span class="title">Fixed Sidebar Layout</span>
</a>
</li>
<li class="nav-item ">
<a href="layout_sidebar_closed.html" class="nav-link ">
<span class="title">Closed Sidebar Layout</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class=" icon-wrench"></i>
<span class="title">Custom Layouts</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="layout_disabled_menu.html" class="nav-link ">
<span class="title">Disabled Menu Links</span>
</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">Pages</h3>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-basket"></i>
<span class="title">eCommerce</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="ecommerce_index.html" class="nav-link ">
<i class="icon-home"></i>
<span class="title">Dashboard</span>
</a>
</li>
<li class="nav-item ">
<a href="ecommerce_orders.html" class="nav-link ">
<i class="icon-basket"></i>
<span class="title">Orders</span>
</a>
</li>
<li class="nav-item ">
<a href="ecommerce_orders_view.html" class="nav-link ">
<i class="icon-tag"></i>
<span class="title">Order View</span>
</a>
</li>
<li class="nav-item ">
<a href="ecommerce_products.html" class="nav-link ">
<i class="icon-graph"></i>
<span class="title">Products</span>
</a>
</li>
<li class="nav-item ">
<a href="ecommerce_products_edit.html" class="nav-link ">
<i class="icon-graph"></i>
<span class="title">Product Edit</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-docs"></i>
<span class="title">Apps</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="app_todo.html" class="nav-link ">
<i class="icon-clock"></i>
<span class="title">Todo 1</span>
</a>
</li>
<li class="nav-item ">
<a href="app_todo_2.html" class="nav-link ">
<i class="icon-check"></i>
<span class="title">Todo 2</span>
</a>
</li>
<li class="nav-item ">
<a href="app_inbox.html" class="nav-link ">
<i class="icon-envelope"></i>
<span class="title">Inbox</span>
</a>
</li>
<li class="nav-item ">
<a href="app_calendar.html" class="nav-link ">
<i class="icon-calendar"></i>
<span class="title">Calendar</span>
</a>
</li>
<li class="nav-item ">
<a href="app_ticket.html" class="nav-link ">
<i class="icon-notebook"></i>
<span class="title">Support</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-user"></i>
<span class="title">User</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_user_profile_1.html" class="nav-link ">
<i class="icon-user"></i>
<span class="title">Profile 1</span>
</a>
</li>
<li class="nav-item ">
<a href="page_user_profile_1_account.html" class="nav-link ">
<i class="icon-user-female"></i>
<span class="title">Profile 1 Account</span>
</a>
</li>
<li class="nav-item ">
<a href="page_user_profile_1_help.html" class="nav-link ">
<i class="icon-user-following"></i>
<span class="title">Profile 1 Help</span>
</a>
</li>
<li class="nav-item ">
<a href="page_user_profile_2.html" class="nav-link ">
<i class="icon-users"></i>
<span class="title">Profile 2</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-notebook"></i>
<span class="title">Login</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_user_login_1.html" class="nav-link " target="_blank"> Login Page 1 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_2.html" class="nav-link " target="_blank"> Login Page 2 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_3.html" class="nav-link " target="_blank"> Login Page 3 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_4.html" class="nav-link " target="_blank"> Login Page 4 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_5.html" class="nav-link " target="_blank"> Login Page 5 </a>
</li>
<li class="nav-item ">
<a href="page_user_login_6.html" class="nav-link " target="_blank"> Login Page 6 </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="page_user_lock_1.html" class="nav-link " target="_blank">
<i class="icon-lock"></i>
<span class="title">Lock Screen 1</span>
</a>
</li>
<li class="nav-item ">
<a href="page_user_lock_2.html" class="nav-link " target="_blank">
<i class="icon-lock-open"></i>
<span class="title">Lock Screen 2</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-social-dribbble"></i>
<span class="title">General</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_general_about.html" class="nav-link ">
<i class="icon-info"></i>
<span class="title">About</span>
</a>
</li>
<li class="nav-item ">
<a href="page_general_contact.html" class="nav-link ">
<i class="icon-call-end"></i>
<span class="title">Contact</span>
</a>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-notebook"></i>
<span class="title">Portfolio</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_general_portfolio_1.html" class="nav-link "> Portfolio 1 </a>
</li>
<li class="nav-item ">
<a href="page_general_portfolio_2.html" class="nav-link "> Portfolio 2 </a>
</li>
<li class="nav-item ">
<a href="page_general_portfolio_3.html" class="nav-link "> Portfolio 3 </a>
</li>
<li class="nav-item ">
<a href="page_general_portfolio_4.html" class="nav-link "> Portfolio 4 </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-magnifier"></i>
<span class="title">Search</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_general_search.html" class="nav-link "> Search 1 </a>
</li>
<li class="nav-item ">
<a href="page_general_search_2.html" class="nav-link "> Search 2 </a>
</li>
<li class="nav-item ">
<a href="page_general_search_3.html" class="nav-link "> Search 3 </a>
</li>
<li class="nav-item ">
<a href="page_general_search_4.html" class="nav-link "> Search 4 </a>
</li>
<li class="nav-item ">
<a href="page_general_search_5.html" class="nav-link "> Search 5 </a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="page_general_pricing.html" class="nav-link ">
<i class="icon-tag"></i>
<span class="title">Pricing</span>
</a>
</li>
<li class="nav-item ">
<a href="page_general_faq.html" class="nav-link ">
<i class="icon-wrench"></i>
<span class="title">FAQ</span>
</a>
</li>
<li class="nav-item ">
<a href="page_general_blog.html" class="nav-link ">
<i class="icon-pencil"></i>
<span class="title">Blog</span>
</a>
</li>
<li class="nav-item ">
<a href="page_general_blog_post.html" class="nav-link ">
<i class="icon-note"></i>
<span class="title">Blog Post</span>
</a>
</li>
<li class="nav-item ">
<a href="page_general_invoice.html" class="nav-link ">
<i class="icon-envelope"></i>
<span class="title">Invoice</span>
</a>
</li>
<li class="nav-item ">
<a href="page_general_invoice_2.html" class="nav-link ">
<i class="icon-envelope"></i>
<span class="title">Invoice 2</span>
</a>
</li>
</ul>
</li>
<li class="nav-item ">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-settings"></i>
<span class="title">System</span>
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item ">
<a href="page_cookie_consent_1.html" class="nav-link ">
<span class="title">Cookie Consent 1</span>
</a>
</li>
<li class="nav-item ">
<a href="page_cookie_consent_2.html" class="nav-link ">
<span class="title">Cookie Consent 2</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_coming_soon.html" class="nav-link " target="_blank">
<span class="title">Coming Soon</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_404_1.html" class="nav-link ">
<span class="title">404 Page 1</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_404_2.html" class="nav-link " target="_blank">
<span class="title">404 Page 2</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_404_3.html" class="nav-link " target="_blank">
<span class="title">404 Page 3</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_500_1.html" class="nav-link ">
<span class="title">500 Page 1</span>
</a>
</li>
<li class="nav-item ">
<a href="page_system_500_2.html" class="nav-link " target="_blank">
<span class="title">500 Page 2</span>
</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-folder"></i>
<span class="title">Multi Level Menu</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="javascript:;" class="nav-link nav-toggle">
<i class="icon-settings"></i> Item 1
<span class="arrow"></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="?p=dashboard-2" target="_blank" class="nav-link">
<i class="icon-user"></i> Arrow Toggle
<span class="arrow nav-toggle"></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-power"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-paper-plane"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-star"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-camera"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-link"></i> Sample Link 2</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-pointer"></i> Sample Link 3</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="?p=dashboard-2" target="_blank" class="nav-link">
<i class="icon-globe"></i> Arrow Toggle
<span class="arrow nav-toggle"></span>
</a>
<ul class="sub-menu">
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-tag"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-pencil"></i> Sample Link 1</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-graph"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="icon-bar-chart"></i> Item 3 </a>
</li>
</ul>
</li>
</ul>
<!-- END SIDEBAR MENU -->
</div>
<!-- END SIDEBAR -->
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<!-- BEGIN CONTENT BODY -->
<div class="page-content">
<!-- BEGIN PAGE HEAD-->
<div class="page-head">
<!-- BEGIN PAGE TITLE -->
<div class="page-title">
<h1>Basic Bootstrap Tables
<small>basic bootstrap tables with various options and styles</small>
</h1>
</div>
<!-- END PAGE TITLE -->
<!-- BEGIN PAGE TOOLBAR -->
<div class="page-toolbar">
<!-- BEGIN THEME PANEL -->
<div class="btn-group btn-theme-panel">
<a href="javascript:;" class="btn dropdown-toggle" data-toggle="dropdown">
<i class="icon-settings"></i>
</a>
<div class="dropdown-menu theme-panel pull-right dropdown-custom hold-on-click">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-12">
<h3>HEADER</h3>
<ul class="theme-colors">
<li class="theme-color theme-color-default active" data-theme="default">
<span class="theme-color-view"></span>
<span class="theme-color-name">Dark Header</span>
</li>
<li class="theme-color theme-color-light " data-theme="light">
<span class="theme-color-view"></span>
<span class="theme-color-name">Light Header</span>
</li>
</ul>
</div>
<div class="col-md-8 col-sm-8 col-xs-12 seperator">
<h3>LAYOUT</h3>
<ul class="theme-settings">
<li> Theme Style
<select class="layout-style-option form-control input-small input-sm">
<option value="square">Square corners</option>
<option value="rounded" selected="selected">Rounded corners</option>
</select>
</li>
<li> Layout
<select class="layout-option form-control input-small input-sm">
<option value="fluid" selected="selected">Fluid</option>
<option value="boxed">Boxed</option>
</select>
</li>
<li> Header
<select class="page-header-option form-control input-small input-sm">
<option value="fixed" selected="selected">Fixed</option>
<option value="default">Default</option>
</select>
</li>
<li> Top Dropdowns
<select class="page-header-top-dropdown-style-option form-control input-small input-sm">
<option value="light">Light</option>
<option value="dark" selected="selected">Dark</option>
</select>
</li>
<li> Sidebar Mode
<select class="sidebar-option form-control input-small input-sm">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</li>
<li> Sidebar Menu
<select class="sidebar-menu-option form-control input-small input-sm">
<option value="accordion" selected="selected">Accordion</option>
<option value="hover">Hover</option>
</select>
</li>
<li> Sidebar Position
<select class="sidebar-pos-option form-control input-small input-sm">
<option value="left" selected="selected">Left</option>
<option value="right">Right</option>
</select>
</li>
<li> Footer
<select class="page-footer-option form-control input-small input-sm">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- END THEME PANEL -->
</div>
<!-- END PAGE TOOLBAR -->
</div>
<!-- END PAGE HEAD-->
<!-- BEGIN PAGE BREADCRUMB -->
<ul class="page-breadcrumb breadcrumb">
<li>
<a href="index.html">Home</a>
<i class="fa fa-circle"></i>
</li>
<li>
<span class="active">Tables</span>
</li>
</ul>
<!-- END PAGE BREADCRUMB -->
<!-- BEGIN PAGE BASE CONTENT -->
<div class="row">
<div class="col-md-6">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption">
<i class="icon-social-dribbble font-green"></i>
<span class="caption-subject font-green bold uppercase">Simple Table</span>
</div>
<div class="actions">
<a class="btn btn-circle btn-icon-only btn-default" href="javascript:;">
<i class="icon-cloud-upload"></i>
</a>
<a class="btn btn-circle btn-icon-only btn-default" href="javascript:;">
<i class="icon-wrench"></i>
</a>
<a class="btn btn-circle btn-icon-only btn-default" href="javascript:;">
<i class="icon-trash"></i>
</a>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-hover">
<thead>
<tr>
<th> # </th>
<th> First Name </th>
<th> Last Name </th>
<th> Username </th>
<th> Status </th>
</tr>
</thead>
<tbody>
<tr>
<td> 1 </td>
<td> Mark </td>
<td> Otto </td>
<td> makr124 </td>
<td>
<div class="btn-group">
<button type="button" class="btn btn-default">Left</button>
<button type="button" class="btn btn-default">Middle</button>
<button type="button" class="btn btn-default">Right</button>
</div>
</td>
</tr>
<tr>
<td> 2 </td>
<td> Jacob </td>
<td> Nilson </td>
<td> jac123 </td>
<td>
<span class="label label-sm label-info"> Pending </span>
</td>
</tr>
<tr>
<td> 3 </td>
<td> Larry </td>
<td> Cooper </td>
<td> lar </td>
<td>
<span class="label label-sm label-warning"> Suspended </span>
</td>
</tr>
<tr>
<td> 4 </td>
<td> Sandy </td>
<td> Lim </td>
<td> sanlim </td>
<td>
<span class="label label-sm label-danger"> Blocked </span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
<div class="col-md-6">
<!-- BEGIN BORDERED TABLE PORTLET-->
<div class="portlet light portlet-fit bordered">
<div class="portlet-title">
<div class="caption">
<i class="icon-bubble font-dark"></i>
<span class="caption-subject font-dark bold uppercase">Bordered Table</span>
</div>
<div class="actions">
<div class="btn-group">
<a class="btn dark btn-outline btn-circle btn-sm" href="javascript:;" data-toggle="dropdown" data-hover="dropdown" data-close-others="true"> Actions
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right">
<li>
<a href="javascript:;"> Option 1</a>
</li>
<li class="divider"> </li>
<li>
<a href="javascript:;">Option 2</a>
</li>
<li>
<a href="javascript:;">Option 3</a>
</li>
<li>
<a href="javascript:;">Option 4</a>
</li>
</ul>
</div>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th> # </th>
<th> First Name </th>
<th> Last Name </th>
<th> Username </th>
<th> Status </th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2"> 1 </td>
<td> Mark </td>
<td> Otto </td>
<td> makr124 </td>
<td>
<span class="label label-sm label-success"> Approved </span>
</td>
</tr>
<tr>
<td> Jacob </td>
<td> Nilson </td>
<td> jac123 </td>
<td>
<span class="label label-sm label-info"> Pending </span>
</td>
</tr>
<tr>
<td> 2 </td>
<td> Larry </td>
<td> Cooper </td>
<td> lar </td>
<td>
<span class="label label-sm label-warning"> Suspended </span>
</td>
</tr>
<tr>
<td> 3 </td>
<td> Sandy </td>
<td> Lim </td>
<td> sanlim </td>
<td>
<span class="label label-sm label-danger"> Blocked </span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END BORDERED TABLE PORTLET-->
</div>
</div>
<div class="row">
<div class="col-md-6">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-comments"></i>Striped Table </div>
<div class="tools">
<a href="javascript:;" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="javascript:;" class="reload"> </a>
<a href="javascript:;" class="remove"> </a>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-striped table-hover">
<thead>
<tr>
<th> # </th>
<th> First Name </th>
<th> Last Name </th>
<th> Username </th>
<th> Status </th>
</tr>
</thead>
<tbody>
<tr>
<td> 1 </td>
<td> Mark </td>
<td> Otto </td>
<td> makr124 </td>
<td>
<span class="label label-sm label-success"> Approved </span>
</td>
</tr>
<tr>
<td> 2 </td>
<td> Jacob </td>
<td> Nilson </td>
<td> jac123 </td>
<td>
<span class="label label-sm label-info"> Pending </span>
</td>
</tr>
<tr>
<td> 3 </td>
<td> Larry </td>
<td> Cooper </td>
<td> lar </td>
<td>
<span class="label label-sm label-warning"> Suspended </span>
</td>
</tr>
<tr>
<td> 4 </td>
<td> Sandy </td>
<td> Lim </td>
<td> sanlim </td>
<td>
<span class="label label-sm label-danger"> Blocked </span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
<div class="col-md-6">
<!-- BEGIN CONDENSED TABLE PORTLET-->
<div class="portlet box red">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-picture"></i>Condensed Table </div>
<div class="tools">
<a href="javascript:;" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="javascript:;" class="reload"> </a>
<a href="javascript:;" class="remove"> </a>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-condensed table-hover">
<thead>
<tr>
<th> # </th>
<th> First Name </th>
<th> Last Name </th>
<th> Username </th>
<th> Status </th>
</tr>
</thead>
<tbody>
<tr>
<td> 1 </td>
<td> Mark </td>
<td> Otto </td>
<td> makr124 </td>
<td>
<span class="label label-sm label-success"> Approved </span>
</td>
</tr>
<tr>
<td> 2 </td>
<td> Jacob </td>
<td> Nilson </td>
<td> jac123 </td>
<td>
<span class="label label-sm label-info"> Pending </span>
</td>
</tr>
<tr>
<td> 3 </td>
<td> Larry </td>
<td> Cooper </td>
<td> lar </td>
<td>
<span class="label label-sm label-warning"> Suspended </span>
</td>
</tr>
<tr>
<td> 4 </td>
<td> Sandy </td>
<td> Lim </td>
<td> sanlim </td>
<td>
<span class="label label-sm label-danger"> Blocked </span>
</td>
</tr>
<tr>
<td> 5 </td>
<td> Sandy </td>
<td> Lim </td>
<td> sanlim </td>
<td>
<span class="label label-sm label-danger"> Blocked </span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END CONDENSED TABLE PORTLET-->
</div>
</div>
<div class="row">
<div class="col-md-6">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet light bordered">
<div class="portlet-title">
<div class="caption">
<i class="icon-settings font-red"></i>
<span class="caption-subject font-red sbold uppercase">Light Table 1</span>
</div>
<div class="actions">
<div class="btn-group btn-group-devided" data-toggle="buttons">
<label class="btn btn-transparent red btn-outline btn-circle btn-sm active">
<input type="radio" name="options" class="toggle" id="option1">Actions</label>
<label class="btn btn-transparent red btn-outline btn-circle btn-sm">
<input type="radio" name="options" class="toggle" id="option2">Settings</label>
</div>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-hover table-light">
<thead>
<tr>
<th> # </th>
<th> First Name </th>
<th> Last Name </th>
<th> Username </th>
<th> Status </th>
</tr>
</thead>
<tbody>
<tr>
<td> 1 </td>
<td> Mark </td>
<td> Otto </td>
<td> makr124 </td>
<td>
<span class="label label-sm label-success"> Approved </span>
</td>
</tr>
<tr>
<td> 2 </td>
<td> Jacob </td>
<td> Nilson </td>
<td> jac123 </td>
<td>
<span class="label label-sm label-info"> Pending </span>
</td>
</tr>
<tr>
<td> 3 </td>
<td> Larry </td>
<td> Cooper </td>
<td> lar </td>
<td>
<span class="label label-sm label-warning"> Suspended </span>
</td>
</tr>
<tr>
<td> 4 </td>
<td> Sandy </td>
<td> Lim </td>
<td> sanlim </td>
<td>
<span class="label label-sm label-danger"> Blocked </span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
<div class="col-md-6">
<!-- BEGIN BORDERED TABLE PORTLET-->
<div class="portlet light portlet-fit bordered">
<div class="portlet-title">
<div class="caption">
<i class="icon-settings font-red"></i>
<span class="caption-subject font-red sbold uppercase">Light Table 2</span>
</div>
<div class="actions">
<div class="btn-group btn-group-devided" data-toggle="buttons">
<label class="btn grey-salsa btn-sm active">
<input type="radio" name="options" class="toggle" id="option1">Actions</label>
<label class="btn grey-salsa btn-sm">
<input type="radio" name="options" class="toggle" id="option2">Settings</label>
</div>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable table-scrollable-borderless">
<table class="table table-hover table-light">
<thead>
<tr class="uppercase">
<th> # </th>
<th> First Name </th>
<th> Last Name </th>
<th> Username </th>
<th> Status </th>
</tr>
</thead>
<tbody>
<tr>
<td> 1 </td>
<td> Mark </td>
<td> Otto </td>
<td> makr124 </td>
<td>
<span class="label label-sm label-success"> Approved </span>
</td>
</tr>
<tr>
<td> 2 </td>
<td> Jacob </td>
<td> Nilson </td>
<td> jac123 </td>
<td>
<span class="label label-sm label-info"> Pending </span>
</td>
</tr>
<tr>
<td> 3 </td>
<td> Larry </td>
<td> Cooper </td>
<td> lar </td>
<td>
<span class="label label-sm label-warning"> Suspended </span>
</td>
</tr>
<tr>
<td> 4 </td>
<td> Sandy </td>
<td> Lim </td>
<td> sanlim </td>
<td>
<span class="label label-sm label-danger"> Blocked </span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END BORDERED TABLE PORTLET-->
</div>
</div>
<div class="row">
<div class="col-md-6">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-comments"></i>Contextual Rows </div>
<div class="tools">
<a href="javascript:;" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="javascript:;" class="reload"> </a>
<a href="javascript:;" class="remove"> </a>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th> # </th>
<th> Class Name </th>
<th> Column </th>
<th> Column </th>
<th> Column </th>
</tr>
</thead>
<tbody>
<tr class="active">
<td> 1 </td>
<td> active </td>
<td> Column heading </td>
<td> Column heading </td>
<td> Column heading </td>
</tr>
<tr class="success">
<td> 2 </td>
<td> success </td>
<td> Column heading </td>
<td> Column heading </td>
<td> Column heading </td>
</tr>
<tr class="warning">
<td> 3 </td>
<td> warning </td>
<td> Column heading </td>
<td> Column heading </td>
<td> Column heading </td>
</tr>
<tr class="danger">
<td> 4 </td>
<td> danger </td>
<td> Column heading </td>
<td> Column heading </td>
<td> Column heading </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
<div class="col-md-6">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet box yellow">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-comments"></i>Contextual Columns </div>
<div class="tools">
<a href="javascript:;" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="javascript:;" class="reload"> </a>
<a href="javascript:;" class="remove"> </a>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th> # </th>
<th> Column </th>
<th> Column </th>
<th> Column </th>
<th> Column </th>
</tr>
</thead>
<tbody>
<tr>
<td> 1 </td>
<td class="active"> active </td>
<td class="success"> success </td>
<td class="warning"> warning </td>
<td class="danger"> danger </td>
</tr>
<tr>
<td> 2 </td>
<td class="active"> active </td>
<td class="success"> success </td>
<td class="warning"> warning </td>
<td class="danger"> danger </td>
</tr>
<tr>
<td> 3 </td>
<td class="active"> active </td>
<td class="success"> success </td>
<td class="warning"> warning </td>
<td class="danger"> danger </td>
</tr>
<tr>
<td> 4 </td>
<td class="active"> active </td>
<td class="success"> success </td>
<td class="warning"> warning </td>
<td class="danger"> danger </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
</div>
<div class="row">
<div class="col-md-6">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-bell-o"></i>Advance Table </div>
<div class="tools">
<a href="javascript:;" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="javascript:;" class="reload"> </a>
<a href="javascript:;" class="remove"> </a>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-striped table-bordered table-advance table-hover">
<thead>
<tr>
<th>
<i class="fa fa-briefcase"></i> Company </th>
<th class="hidden-xs">
<i class="fa fa-user"></i> Contact </th>
<th>
<i class="fa fa-shopping-cart"></i> Total </th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td class="highlight">
<div class="success"></div>
<a href="javascript:;"> RedBull </a>
</td>
<td class="hidden-xs"> Mike Nilson </td>
<td> 2560.60$ </td>
<td>
<a href="javascript:;" class="btn btn-outline btn-circle btn-sm purple">
<i class="fa fa-edit"></i> Edit </a>
</td>
</tr>
<tr>
<td class="highlight">
<div class="info"> </div>
<a href="javascript:;"> Google </a>
</td>
<td class="hidden-xs"> Adam Larson </td>
<td> 560.60$ </td>
<td>
<a href="javascript:;" class="btn btn-outline btn-circle dark btn-sm black">
<i class="fa fa-trash-o"></i> Delete </a>
</td>
</tr>
<tr>
<td class="highlight">
<div class="success"> </div>
<a href="javascript:;"> Apple </a>
</td>
<td class="hidden-xs"> Daniel Kim </td>
<td> 3460.60$ </td>
<td>
<a href="javascript:;" class="btn btn-outline btn-circle green btn-sm purple">
<i class="fa fa-edit"></i> Edit </a>
</td>
</tr>
<tr>
<td class="highlight">
<div class="warning"> </div>
<a href="javascript:;"> Microsoft </a>
</td>
<td class="hidden-xs"> Nick </td>
<td> 2560.60$ </td>
<td>
<a href="javascript:;" class="btn btn-outline btn-circle red btn-sm blue">
<i class="fa fa-share"></i> Share </a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
<div class="col-md-6">
<!-- BEGIN SAMPLE TABLE PORTLET-->
<div class="portlet">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-shopping-cart"></i>Advance Table </div>
<div class="tools">
<a href="javascript:;" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="javascript:;" class="reload"> </a>
<a href="javascript:;" class="remove"> </a>
</div>
</div>
<div class="portlet-body">
<div class="table-scrollable">
<table class="table table-striped table-bordered table-advance table-hover">
<thead>
<tr>
<th>
<i class="fa fa-briefcase"></i> From </th>
<th class="hidden-xs">
<i class="fa fa-question"></i> Descrition </th>
<th>
<i class="fa fa-bookmark"></i> Total </th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="javascript:;"> Pixel Ltd </a>
</td>
<td class="hidden-xs"> Server hardware purchase </td>
<td> 52560.10$
<span class="label label-sm label-success label-mini"> Paid </span>
</td>
<td>
<a href="javascript:;" class="btn dark btn-sm btn-outline sbold uppercase">
<i class="fa fa-share"></i> View </a>
</td>
</tr>
<tr>
<td>
<a href="javascript:;"> Smart House </a>
</td>
<td class="hidden-xs"> Office furniture purchase </td>
<td> 5760.00$
<span class="label label-sm label-warning label-mini"> Pending </span>
</td>
<td>
<a href="javascript:;" class="btn dark btn-sm btn-outline sbold uppercase">
<i class="fa fa-share"></i> View </a>
</td>
</tr>
<tr>
<td>
<a href="javascript:;"> FoodMaster Ltd </a>
</td>
<td class="hidden-xs"> Company Anual Dinner Catering </td>
<td> 12400.00$
<span class="label label-sm label-success label-mini"> Paid </span>
</td>
<td>
<a href="javascript:;" class="btn dark btn-sm btn-outline sbold uppercase">
<i class="fa fa-share"></i> View </a>
</td>
</tr>
<tr>
<td>
<a href="javascript:;"> WaterPure Ltd </a>
</td>
<td class="hidden-xs"> Payment for Jan 2013 </td>
<td> 610.50$
<span class="label label-sm label-danger label-mini"> Overdue </span>
</td>
<td>
<a href="javascript:;" class="btn dark btn-sm btn-outline sbold uppercase">
<i class="fa fa-share"></i> View </a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- END SAMPLE TABLE PORTLET-->
</div>
</div>
<!-- END PAGE BASE CONTENT -->
</div>
<!-- END CONTENT BODY -->
</div>
<!-- END CONTENT -->
<!-- BEGIN QUICK SIDEBAR -->
<a href="javascript:;" class="page-quick-sidebar-toggler">
<i class="icon-login"></i>
</a>
<div class="page-quick-sidebar-wrapper" data-close-on-body-click="false">
<div class="page-quick-sidebar">
<ul class="nav nav-tabs">
<li class="active">
<a href="javascript:;" data-target="#quick_sidebar_tab_1" data-toggle="tab"> Users
<span class="badge badge-danger">2</span>
</a>
</li>
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_2" data-toggle="tab"> Alerts
<span class="badge badge-success">7</span>
</a>
</li>
<li class="dropdown">
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown"> More
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right">
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-bell"></i> Alerts </a>
</li>
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-info"></i> Notifications </a>
</li>
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-speech"></i> Activities </a>
</li>
<li class="divider"></li>
<li>
<a href="javascript:;" data-target="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-settings"></i> Settings </a>
</li>
</ul>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active page-quick-sidebar-chat" id="quick_sidebar_tab_1">
<div class="page-quick-sidebar-chat-users" data-rail-color="#ddd" data-wrapper-class="page-quick-sidebar-list">
<h3 class="list-heading">Staff</h3>
<ul class="media-list list-items">
<li class="media">
<div class="media-status">
<span class="badge badge-success">8</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar3.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Bob Nilson</h4>
<div class="media-heading-sub"> Project Manager </div>
</div>
</li>
<li class="media">
<img class="media-object" src="../assets/layouts/layout/img/avatar1.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Nick Larson</h4>
<div class="media-heading-sub"> Art Director </div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-danger">3</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar4.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Deon Hubert</h4>
<div class="media-heading-sub"> CTO </div>
</div>
</li>
<li class="media">
<img class="media-object" src="../assets/layouts/layout/img/avatar2.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Ella Wong</h4>
<div class="media-heading-sub"> CEO </div>
</div>
</li>
</ul>
<h3 class="list-heading">Customers</h3>
<ul class="media-list list-items">
<li class="media">
<div class="media-status">
<span class="badge badge-warning">2</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar6.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Lara Kunis</h4>
<div class="media-heading-sub"> CEO, Loop Inc </div>
<div class="media-heading-small"> Last seen 03:10 AM </div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="label label-sm label-success">new</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar7.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Ernie Kyllonen</h4>
<div class="media-heading-sub"> Project Manager,
<br> SmartBizz PTL </div>
</div>
</li>
<li class="media">
<img class="media-object" src="../assets/layouts/layout/img/avatar8.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Lisa Stone</h4>
<div class="media-heading-sub"> CTO, Keort Inc </div>
<div class="media-heading-small"> Last seen 13:10 PM </div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-success">7</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar9.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Deon Portalatin</h4>
<div class="media-heading-sub"> CFO, H&D LTD </div>
</div>
</li>
<li class="media">
<img class="media-object" src="../assets/layouts/layout/img/avatar10.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Irina Savikova</h4>
<div class="media-heading-sub"> CEO, Tizda Motors Inc </div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-danger">4</span>
</div>
<img class="media-object" src="../assets/layouts/layout/img/avatar11.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Maria Gomez</h4>
<div class="media-heading-sub"> Manager, Infomatic Inc </div>
<div class="media-heading-small"> Last seen 03:10 AM </div>
</div>
</li>
</ul>
</div>
<div class="page-quick-sidebar-item">
<div class="page-quick-sidebar-chat-user">
<div class="page-quick-sidebar-nav">
<a href="javascript:;" class="page-quick-sidebar-back-to-list">
<i class="icon-arrow-left"></i>Back</a>
</div>
<div class="page-quick-sidebar-chat-user-messages">
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:15</span>
<span class="body"> When could you send me the report ? </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar2.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Ella Wong</a>
<span class="datetime">20:15</span>
<span class="body"> Its almost done. I will be sending it shortly </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:15</span>
<span class="body"> Alright. Thanks! :) </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar2.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Ella Wong</a>
<span class="datetime">20:16</span>
<span class="body"> You are most welcome. Sorry for the delay. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body"> No probs. Just take your time :) </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar2.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Ella Wong</a>
<span class="datetime">20:40</span>
<span class="body"> Alright. I just emailed it to you. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body"> Great! Thanks. Will check it right away. </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar2.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Ella Wong</a>
<span class="datetime">20:40</span>
<span class="body"> Please let me know if you have any comment. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../assets/layouts/layout/img/avatar3.jpg" />
<div class="message">
<span class="arrow"></span>
<a href="javascript:;" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body"> Sure. I will check and buzz you if anything needs to be corrected. </span>
</div>
</div>
</div>
<div class="page-quick-sidebar-chat-user-form">
<div class="input-group">
<input type="text" class="form-control" placeholder="Type a message here...">
<div class="input-group-btn">
<button type="button" class="btn green">
<i class="icon-paper-clip"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane page-quick-sidebar-alerts" id="quick_sidebar_tab_2">
<div class="page-quick-sidebar-alerts-list">
<h3 class="list-heading">General</h3>
<ul class="feeds list-items">
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-check"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 4 pending tasks.
<span class="label label-sm label-warning "> Take action
<i class="fa fa-share"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> Just now </div>
</div>
</li>
<li>
<a href="javascript:;">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-bar-chart-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> Finance Report for year 2013 has been released. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 20 mins </div>
</div>
</a>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-danger">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 5 pending membership that requires a quick review. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 24 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> New order received with
<span class="label label-sm label-success"> Reference Number: DR23923 </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 30 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 5 pending membership that requires a quick review. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 24 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-bell-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> Web server hardware needs to be upgraded.
<span class="label label-sm label-warning"> Overdue </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 2 hours </div>
</div>
</li>
<li>
<a href="javascript:;">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-default">
<i class="fa fa-briefcase"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> IPO Report for year 2013 has been released. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 20 mins </div>
</div>
</a>
</li>
</ul>
<h3 class="list-heading">System</h3>
<ul class="feeds list-items">
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-check"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 4 pending tasks.
<span class="label label-sm label-warning "> Take action
<i class="fa fa-share"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> Just now </div>
</div>
</li>
<li>
<a href="javascript:;">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-danger">
<i class="fa fa-bar-chart-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> Finance Report for year 2013 has been released. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 20 mins </div>
</div>
</a>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-default">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 5 pending membership that requires a quick review. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 24 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> New order received with
<span class="label label-sm label-success"> Reference Number: DR23923 </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 30 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> You have 5 pending membership that requires a quick review. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 24 mins </div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-warning">
<i class="fa fa-bell-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> Web server hardware needs to be upgraded.
<span class="label label-sm label-default "> Overdue </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 2 hours </div>
</div>
</li>
<li>
<a href="javascript:;">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-briefcase"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc"> IPO Report for year 2013 has been released. </div>
</div>
</div>
</div>
<div class="col2">
<div class="date"> 20 mins </div>
</div>
</a>
</li>
</ul>
</div>
</div>
<div class="tab-pane page-quick-sidebar-settings" id="quick_sidebar_tab_3">
<div class="page-quick-sidebar-settings-list">
<h3 class="list-heading">General Settings</h3>
<ul class="list-items borderless">
<li> Enable Notifications
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Allow Tracking
<input type="checkbox" class="make-switch" data-size="small" data-on-color="info" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Log Errors
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="danger" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Auto Sumbit Issues
<input type="checkbox" class="make-switch" data-size="small" data-on-color="warning" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Enable SMS Alerts
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
</ul>
<h3 class="list-heading">System Settings</h3>
<ul class="list-items borderless">
<li> Security Level
<select class="form-control input-inline input-sm input-small">
<option value="1">Normal</option>
<option value="2" selected>Medium</option>
<option value="e">High</option>
</select>
</li>
<li> Failed Email Attempts
<input class="form-control input-inline input-sm input-small" value="5" /> </li>
<li> Secondary SMTP Port
<input class="form-control input-inline input-sm input-small" value="3560" /> </li>
<li> Notify On System Error
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="danger" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
<li> Notify On SMTP Error
<input type="checkbox" class="make-switch" checked data-size="small" data-on-color="warning" data-on-text="ON" data-off-color="default" data-off-text="OFF"> </li>
</ul>
<div class="inner-content">
<button class="btn btn-success">
<i class="icon-settings"></i> Save Changes</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="page-footer">
<div class="page-footer-inner"> 2016 © Metronic Theme By
<a target="_blank" href="http://keenthemes.com">Keenthemes</a> |
<a href="http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes" title="Purchase Metronic just for 27$ and get lifetime updates for free" target="_blank">Purchase Metronic!</a>
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
</div>
<!-- END FOOTER -->
<!-- BEGIN QUICK NAV -->
<nav class="quick-nav">
<a class="quick-nav-trigger" href="#0">
<span aria-hidden="true"></span>
</a>
<ul>
<li>
<a href="https://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes" target="_blank" class="active">
<span>Purchase Metronic</span>
<i class="icon-basket"></i>
</a>
</li>
<li>
<a href="https://themeforest.net/item/metronic-responsive-admin-dashboard-template/reviews/4021469?ref=keenthemes" target="_blank">
<span>Customer Reviews</span>
<i class="icon-users"></i>
</a>
</li>
<li>
<a href="http://keenthemes.com/showcast/" target="_blank">
<span>Showcase</span>
<i class="icon-user"></i>
</a>
</li>
<li>
<a href="http://keenthemes.com/metronic-theme/changelog/" target="_blank">
<span>Changelog</span>
<i class="icon-graph"></i>
</a>
</li>
</ul>
<span aria-hidden="true" class="quick-nav-bg"></span>
</nav>
<div class="quick-nav-overlay"></div>
<!-- END QUICK NAV -->
<!--[if lt IE 9]>
<script src="../assets/global/plugins/respond.min.js"></script>
<script src="../assets/global/plugins/excanvas.min.js"></script>
<script src="../assets/global/plugins/ie8.fix.min.js"></script>
<![endif]-->
<!-- BEGIN CORE PLUGINS -->
<script src="../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/js.cookie.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN THEME GLOBAL SCRIPTS -->
<script src="../assets/global/scripts/app.min.js" type="text/javascript"></script>
<!-- END THEME GLOBAL SCRIPTS -->
<!-- BEGIN THEME LAYOUT SCRIPTS -->
<script src="../assets/layouts/layout4/scripts/layout.min.js" type="text/javascript"></script>
<script src="../assets/layouts/layout4/scripts/demo.min.js" type="text/javascript"></script>
<script src="../assets/layouts/global/scripts/quick-sidebar.min.js" type="text/javascript"></script>
<script src="../assets/layouts/global/scripts/quick-nav.min.js" type="text/javascript"></script>
<!-- END THEME LAYOUT SCRIPTS -->
</body>
</html>
|
FernandoUnix/AcessoRestrito
|
metronic_v4.7.1/theme/admin_4_rounded/table_static_basic.html
|
HTML
|
gpl-3.0
| 201,728 |
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
import base64, zlib, os
import util
class PlayerAvatar(QtWidgets.QDialog):
def __init__(self, users=[], idavatar=0, parent=None, *args, **kwargs):
QtWidgets.QDialog.__init__(self, *args, **kwargs)
self.parent = parent
self.users = users
self.checkBox = {}
self.idavatar = idavatar
self.setStyleSheet(self.parent.styleSheet())
self.grid = QtWidgets.QGridLayout(self)
self.userlist = None
self.removeButton = QtWidgets.QPushButton("&Remove users")
self.grid.addWidget(self.removeButton, 1, 0)
self.removeButton.clicked.connect(self.remove_them)
self.setWindowTitle("Users using this avatar")
self.resize(480, 320)
def process_list(self, users, idavatar):
self.checkBox = {}
self.users = users
self.idavatar = idavatar
self.userlist = self.create_user_selection()
self.grid.addWidget(self.userlist, 0, 0)
def remove_them(self):
for user in self.checkBox :
if self.checkBox[user].checkState() == 2:
self.parent.lobby_connection.send(dict(command="admin", action="remove_avatar", iduser=user, idavatar=self.idavatar))
self.close()
def create_user_selection(self):
groupBox = QtWidgets.QGroupBox("Select the users you want to remove this avatar :")
vbox = QtWidgets.QVBoxLayout()
for user in self.users:
self.checkBox[user["iduser"]] = QtWidgets.QCheckBox(user["login"])
vbox.addWidget(self.checkBox[user["iduser"]])
vbox.addStretch(1)
groupBox.setLayout(vbox)
return groupBox
class AvatarWidget(QtWidgets.QDialog):
def __init__(self, parent, user, personal=False, *args, **kwargs):
QtWidgets.QDialog.__init__(self, *args, **kwargs)
self.user = user
self.personal = personal
self.parent = parent
self.setStyleSheet(self.parent.styleSheet())
self.setWindowTitle("Avatar manager")
self.groupLayout = QtWidgets.QVBoxLayout(self)
self.avatarList = QtWidgets.QListWidget()
self.avatarList.setWrapping(1)
self.avatarList.setSpacing(5)
self.avatarList.setResizeMode(1)
self.groupLayout.addWidget(self.avatarList)
if not self.personal:
self.addAvatarButton = QtWidgets.QPushButton("Add/Edit avatar")
self.addAvatarButton.clicked.connect(self.add_avatar)
self.groupLayout.addWidget(self.addAvatarButton)
self.item = []
self.parent.lobby_info.avatarList.connect(self.avatar_list)
self.parent.lobby_info.playerAvatarList.connect(self.do_player_avatar_list)
self.playerList = PlayerAvatar(parent=self.parent)
self.nams = {}
self.avatars = {}
self.finished.connect(self.cleaning)
def showEvent(self, event):
self.parent.requestAvatars(self.personal)
def add_avatar(self):
options = QtWidgets.QFileDialog.Options()
options |= QtWidgets.QFileDialog.DontUseNativeDialog
fileName = QtWidgets.QFileDialog.getOpenFileName(self, "Select the PNG file", "", "png Files (*.png)", options)
if fileName:
# check the properties of that file
pixmap = QtGui.QPixmap(fileName)
if pixmap.height() == 20 and pixmap.width() == 40:
text, ok = QtWidgets.QInputDialog.getText(self, "Avatar description",
"Please enter the tooltip :", QtWidgets.QLineEdit.Normal, "")
if ok and text != '':
file = QtCore.QFile(fileName)
file.open(QtCore.QIODevice.ReadOnly)
fileDatas = base64.b64encode(zlib.compress(file.readAll()))
file.close()
self.parent.lobby_connection.send(dict(command="avatar", action="upload_avatar",
name=os.path.basename(fileName), description=text,
file=fileDatas))
else:
QtWidgets.QMessageBox.warning(self, "Bad image", "The image must be in png, format is 40x20 !")
def finish_request(self, reply):
if reply.url().toString() in self.avatars:
img = QtGui.QImage()
img.loadFromData(reply.readAll())
pix = QtGui.QPixmap(img)
self.avatars[reply.url().toString()].setIcon(QtGui.QIcon(pix))
self.avatars[reply.url().toString()].setIconSize(pix.rect().size())
util.addrespix(reply.url().toString(), QtGui.QPixmap(img))
def clicked(self):
self.doit(None)
self.close()
def create_connect(self, x):
return lambda: self.doit(x)
def doit(self, val):
if self.personal:
self.parent.lobby_connection.send(dict(command="avatar", action="select", avatar=val))
self.close()
else:
if self.user is None:
self.parent.lobby_connection.send(dict(command="admin", action="list_avatar_users", avatar=val))
else:
self.parent.lobby_connection.send(dict(command="admin", action="add_avatar", user=self.user, avatar=val))
self.close()
def do_player_avatar_list(self, message):
self.playerList = PlayerAvatar(parent=self.parent)
player_avatar_list = message["player_avatar_list"]
idavatar = message["avatar_id"]
self.playerList.process_list(player_avatar_list, idavatar)
self.playerList.show()
def avatar_list(self, avatar_list):
self.avatarList.clear()
button = QtWidgets.QPushButton()
self.avatars["None"] = button
item = QtWidgets.QListWidgetItem()
item.setSizeHint(QtCore.QSize(40,20))
self.item.append(item)
self.avatarList.addItem(item)
self.avatarList.setItemWidget(item, button)
button.clicked.connect(self.clicked)
for avatar in avatar_list:
avatarPix = util.respix(avatar["url"])
button = QtWidgets.QPushButton()
button.clicked.connect(self.create_connect(avatar["url"]))
item = QtWidgets.QListWidgetItem()
item.setSizeHint(QtCore.QSize(40, 20))
self.item.append(item)
self.avatarList.addItem(item)
button.setToolTip(avatar["tooltip"])
url = QtCore.QUrl(avatar["url"])
self.avatars[avatar["url"]] = button
self.avatarList.setItemWidget(item, self.avatars[avatar["url"]])
if not avatarPix:
self.nams[url] = QNetworkAccessManager(button)
self.nams[url].finished.connect(self.finish_request)
self.nams[url].get(QNetworkRequest(url))
else:
self.avatars[avatar["url"]].setIcon(QtGui.QIcon(avatarPix))
self.avatars[avatar["url"]].setIconSize(avatarPix.rect().size())
def cleaning(self):
if self != self.parent.avatarAdmin:
self.parent.lobby_info.avatarList.disconnect(self.avatar_list)
self.parent.lobby_info.playerAvatarList.disconnect(self.do_player_avatar_list)
|
GrotheFAF/client
|
src/chat/_avatarWidget.py
|
Python
|
gpl-3.0
| 7,457 |
/* EightyOne - A Windows ZX80/81/clone emulator.
* Copyright (C) 2003-2006 Michael D Wynne
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* zx81.h
*
*/
#ifndef ace_h
#define ace_h
#include <stdint.h>
#define kbD0 1
#define kbD1 2
#define kbD2 4
#define kbD3 8
#define kbD4 16
#define kbD5 32
#define kbA8 0
#define kbA9 1
#define kbA10 2
#define kbA11 3
#define kbA12 4
#define kbA13 5
#define kbA14 6
#define kbA15 7
#ifdef __cplusplus
extern "C" uint8_t memory[];
extern "C" void ace_initialise(void);
extern "C" int ace_do_scanline(void);
extern "C" void ace_writebyte(int Address, int Data);
extern "C" uint8_t ace_readbyte(int Address);
extern "C" uint8_t ace_opcode_fetch(int Address);
extern "C" void ace_writeport(int Address, int Data, int *tstates);
extern "C" uint8_t ace_readport(int Address, int *tstates);
extern "C" int tstates, event_next_event;
extern "C" int framepos, NMI_generator, HSYNC_generator, frametstates;
extern "C" uint8_t get_i_reg(void);
extern "C" uint8_t ZXKeyboard[];
extern "C" uint8_t scanline[];
extern "C" int scanline_len;
extern "C" int sync_len, sync_valid;
extern "C" int zx81_stop;
extern "C" int zx81_zx81_do_scanline();
extern "C" int ace_do_accurate();
extern "C" int ace_contend(int Address, int states, int time);
#else
extern uint8_t memory[];
extern uint8_t acecolour[];
extern void ace_initialise(void);
extern int ace_do_scanline(void);
extern void ace_writebyte(int Address, int Data);
extern uint8_t ace_readbyte(int Address);
extern uint8_t ace_opcode_fetch(int Address);
extern void ace_writeport(int Address, int Data, int *tstates);
extern uint8_t ace_readport(int Address, int *tstates);
extern int ace_contend(int Address, int states, int time);
extern int tstates, event_next_event;
extern int framepos, NMI_generator, HSYNC_generator, frametstates;
extern int zx81_stop;
extern uint8_t ZXKeyboard[];
extern uint8_t scanline[];
extern int scanline_len;
extern int sync_len, sync_valid;
extern int ace_do_accurate();
#endif
#endif
|
leiradel/81-libretro
|
81/Ace/ace.h
|
C
|
gpl-3.0
| 2,748 |
/*
* This file is part of EasyRPG Editor.
*
* EasyRPG Editor 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 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Editor 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 EasyRPG Editor. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "actor.h"
#include "skill.h"
#include "enemy.h"
#include "item.h"
#include "troop.h"
#include "terrain.h"
#include "attribute.h"
#include "state.h"
#include "animation.h"
#include "chipset.h"
#include "commonevent.h"
#include "class.h"
#include "battleranimation.h"
#include "switch.h"
#include "variable.h"
#include "project_data.h"
Q_DECLARE_METATYPE(lcf::rpg::Actor*)
Q_DECLARE_METATYPE(lcf::rpg::Skill*)
Q_DECLARE_METATYPE(lcf::rpg::Enemy*)
Q_DECLARE_METATYPE(lcf::rpg::Item*)
Q_DECLARE_METATYPE(lcf::rpg::Troop*)
Q_DECLARE_METATYPE(lcf::rpg::Terrain*)
Q_DECLARE_METATYPE(lcf::rpg::Attribute*)
Q_DECLARE_METATYPE(lcf::rpg::State*)
Q_DECLARE_METATYPE(lcf::rpg::Animation*)
Q_DECLARE_METATYPE(lcf::rpg::Chipset*)
Q_DECLARE_METATYPE(lcf::rpg::CommonEvent*)
Q_DECLARE_METATYPE(lcf::rpg::Class*)
Q_DECLARE_METATYPE(lcf::rpg::BattlerAnimation*)
Q_DECLARE_METATYPE(lcf::rpg::Switch*)
Q_DECLARE_METATYPE(lcf::rpg::Variable*)
class ActorWidget;
class SkillWidget;
class EnemyWidget;
class ItemWidget;
class EnemyGroupWidget;
class TerrainWidget;
class AttributeWidget;
class StateWidget;
class BattleAnimationWidget;
class ChipsetWidget;
class ClassWidget;
class BattleAnimation2Widget;
class CommonEventWidget;
class SwitchWidget;
class VariableWidget;
template<typename T>
class RpgReflect {};
template<>
class RpgReflect<lcf::rpg::Actor> {
public:
using widget_type = ActorWidget;
using model_type = ActorModel;
static std::vector<lcf::rpg::Actor>& items(lcf::rpg::Database& database) {
return database.actors;
}
};
template<>
class RpgReflect<lcf::rpg::Skill> {
public:
using widget_type = SkillWidget;
using model_type = SkillModel;
static std::vector<lcf::rpg::Skill>& items(lcf::rpg::Database& database) {
return database.skills;
}
};
template<>
class RpgReflect<lcf::rpg::Enemy> {
public:
using widget_type = EnemyWidget;
using model_type = EnemyModel;
static std::vector<lcf::rpg::Enemy>& items(lcf::rpg::Database& database) {
return database.enemies;
}
};
template<>
class RpgReflect<lcf::rpg::Item> {
public:
using widget_type = ItemWidget;
using model_type = ItemModel;
static std::vector<lcf::rpg::Item>& items(lcf::rpg::Database& database) {
return database.items;
}
};
template<>
class RpgReflect<lcf::rpg::Troop> {
public:
using widget_type = EnemyGroupWidget;
using model_type = TroopModel;
static std::vector<lcf::rpg::Troop>& items(lcf::rpg::Database& database) {
return database.troops;
}
};
template<>
class RpgReflect<lcf::rpg::Terrain> {
public:
using widget_type = TerrainWidget;
using model_type = TerrainModel;
static std::vector<lcf::rpg::Terrain>& items(lcf::rpg::Database& database) {
return database.terrains;
}
};
template<>
class RpgReflect<lcf::rpg::Attribute> {
public:
using widget_type = AttributeWidget;
using model_type = AttributeModel;
static std::vector<lcf::rpg::Attribute>& items(lcf::rpg::Database& database) {
return database.attributes;
}
};
template<>
class RpgReflect<lcf::rpg::State> {
public:
using widget_type = StateWidget;
using model_type = StateModel;
static std::vector<lcf::rpg::State>& items(lcf::rpg::Database& database) {
return database.states;
}
};
template<>
class RpgReflect<lcf::rpg::Animation> {
public:
using widget_type = BattleAnimationWidget;
using model_type = AnimationModel;
static std::vector<lcf::rpg::Animation>& items(lcf::rpg::Database& database) {
return database.animations;
}
};
template<>
class RpgReflect<lcf::rpg::Chipset> {
public:
using widget_type = ChipsetWidget;
using model_type = ChipsetModel;
static std::vector<lcf::rpg::Chipset>& items(lcf::rpg::Database& database) {
return database.chipsets;
}
};
template<>
class RpgReflect<lcf::rpg::CommonEvent> {
public:
using widget_type = CommonEventWidget;
using model_type = CommonEventModel;
static std::vector<lcf::rpg::CommonEvent>& items(lcf::rpg::Database& database) {
return database.commonevents;
}
};
template<>
class RpgReflect<lcf::rpg::Class> {
public:
using widget_type = ClassWidget;
using model_type = ClassModel;
static std::vector<lcf::rpg::Class>& items(lcf::rpg::Database& database) {
return database.classes;
}
};
template<>
class RpgReflect<lcf::rpg::BattlerAnimation> {
public:
using widget_type = BattleAnimation2Widget;
using model_type = BattlerAnimationModel;
static std::vector<lcf::rpg::BattlerAnimation>& items(lcf::rpg::Database& database) {
return database.battleranimations;
}
};
template<>
class RpgReflect<lcf::rpg::Switch> {
public:
using widget_type = SwitchWidget;
using model_type = SwitchModel;
static std::vector<lcf::rpg::Switch>& items(lcf::rpg::Database& database) {
return database.switches;
}
};
template<>
class RpgReflect<lcf::rpg::Variable> {
public:
using widget_type = VariableWidget;
using model_type = VariableModel;
static std::vector<lcf::rpg::Variable>& items(lcf::rpg::Database& database) {
return database.variables;
}
};
|
Ghabry/easyrpg-editor-qt
|
src/model/rpg_reflect.h
|
C
|
gpl-3.0
| 5,657 |
package adonai.diary_browser;
import java.util.Deque;
import java.util.LinkedList;
public class BrowseHistory implements DiaryWebView.PositionTracker {
private Deque<SavedPageInfo> savedPages = new LinkedList<>();
private boolean backRequested;
public void add(String url) {
try {
// обновляем страницу, а не загружаем новую. Запись в историю не нужна
// позицию устанавливаем в 0, т.к. нам не нужно пролистывание при обновлении
if (!isEmpty() && !backRequested && getUrl().equals(url)) {
savedPages.peek().position = 0;
return;
}
// убеждаемся, что это не результат нажатия кнопки "назад"
if (!backRequested) {
savedPages.push(new SavedPageInfo(url));
}
} finally {
backRequested = false;
}
}
public void moveBack() {
backRequested = true;
savedPages.pop();
}
public boolean hasPrevious() {
return savedPages.size() > 1;
}
public boolean isEmpty() {
return savedPages.isEmpty();
}
public String getUrl() {
return savedPages.peek().url;
}
@Override
public void savePosition(String url, int position) {
for(SavedPageInfo pInfo : savedPages) {
if(pInfo.url.equals(url)) {
pInfo.position = position;
return;
}
}
}
@Override
public int restorePosition(String url) {
for(SavedPageInfo pInfo : savedPages) {
if(pInfo.url.equals(url)) {
return pInfo.position;
}
}
return 0;
}
private class SavedPageInfo {
private String url;
private Integer position = 0;
public SavedPageInfo(String url) {
this.url = url;
}
}
}
|
maniak26/Diary.Ru-Client
|
src/main/java/adonai/diary_browser/BrowseHistory.java
|
Java
|
gpl-3.0
| 2,077 |
/****************************************************************************
**
** Copyright (C) 2020 Alexis Jeandet.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <coreplugin/dialogs/ioptionspage.h>
#include <QCoreApplication>
namespace MesonProjectManager {
namespace Internal {
class MesonTools;
class ToolsSettingsPage final : public Core::IOptionsPage
{
Q_DECLARE_TR_FUNCTIONS(MesonProjectManager::Internal::ToolsSettingsPage)
public:
ToolsSettingsPage();
};
} // namespace Internal
} // namespace MesonProjectManager
|
qtproject/qt-creator
|
src/plugins/mesonprojectmanager/settings/tools/toolssettingspage.h
|
C
|
gpl-3.0
| 1,586 |
#include "QOrderTouchWidget.h"
#include <QDesktopWidget>
#include <QPainter>
#include <QtEvents>
#include <QLangManager.h>
#include <QApplication>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
#define MAKR_RADIUS 50
QOrderTouchWidget::QOrderTouchWidget(QWidget *parent) :
QWidget(parent)
{
if( parent )
setFont( parent->font() );
setFocusPolicy( Qt::StrongFocus );
setMouseTracking( true );
setWindowFlags( Qt::Popup | Qt::FramelessWindowHint );
m_bShowMark = false;
m_bOnScreen = false;
m_bTouch = false;
m_bFlickerMark = false;
m_nPercent = 0;
m_nTimerFlickerMark = 0;
m_bHideCursor = false;
QPixmap pmpArrow( ":/T3kCfgRes/resources/PNG_DIAGONAL_ARROW.png" );
int nW = pmpArrow.width()/4;
int nH = pmpArrow.height();
for( int i=0; i<4; i++ )
m_ArrowImage[i] = pmpArrow.copy( i*nW, 0, nW, nH );
}
QOrderTouchWidget::~QOrderTouchWidget()
{
if( m_nTimerFlickerMark )
{
killTimer( m_nTimerFlickerMark );
m_nTimerFlickerMark = 0;
}
if( m_bHideCursor )
QApplication::restoreOverrideCursor();
}
void QOrderTouchWidget::Init()
{
QDesktopWidget DeskWidget;
int nPrimary = DeskWidget.primaryScreen();
const QRect rcPrimaryMon = DeskWidget.screenGeometry( nPrimary );
setGeometry( rcPrimaryMon );
setWindowOpacity( 1.0 );
#ifdef Q_OS_WIN
SetWindowPos( (HWND)winId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE );
SetForegroundWindow( (HWND)winId() );
#else
raise();
activateWindow();
#endif
#ifdef Q_OS_MAC
cursor().setPos( rcPrimaryMon.center() );
#endif
}
void QOrderTouchWidget::paintEvent(QPaintEvent *)
{
QPainter dc;
dc.begin( this );
dc.fillRect( 0, 0, width(), height(), Qt::white );
int nW = width();
int nH = height();
int nStepW = nW / 50 + 1;
int nStepH = nH / 50 + 1;
QPen penGrid( QBrush(QColor(220, 220, 220, 128)) ,2.f, Qt::DashLine );
dc.setPen( penGrid );
for( int i=1; i<nStepW; i++ )
dc.drawLine( i*50, 0, i*50, nH );
for( int i=1; i<nStepH; i++ )
dc.drawLine( 0, i*50, nW, i*50 );
dc.setRenderHint( QPainter::Antialiasing );
if( m_bShowMark )
{
if( m_bOnScreen )
{
if( m_bTouch )
{
QPen penTouchOK( QBrush(QColor(140, 140, 140)) ,5.f, Qt::SolidLine );
dc.setPen( penTouchOK );
}
else
{
if( m_bFlickerMark )
{
QPen penEllipse( QColor(230, 230, 230) );
penEllipse.setWidthF( 20.f );
dc.setPen( penEllipse );
dc.drawEllipse( m_ptOrder, 30, 30 );
QPen penActive( QColor(255, 50, 50) );
penActive.setWidthF( 3.f );
dc.setPen( penActive );
}
else
{
QPen penCross( QBrush(QColor(200,200,200,128)), 3.f, Qt::DashLine );
dc.setPen( penCross );
}
}
if( !m_bTouch && m_nPercent > 0 && m_nPercent <= 100 )
{
const QPen oldPen = dc.pen();
QRectF rc( m_ptOrder.x()-40, m_ptOrder.y()-40, 80, 80 );
QPen penArc( QColor(240,220,220,128) );
dc.setPen( penArc );
qreal nAngle = (3.6*m_nPercent);
QPainterPath ArcProgPath;
ArcProgPath.moveTo( rc.center().x(), rc.top() );
ArcProgPath.arcTo( rc, 90, -nAngle );
ArcProgPath.lineTo( rc.center().x(), rc.center().y() );
//ArcProgPath.lineTo( rc.center().x(), rc.top() );
QRectF rcIner( rc.center().x()-20, rc.center().y()-20, 40, 40 );
ArcProgPath.arcTo( rcIner, 90, -nAngle );
ArcProgPath.lineTo( rcIner.center().x(), rcIner.center().y() );
ArcProgPath.lineTo( rc.center().x(), rc.top() );
ArcProgPath.closeSubpath();
dc.fillPath( ArcProgPath, QBrush(QColor(240,128,128,200)) );
dc.drawPath( ArcProgPath );
dc.setPen( oldPen );
}
dc.drawLine( m_ptOrder.x()-MAKR_RADIUS, m_ptOrder.y(), m_ptOrder.x()+MAKR_RADIUS, m_ptOrder.y() );
dc.drawLine( m_ptOrder.x(), m_ptOrder.y()-MAKR_RADIUS, m_ptOrder.x(), m_ptOrder.y()+MAKR_RADIUS );
}
else
{
Q_ASSERT( (m_ptOrder.x() == 0 || m_ptOrder.x() == 1) || (m_ptOrder.y() == 0 || m_ptOrder.y() == 1) );
int nIdx = (m_ptOrder.x()*2) + (m_ptOrder.y()*1);
if( m_bFlickerMark )
{
dc.drawPixmap( (width() * m_ptOrder.x()) - m_ptOrder.x() * m_ArrowImage[nIdx].width(),
(height() * m_ptOrder.y()) - m_ptOrder.y() * m_ArrowImage[nIdx].height(),
m_ArrowImage[nIdx].width(), m_ArrowImage[nIdx].height(), m_ArrowImage[nIdx] );
}
}
}
QPen penNomal( Qt::darkGray );
dc.setPen( penNomal );
QLangRes& Res = QLangManager::instance()->getResource();
QString str;
if( m_bOnScreen )
str = Res.getResString( QString::fromUtf8("ASSISTANCE"), QString::fromUtf8("TEXT_HELP_MSG") );
else
str = Res.getResString( QString::fromUtf8("ASSISTANCE"), QString::fromUtf8("TEXT_HELP_ARROW") );
QFont ft( font() );
ft.setPointSize( ft.pointSize()*2 );
ft.setWeight( QFont::Bold );
dc.setFont( ft );
QFontMetrics fm( ft );
int nX = width() / 2 - fm.width( str ) / 2;
int nY = height() / 2 - fm.height() / 2;
dc.setRenderHint( QPainter::TextAntialiasing );
dc.drawText( nX, nY, str );
dc.end();
}
void QOrderTouchWidget::timerEvent(QTimerEvent *evt)
{
if( evt->timerId() == m_nTimerFlickerMark )
{
m_bFlickerMark = !m_bFlickerMark;
QRect rc;
int nUpdateRadius = MAKR_RADIUS+10;
if( m_bOnScreen )
rc.setRect( m_ptOrder.x()-nUpdateRadius, m_ptOrder.y()-nUpdateRadius, nUpdateRadius*2, nUpdateRadius*2 );
else
rc.setRect( (width() * m_ptOrder.x()) - m_ptOrder.x() * 100,
(height() * m_ptOrder.y()) - m_ptOrder.y() * 100, 100, 100 );
update( rc );
}
QWidget::timerEvent(evt);
}
void QOrderTouchWidget::hideEvent(QHideEvent *evt)
{
if( m_nTimerFlickerMark )
{
killTimer( m_nTimerFlickerMark );
m_nTimerFlickerMark = 0;
}
if( m_bHideCursor )
{
m_bHideCursor = false;
QApplication::restoreOverrideCursor();
}
QWidget::hideEvent(evt);
}
void QOrderTouchWidget::onOrderTouch(bool bShowMark, bool bOnScreen, bool bTouch, short nX, short nY, int nPercent)
{
m_bShowMark = bShowMark;
m_bOnScreen = bOnScreen;
m_bTouch = bTouch;
m_nPercent = nPercent;
if( m_bShowMark )
{
if( !m_nTimerFlickerMark )
m_nTimerFlickerMark = startTimer( 300 );
show();
if( !m_bHideCursor )
{
m_bHideCursor = true;
QApplication::setOverrideCursor(QCursor(QPixmap(":/T3kCfgRes/resources/PNG_NULL_CURSOR.png")));
}
}
else
{
hide();
return;
}
int nW = width();
int nH = height();
int nUpdateRadius = MAKR_RADIUS+10;
QRect rcOld;
if( m_bOnScreen )
rcOld.setRect( m_ptOrder.x()-nUpdateRadius, m_ptOrder.y()-nUpdateRadius, nUpdateRadius*2, nUpdateRadius*2 );
else
rcOld.setRect( (width() * m_ptOrder.x()) - m_ptOrder.x() * 100,
(height() * m_ptOrder.y()) - m_ptOrder.y() * 100, 100, 100 );
if( m_bOnScreen )
{
m_ptOrder.setX( (int)((double)(nX * nW) / 32767.f + .5f) );
m_ptOrder.setY( (int)((double)(nY * nH) / 32767.f + .5f) );
}
else
{
m_ptOrder.setX( nX );
m_ptOrder.setY( nY );
}
QRect rc;
if( m_bOnScreen )
rc.setRect( m_ptOrder.x()-nUpdateRadius, m_ptOrder.y()-nUpdateRadius, nUpdateRadius*2, nUpdateRadius*2 );
else
rc.setRect( (width() * m_ptOrder.x()) - m_ptOrder.x() * 100,
(height() * m_ptOrder.y()) - m_ptOrder.y() * 100, 100, 100 );
update( rcOld );
update( rc );
}
|
windnsoul/habilience-t3ksensor-tools
|
T3kCfg/QOrderTouchWidget.cpp
|
C++
|
gpl-3.0
| 8,640 |
/**
* Copyright (c) 2002-2013 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j 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 3 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, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.kernel.impl.nioneo.store;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.neo4j.kernel.IdGeneratorFactory;
import org.neo4j.kernel.IdType;
/**
* Implementation of the relationship store.
*/
public class RelationshipStore extends AbstractStore implements Store
{
public static final String TYPE_DESCRIPTOR = "RelationshipStore";
// record header size
// directed|in_use(byte)+first_node(int)+second_node(int)+rel_type(int)+
// first_prev_rel_id(int)+first_next_rel_id+second_prev_rel_id(int)+
// second_next_rel_id+next_prop_id(int)
public static final int RECORD_SIZE = 33;
/**
* See {@link AbstractStore#AbstractStore(String, Map)}
*/
public RelationshipStore( String fileName, Map<?,?> config )
{
super( fileName, config, IdType.RELATIONSHIP );
}
public String getTypeDescriptor()
{
return TYPE_DESCRIPTOR;
}
public int getRecordSize()
{
return RECORD_SIZE;
}
@Override
public void close()
{
super.close();
}
/**
* Creates a new relationship store contained in <CODE>fileName</CODE> If
* filename is <CODE>null</CODE> or the file already exists an <CODE>IOException</CODE>
* is thrown.
*
* @param fileName
* File name of the new relationship store
* @throws IOException
* If unable to create relationship store or name null
*/
public static void createStore( String fileName, IdGeneratorFactory idGeneratorFactory )
{
createEmptyStore( fileName, buildTypeDescriptorAndVersion( TYPE_DESCRIPTOR ), idGeneratorFactory );
}
public RelationshipRecord getRecord( long id )
{
PersistenceWindow window = acquireWindow( id, OperationType.READ );
try
{
RelationshipRecord record = getRecord( id, window, false );
return record;
}
finally
{
releaseWindow( window );
}
}
public RelationshipRecord getLightRel( long id )
{
PersistenceWindow window = null;
try
{
window = acquireWindow( id, OperationType.READ );
}
catch ( InvalidRecordException e )
{
// ok to high id
return null;
}
try
{
RelationshipRecord record = getRecord( id, window, true );
return record;
}
finally
{
releaseWindow( window );
}
}
public void updateRecord( RelationshipRecord record, boolean recovered )
{
assert recovered;
setRecovered();
try
{
updateRecord( record );
registerIdFromUpdateRecord( record.getId() );
}
finally
{
unsetRecovered();
}
}
public void updateRecord( RelationshipRecord record )
{
PersistenceWindow window = acquireWindow( record.getId(),
OperationType.WRITE );
try
{
updateRecord( record, window );
}
finally
{
releaseWindow( window );
}
}
private void updateRecord( RelationshipRecord record,
PersistenceWindow window )
{
long id = record.getId();
Buffer buffer = window.getOffsettedBuffer( id );
if ( record.inUse() )
{
long firstNode = record.getFirstNode();
short firstNodeMod = (short)((firstNode & 0x700000000L) >> 31);
long secondNode = record.getSecondNode();
long secondNodeMod = (secondNode & 0x700000000L) >> 4;
long firstPrevRel = record.getFirstPrevRel();
long firstPrevRelMod = firstPrevRel == Record.NO_NEXT_RELATIONSHIP.intValue() ? 0 : (firstPrevRel & 0x700000000L) >> 7;
long firstNextRel = record.getFirstNextRel();
long firstNextRelMod = firstNextRel == Record.NO_NEXT_RELATIONSHIP.intValue() ? 0 : (firstNextRel & 0x700000000L) >> 10;
long secondPrevRel = record.getSecondPrevRel();
long secondPrevRelMod = secondPrevRel == Record.NO_NEXT_RELATIONSHIP.intValue() ? 0 : (secondPrevRel & 0x700000000L) >> 13;
long secondNextRel = record.getSecondNextRel();
long secondNextRelMod = secondNextRel == Record.NO_NEXT_RELATIONSHIP.intValue() ? 0 : (secondNextRel & 0x700000000L) >> 16;
long nextProp = record.getNextProp();
long nextPropMod = nextProp == Record.NO_NEXT_PROPERTY.intValue() ? 0 : (nextProp & 0xF00000000L) >> 28;
// [ , x] in use flag
// [ ,xxx ] first node high order bits
// [xxxx, ] next prop high order bits
short inUseUnsignedByte = (short)(Record.IN_USE.byteValue() | firstNodeMod | nextPropMod);
// [ xxx, ][ , ][ , ][ , ] second node high order bits, 0x70000000
// [ ,xxx ][ , ][ , ][ , ] first prev rel high order bits, 0xE000000
// [ , x][xx , ][ , ][ , ] first next rel high order bits, 0x1C00000
// [ , ][ xx,x ][ , ][ , ] second prev rel high order bits, 0x380000
// [ , ][ , xxx][ , ][ , ] second next rel high order bits, 0x70000
// [ , ][ , ][xxxx,xxxx][xxxx,xxxx] type
int typeInt = (int)(record.getType() | secondNodeMod | firstPrevRelMod | firstNextRelMod | secondPrevRelMod | secondNextRelMod);
buffer.put( (byte)inUseUnsignedByte ).putInt( (int) firstNode ).putInt( (int) secondNode )
.putInt( typeInt ).putInt( (int) firstPrevRel ).putInt( (int) firstNextRel )
.putInt( (int) secondPrevRel ).putInt( (int) secondNextRel ).putInt( (int) nextProp );
}
else
{
buffer.put( Record.NOT_IN_USE.byteValue() );
if ( !isInRecoveryMode() )
{
freeId( id );
}
}
}
private RelationshipRecord getRecord( long id, PersistenceWindow window,
boolean checkInUse )
{
Buffer buffer = window.getOffsettedBuffer( id );
// [ , x] in use flag
// [ ,xxx ] first node high order bits
// [xxxx, ] next prop high order bits
long inUseByte = buffer.get();
boolean inUse = (inUseByte & 0x1) == Record.IN_USE.intValue();
if ( !inUse )
{
if ( checkInUse )
{
return null;
}
throw new InvalidRecordException( "Record[" + id + "] not in use" );
}
long firstNode = buffer.getUnsignedInt();
long firstNodeMod = (inUseByte & 0xEL) << 31;
long secondNode = buffer.getUnsignedInt();
// [ xxx, ][ , ][ , ][ , ] second node high order bits, 0x70000000
// [ ,xxx ][ , ][ , ][ , ] first prev rel high order bits, 0xE000000
// [ , x][xx , ][ , ][ , ] first next rel high order bits, 0x1C00000
// [ , ][ xx,x ][ , ][ , ] second prev rel high order bits, 0x380000
// [ , ][ , xxx][ , ][ , ] second next rel high order bits, 0x70000
// [ , ][ , ][xxxx,xxxx][xxxx,xxxx] type
long typeInt = buffer.getInt();
long secondNodeMod = (typeInt & 0x70000000L) << 4;
int type = (int)(typeInt & 0xFFFF);
RelationshipRecord record = new RelationshipRecord( id,
longFromIntAndMod( firstNode, firstNodeMod ),
longFromIntAndMod( secondNode, secondNodeMod ), type );
record.setInUse( inUse );
long firstPrevRel = buffer.getUnsignedInt();
long firstPrevRelMod = (typeInt & 0xE000000L) << 7;
record.setFirstPrevRel( longFromIntAndMod( firstPrevRel, firstPrevRelMod ) );
long firstNextRel = buffer.getUnsignedInt();
long firstNextRelMod = (typeInt & 0x1C00000L) << 10;
record.setFirstNextRel( longFromIntAndMod( firstNextRel, firstNextRelMod ) );
long secondPrevRel = buffer.getUnsignedInt();
long secondPrevRelMod = (typeInt & 0x380000L) << 13;
record.setSecondPrevRel( longFromIntAndMod( secondPrevRel, secondPrevRelMod ) );
long secondNextRel = buffer.getUnsignedInt();
long secondNextRelMod = (typeInt & 0x70000L) << 16;
record.setSecondNextRel( longFromIntAndMod( secondNextRel, secondNextRelMod ) );
long nextProp = buffer.getUnsignedInt();
long nextPropMod = (inUseByte & 0xF0L) << 28;
record.setNextProp( longFromIntAndMod( nextProp, nextPropMod ) );
return record;
}
// private RelationshipRecord getFullRecord( long id, PersistenceWindow window )
// {
// Buffer buffer = window.getOffsettedBuffer( id );
// byte inUse = buffer.get();
// boolean inUseFlag = ((inUse & Record.IN_USE.byteValue()) ==
// Record.IN_USE.byteValue());
// RelationshipRecord record = new RelationshipRecord( id,
// buffer.getInt(), buffer.getInt(), buffer.getInt() );
// record.setInUse( inUseFlag );
// record.setFirstPrevRel( buffer.getInt() );
// record.setFirstNextRel( buffer.getInt() );
// record.setSecondPrevRel( buffer.getInt() );
// record.setSecondNextRel( buffer.getInt() );
// record.setNextProp( buffer.getInt() );
// return record;
// }
public String toString()
{
return "RelStore";
}
public RelationshipRecord getChainRecord( long relId )
{
PersistenceWindow window = null;
try
{
window = acquireWindow( relId, OperationType.READ );
}
catch ( InvalidRecordException e )
{
// ok to high id
return null;
}
try
{
// return getFullRecord( relId, window );
return getRecord( relId, window, false );
}
finally
{
releaseWindow( window );
}
}
public List<WindowPoolStats> getAllWindowPoolStats()
{
List<WindowPoolStats> list = new ArrayList<WindowPoolStats>();
list.add( getWindowPoolStats() );
return list;
}
}
|
neo4j-contrib/neo4j-mobile-android
|
neo4j-android/kernel-src/org/neo4j/kernel/impl/nioneo/store/RelationshipStore.java
|
Java
|
gpl-3.0
| 11,451 |
TARGET = csw
$(TARGET):
include makedefs
HDRS = cswdefs.h cswext.h cswitf.h wrapper.h
SPICE_VERSION = SPICE_3f
include ../Make2
|
logical/Gnucap-Emscripten
|
models-spice3f5/csw/Makefile
|
Makefile
|
gpl-3.0
| 136 |
/* stb_image - v2.06 - public domain image loader - http://nothings.org/stb_image.h
no warranty implied; use at your own risk
Do this:
#define STB_IMAGE_IMPLEMENTATION
before you include this file in *one* C or C++ file to create the implementation.
// i.e. it should look like this:
#include ...
#include ...
#include ...
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
You can #define STBI_ASSERT(x) before the #include to avoid using assert.h.
And #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free
QUICK NOTES:
Primarily of interest to game developers and other people who can
avoid problematic images and only need the trivial interface
JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib)
PNG 1/2/4/8-bit-per-channel (16 bpc not supported)
TGA (not sure what subset, if a subset)
BMP non-1bpp, non-RLE
PSD (composited view only, no extra channels)
GIF (*comp always reports as 4-channel)
HDR (radiance rgbE format)
PIC (Softimage PIC)
PNM (PPM and PGM binary only)
- decode from memory or through FILE (define STBI_NO_STDIO to remove code)
- decode from arbitrary I/O callbacks
- SIMD acceleration on x86/x64 (SSE2) and ARM (NEON)
Full documentation under "DOCUMENTATION" below.
Revision 2.00 release notes:
- Progressive JPEG is now supported.
- PPM and PGM binary formats are now supported, thanks to Ken Miller.
- x86 platforms now make use of SSE2 SIMD instructions for
JPEG decoding, and ARM platforms can use NEON SIMD if requested.
This work was done by Fabian "ryg" Giesen. SSE2 is used by
default, but NEON must be enabled explicitly; see docs.
With other JPEG optimizations included in this version, we see
2x speedup on a JPEG on an x86 machine, and a 1.5x speedup
on a JPEG on an ARM machine, relative to previous versions of this
library. The same results will not obtain for all JPGs and for all
x86/ARM machines. (Note that progressive JPEGs are significantly
slower to decode than regular JPEGs.) This doesn't mean that this
is the fastest JPEG decoder in the land; rather, it brings it
closer to parity with standard libraries. If you want the fastest
decode, look elsewhere. (See "Philosophy" section of docs below.)
See final bullet items below for more info on SIMD.
- Added STBI_MALLOC, STBI_REALLOC, and STBI_FREE macros for replacing
the memory allocator. Unlike other STBI libraries, these macros don't
support a context parameter, so if you need to pass a context in to
the allocator, you'll have to store it in a global or a thread-local
variable.
- Split existing STBI_NO_HDR flag into two flags, STBI_NO_HDR and
STBI_NO_LINEAR.
STBI_NO_HDR: suppress implementation of .hdr reader format
STBI_NO_LINEAR: suppress high-dynamic-range light-linear float API
- You can suppress implementation of any of the decoders to reduce
your code footprint by #defining one or more of the following
symbols before creating the implementation.
STBI_NO_JPEG
STBI_NO_PNG
STBI_NO_BMP
STBI_NO_PSD
STBI_NO_TGA
STBI_NO_GIF
STBI_NO_HDR
STBI_NO_PIC
STBI_NO_PNM (.ppm and .pgm)
- You can request *only* certain decoders and suppress all other ones
(this will be more forward-compatible, as addition of new decoders
doesn't require you to disable them explicitly):
STBI_ONLY_JPEG
STBI_ONLY_PNG
STBI_ONLY_BMP
STBI_ONLY_PSD
STBI_ONLY_TGA
STBI_ONLY_GIF
STBI_ONLY_HDR
STBI_ONLY_PIC
STBI_ONLY_PNM (.ppm and .pgm)
Note that you can define multiples of these, and you will get all
of them ("only x" and "only y" is interpreted to mean "only x&y").
- If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still
want the zlib decoder to be available, #define STBI_SUPPORT_ZLIB
- Compilation of all SIMD code can be suppressed with
#define STBI_NO_SIMD
It should not be necessary to disable SIMD unless you have issues
compiling (e.g. using an x86 compiler which doesn't support SSE
intrinsics or that doesn't support the method used to detect
SSE2 support at run-time), and even those can be reported as
bugs so I can refine the built-in compile-time checking to be
smarter.
- The old STBI_SIMD system which allowed installing a user-defined
IDCT etc. has been removed. If you need this, don't upgrade. My
assumption is that almost nobody was doing this, and those who
were will find the built-in SIMD more satisfactory anyway.
- RGB values computed for JPEG images are slightly different from
previous versions of stb_image. (This is due to using less
integer precision in SIMD.) The C code has been adjusted so
that the same RGB values will be computed regardless of whether
SIMD support is available, so your app should always produce
consistent results. But these results are slightly different from
previous versions. (Specifically, about 3% of available YCbCr values
will compute different RGB results from pre-1.49 versions by +-1;
most of the deviating values are one smaller in the G channel.)
- If you must produce consistent results with previous versions of
stb_image, #define STBI_JPEG_OLD and you will get the same results
you used to; however, you will not get the SIMD speedups for
the YCbCr-to-RGB conversion step (although you should still see
significant JPEG speedup from the other changes).
Please note that STBI_JPEG_OLD is a temporary feature; it will be
removed in future versions of the library. It is only intended for
near-term back-compatibility use.
Latest revision history:
2.06 (2015-04-19) fix bug where PSD returns wrong '*comp' value
2.05 (2015-04-19) fix bug in progressive JPEG handling, fix warning
2.04 (2015-04-15) try to re-enable SIMD on MinGW 64-bit
2.03 (2015-04-12) additional corruption checking
stbi_set_flip_vertically_on_load
fix NEON support; fix mingw support
2.02 (2015-01-19) fix incorrect assert, fix warning
2.01 (2015-01-17) fix various warnings
2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG
2.00 (2014-12-25) optimize JPEG, including x86 SSE2 & ARM NEON SIMD
progressive JPEG
PGM/PPM support
STBI_MALLOC,STBI_REALLOC,STBI_FREE
STBI_NO_*, STBI_ONLY_*
GIF bugfix
1.48 (2014-12-14) fix incorrectly-named assert()
1.47 (2014-12-14) 1/2/4-bit PNG support (both grayscale and paletted)
optimize PNG
fix bug in interlaced PNG with user-specified channel count
See end of file for full revision history.
============================ Contributors =========================
Image formats Bug fixes & warning fixes
Sean Barrett (jpeg, png, bmp) Marc LeBlanc
Nicolas Schulz (hdr, psd) Christpher Lloyd
Jonathan Dummer (tga) Dave Moore
Jean-Marc Lienher (gif) Won Chun
Tom Seddon (pic) the Horde3D community
Thatcher Ulrich (psd) Janez Zemva
Ken Miller (pgm, ppm) Jonathan Blow
Laurent Gomila
Aruelien Pocheville
Extensions, features Ryamond Barbiero
Jetro Lauha (stbi_info) David Woo
Martin "SpartanJ" Golini (stbi_info) Martin Golini
James "moose2000" Brown (iPhone PNG) Roy Eltham
Ben "Disch" Wenger (io callbacks) Luke Graham
Omar Cornut (1/2/4-bit PNG) Thomas Ruf
Nicolas Guillemot (vertical flip) John Bartholomew
Ken Hamada
Optimizations & bugfixes Cort Stratton
Fabian "ryg" Giesen Blazej Dariusz Roszkowski
Arseny Kapoulkine Thibault Reuille
Paul Du Bois
Guillaume George
If your name should be here but Jerry Jansson
isn't, let Sean know. Hayaki Saito
Johan Duparc
Ronny Chevalier
Michal Cichon
Tero Hanninen
Sergio Gonzalez
Cass Everitt
Engin Manap
Martins Mozeiko
Joseph Thomson
Phil Jordan
License:
This software is in the public domain. Where that dedication is not
recognized, you are granted a perpetual, irrevocable license to copy
and modify this file however you want.
*/
#ifndef STBI_INCLUDE_STB_IMAGE_H
#define STBI_INCLUDE_STB_IMAGE_H
// DOCUMENTATION
//
// Limitations:
// - no 16-bit-per-channel PNG
// - no 12-bit-per-channel JPEG
// - no JPEGs with arithmetic coding
// - no 1-bit BMP
// - GIF always returns *comp=4
//
// Basic usage (see HDR discussion below for HDR usage):
// int x,y,n;
// unsigned char *data = stbi_load(filename, &x, &y, &n, 0);
// // ... process data if not NULL ...
// // ... x = width, y = height, n = # 8-bit components per pixel ...
// // ... replace '0' with '1'..'4' to force that many components per pixel
// // ... but 'n' will always be the number that it would have been if you said 0
// stbi_image_free(data)
//
// Standard parameters:
// int *x -- outputs image width in pixels
// int *y -- outputs image height in pixels
// int *comp -- outputs # of image components in image file
// int req_comp -- if non-zero, # of image components requested in result
//
// The return value from an image loader is an 'unsigned char *' which points
// to the pixel data, or NULL on an allocation failure or if the image is
// corrupt or invalid. The pixel data consists of *y scanlines of *x pixels,
// with each pixel consisting of N interleaved 8-bit components; the first
// pixel pointed to is top-left-most in the image. There is no padding between
// image scanlines or between pixels, regardless of format. The number of
// components N is 'req_comp' if req_comp is non-zero, or *comp otherwise.
// If req_comp is non-zero, *comp has the number of components that _would_
// have been output otherwise. E.g. if you set req_comp to 4, you will always
// get RGBA output, but you can check *comp to see if it's trivially opaque
// because e.g. there were only 3 channels in the source image.
//
// An output image with N components has the following components interleaved
// in this order in each pixel:
//
// N=#comp components
// 1 grey
// 2 grey, alpha
// 3 red, green, blue
// 4 red, green, blue, alpha
//
// If image loading fails for any reason, the return value will be NULL,
// and *x, *y, *comp will be unchanged. The function stbi_failure_reason()
// can be queried for an extremely brief, end-user unfriendly explanation
// of why the load failed. Define STBI_NO_FAILURE_STRINGS to avoid
// compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly
// more user-friendly ones.
//
// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized.
//
// ===========================================================================
//
// Philosophy
//
// stb libraries are designed with the following priorities:
//
// 1. easy to use
// 2. easy to maintain
// 3. good performance
//
// Sometimes I let "good performance" creep up in priority over "easy to maintain",
// and for best performance I may provide less-easy-to-use APIs that give higher
// performance, in addition to the easy to use ones. Nevertheless, it's important
// to keep in mind that from the standpoint of you, a client of this library,
// all you care about is #1 and #3, and stb libraries do not emphasize #3 above all.
//
// Some secondary priorities arise directly from the first two, some of which
// make more explicit reasons why performance can't be emphasized.
//
// - Portable ("ease of use")
// - Small footprint ("easy to maintain")
// - No dependencies ("ease of use")
//
// ===========================================================================
//
// I/O callbacks
//
// I/O callbacks allow you to read from arbitrary sources, like packaged
// files or some other source. Data read from callbacks are processed
// through a small internal buffer (currently 128 bytes) to try to reduce
// overhead.
//
// The three functions you must define are "read" (reads some bytes of data),
// "skip" (skips some bytes of data), "eof" (reports if the stream is at the end).
//
// ===========================================================================
//
// SIMD support
//
// The JPEG decoder will try to automatically use SIMD kernels on x86 when
// supported by the compiler. For ARM Neon support, you must explicitly
// request it.
//
// (The old do-it-yourself SIMD API is no longer supported in the current
// code.)
//
// On x86, SSE2 will automatically be used when available based on a run-time
// test; if not, the generic C versions are used as a fall-back. On ARM targets,
// the typical path is to have separate builds for NEON and non-NEON devices
// (at least this is true for iOS and Android). Therefore, the NEON support is
// toggled by a build flag: define STBI_NEON to get NEON loops.
//
// The output of the JPEG decoder is slightly different from versions where
// SIMD support was introduced (that is, for versions before 1.49). The
// difference is only +-1 in the 8-bit RGB channels, and only on a small
// fraction of pixels. You can force the pre-1.49 behavior by defining
// STBI_JPEG_OLD, but this will disable some of the SIMD decoding path
// and hence cost some performance.
//
// If for some reason you do not want to use any of SIMD code, or if
// you have issues compiling it, you can disable it entirely by
// defining STBI_NO_SIMD.
//
// ===========================================================================
//
// HDR image support (disable by defining STBI_NO_HDR)
//
// stb_image now supports loading HDR images in general, and currently
// the Radiance .HDR file format, although the support is provided
// generically. You can still load any file through the existing interface;
// if you attempt to load an HDR file, it will be automatically remapped to
// LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1;
// both of these constants can be reconfigured through this interface:
//
// stbi_hdr_to_ldr_gamma(2.2f);
// stbi_hdr_to_ldr_scale(1.0f);
//
// (note, do not use _inverse_ constants; stbi_image will invert them
// appropriately).
//
// Additionally, there is a new, parallel interface for loading files as
// (linear) floats to preserve the full dynamic range:
//
// float *data = stbi_loadf(filename, &x, &y, &n, 0);
//
// If you load LDR images through this interface, those images will
// be promoted to floating point values, run through the inverse of
// constants corresponding to the above:
//
// stbi_ldr_to_hdr_scale(1.0f);
// stbi_ldr_to_hdr_gamma(2.2f);
//
// Finally, given a filename (or an open file or memory block--see header
// file for details) containing image data, you can query for the "most
// appropriate" interface to use (that is, whether the image is HDR or
// not), using:
//
// stbi_is_hdr(char *filename);
//
// ===========================================================================
//
// iPhone PNG support:
//
// By default we convert iphone-formatted PNGs back to RGB, even though
// they are internally encoded differently. You can disable this conversion
// by by calling stbi_convert_iphone_png_to_rgb(0), in which case
// you will always just get the native iphone "format" through (which
// is BGR stored in RGB).
//
// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per
// pixel to remove any premultiplied alpha *only* if the image file explicitly
// says there's premultiplied data (currently only happens in iPhone images,
// and only if iPhone convert-to-rgb processing is on).
//
#ifndef STBI_NO_STDIO
#include <stdio.h>
#endif /* STBI_NO_STDIO */
#define STBI_VERSION 1
enum
{
STBI_default = 0, /* only used for req_comp */
STBI_grey = 1,
STBI_grey_alpha = 2,
STBI_rgb = 3,
STBI_rgb_alpha = 4
};
typedef unsigned char stbi_uc;
#ifdef __cplusplus
extern "C" {
#endif
#ifdef STB_IMAGE_STATIC
#define STBIDEF static
#else
#define STBIDEF extern
#endif
//////////////////////////////////////////////////////////////////////////////
//
// PRIMARY API - works on images of any type
//
/* load image by filename, open file, or memory buffer */
typedef struct
{
int (*read) (void *user,char *data,int size); /* fill 'data' with 'size' bytes. return number of bytes actually read */
void (*skip) (void *user,int n); /* skip the next 'n' bytes, or 'unget' the last -n bytes if negative */
int (*eof) (void *user); /* returns nonzero if we are at end of file/data */
} stbi_io_callbacks;
STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *comp, int req_comp);
STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *comp, int req_comp);
STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *comp, int req_comp);
#ifndef STBI_NO_STDIO
STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
/* for stbi_load_from_file, file pointer is left pointing immediately after image */
#endif
#ifndef STBI_NO_LINEAR
STBIDEF float *stbi_loadf (char const *filename, int *x, int *y, int *comp, int req_comp);
STBIDEF float *stbi_loadf_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp);
STBIDEF float *stbi_loadf_from_callbacks (stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp);
#ifndef STBI_NO_STDIO
STBIDEF float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *comp, int req_comp);
#endif
#endif
#ifndef STBI_NO_HDR
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);
STBIDEF void stbi_hdr_to_ldr_scale(float scale);
#endif
#ifndef STBI_NO_LINEAR
STBIDEF void stbi_ldr_to_hdr_gamma(float gamma);
STBIDEF void stbi_ldr_to_hdr_scale(float scale);
#endif /* STBI_NO_HDR */
/* stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR */
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user);
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len);
#ifndef STBI_NO_STDIO
STBIDEF int stbi_is_hdr (char const *filename);
STBIDEF int stbi_is_hdr_from_file(FILE *f);
#endif /* STBI_NO_STDIO */
/* get a VERY brief reason for failure
* NOT THREADSAFE */
STBIDEF const char *stbi_failure_reason (void);
/* free the loaded image -- this is just free() */
STBIDEF void stbi_image_free (void *retval_from_stbi_load);
/* get image dimensions & components without fully decoding */
STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp);
STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp);
#ifndef STBI_NO_STDIO
STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp);
STBIDEF int stbi_info_from_file (FILE *f, int *x, int *y, int *comp);
#endif
// for image formats that explicitly notate that they have premultiplied alpha,
// we just return the colors as stored in the file. set this flag to force
// unpremultiplication. results are undefined if the unpremultiply overflow.
STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply);
// indicate whether we should process iphone images back to canonical format,
// or just pass them through "as-is"
STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert);
/* flip the image vertically, so the first pixel in the output array is the bottom left */
STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip);
/* ZLIB client - used by PNG, available for other purposes */
STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen);
STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header);
STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen);
STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen);
STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen);
#ifdef __cplusplus
}
#endif
//// end header file /////////////////////////////////////////////////////
#endif /* STBI_INCLUDE_STB_IMAGE_H */
#ifdef STB_IMAGE_IMPLEMENTATION
#if defined(STBI_ONLY_JPEG) || defined(STBI_ONLY_PNG) || defined(STBI_ONLY_BMP) \
|| defined(STBI_ONLY_TGA) || defined(STBI_ONLY_GIF) || defined(STBI_ONLY_PSD) \
|| defined(STBI_ONLY_HDR) || defined(STBI_ONLY_PIC) || defined(STBI_ONLY_PNM) \
|| defined(STBI_ONLY_ZLIB)
#ifndef STBI_ONLY_JPEG
#define STBI_NO_JPEG
#endif
#ifndef STBI_ONLY_PNG
#define STBI_NO_PNG
#endif
#ifndef STBI_ONLY_BMP
#define STBI_NO_BMP
#endif
#ifndef STBI_ONLY_PSD
#define STBI_NO_PSD
#endif
#ifndef STBI_ONLY_TGA
#define STBI_NO_TGA
#endif
#ifndef STBI_ONLY_GIF
#define STBI_NO_GIF
#endif
#ifndef STBI_ONLY_HDR
#define STBI_NO_HDR
#endif
#ifndef STBI_ONLY_PIC
#define STBI_NO_PIC
#endif
#ifndef STBI_ONLY_PNM
#define STBI_NO_PNM
#endif
#endif
#if defined(STBI_NO_PNG) && !defined(STBI_SUPPORT_ZLIB) && !defined(STBI_NO_ZLIB)
#define STBI_NO_ZLIB
#endif
#include <stdarg.h>
#include <stddef.h> /* ptrdiff_t on osx */
#include <stdlib.h>
#include <string.h>
#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)
#include <math.h> /* ldexp */
#endif
#ifndef STBI_NO_STDIO
#include <stdio.h>
#endif
#ifndef STBI_ASSERT
#include <assert.h>
#define STBI_ASSERT(x) assert(x)
#endif
#ifndef _MSC_VER
#ifdef __cplusplus
#define stbi_inline inline
#else
#define stbi_inline
#endif
#else
#define stbi_inline __forceinline
#endif
#ifdef _MSC_VER
typedef unsigned short stbi__uint16;
typedef signed short stbi__int16;
typedef unsigned int stbi__uint32;
typedef signed int stbi__int32;
#else
#include <stdint.h>
typedef uint16_t stbi__uint16;
typedef int16_t stbi__int16;
typedef uint32_t stbi__uint32;
typedef int32_t stbi__int32;
#endif
/* should produce compiler error if size is wrong */
typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1];
#ifdef _MSC_VER
#define STBI_NOTUSED(v) (void)(v)
#else
#define STBI_NOTUSED(v) (void)sizeof(v)
#endif
#ifdef _MSC_VER
#define STBI_HAS_LROTL
#endif
#ifdef STBI_HAS_LROTL
#define stbi_lrot(x,y) _lrotl(x,y)
#else
#define stbi_lrot(x,y) (((x) << (y)) | ((x) >> (32 - (y))))
#endif
#if defined(STBI_MALLOC) && defined(STBI_FREE) && defined(STBI_REALLOC)
// ok
#elif !defined(STBI_MALLOC) && !defined(STBI_FREE) && !defined(STBI_REALLOC)
// ok
#else
#error "Must define all or none of STBI_MALLOC, STBI_FREE, and STBI_REALLOC."
#endif
#ifndef STBI_MALLOC
#define STBI_MALLOC(sz) malloc(sz)
#define STBI_REALLOC(p,sz) realloc(p,sz)
#define STBI_FREE(p) free(p)
#endif
// x86/x64 detection
#if defined(__x86_64__) || defined(_M_X64)
#define STBI__X64_TARGET
#elif defined(__i386) || defined(_M_IX86)
#define STBI__X86_TARGET
#endif
#if defined(__GNUC__) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET)) && !defined(__SSE2__) && !defined(STBI_NO_SIMD)
/* NOTE: not clear do we actually need this for the 64-bit path?
* gcc doesn't support sse2 intrinsics unless you compile with -msse2,
* (but compiling with -msse2 allows the compiler to use SSE2 everywhere;
* this is just broken and gcc are jerks for not fixing it properly
* http://www.virtualdub.org/blog/pivot/entry.php?id=363 )
*/
#define STBI_NO_SIMD
#endif
#if defined(__MINGW32__) && defined(STBI__X86_TARGET) && !defined(STBI_MINGW_ENABLE_SSE2) && !defined(STBI_NO_SIMD)
/* Note that __MINGW32__ doesn't actually mean 32-bit, so we have to avoid STBI__X64_TARGET
*
* 32-bit MinGW wants ESP to be 16-byte aligned, but this is not in the
* Windows ABI and VC++ as well as Windows DLLs don't maintain that invariant.
* As a result, enabling SSE2 on 32-bit MinGW is dangerous when not
* simultaneously enabling "-mstackrealign".
*
* See https://github.com/nothings/stb/issues/81 for more information.
*
* So default to no SSE2 on 32-bit MinGW. If you've read this far and added
* -mstackrealign to your build settings, feel free to #define STBI_MINGW_ENABLE_SSE2.
*/
#define STBI_NO_SIMD
#endif
#if !defined(STBI_NO_SIMD) && defined(STBI__X86_TARGET)
#define STBI_SSE2
#include <emmintrin.h>
#ifdef _MSC_VER
#if _MSC_VER >= 1400 /* not VC6 */
#include <intrin.h> /* __cpuid */
static int stbi__cpuid3(void)
{
int info[4];
__cpuid(info,1);
return info[3];
}
#else
static int stbi__cpuid3(void)
{
int res;
__asm {
mov eax,1
cpuid
mov res,edx
}
return res;
}
#endif
#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name
static int stbi__sse2_available()
{
int info3 = stbi__cpuid3();
return ((info3 >> 26) & 1) != 0;
}
#else /* assume GCC-style if not VC++ */
#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16)))
static int stbi__sse2_available()
{
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 /* GCC 4.8 or later */
/* GCC 4.8+ has a nice way to do this */
return __builtin_cpu_supports("sse2");
#else
/* portable way to do this, preferably without using GCC inline ASM?
* just bail for now. */
return 0;
#endif
}
#endif
#endif
/* ARM NEON */
#if defined(STBI_NO_SIMD) && defined(STBI_NEON)
#undef STBI_NEON
#endif
#ifdef STBI_NEON
#include <arm_neon.h>
/* assume GCC or Clang on ARM targets */
#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16)))
#endif
#ifndef STBI_SIMD_ALIGN
#define STBI_SIMD_ALIGN(type, name) type name
#endif
///////////////////////////////////////////////
//
// stbi__context struct and start_xxx functions
// stbi__context structure is our basic context used by all images, so it
// contains all the IO context, plus some basic image information
typedef struct
{
stbi__uint32 img_x, img_y;
int img_n, img_out_n;
stbi_io_callbacks io;
void *io_user_data;
int read_from_callbacks;
int buflen;
stbi_uc buffer_start[128];
stbi_uc *img_buffer, *img_buffer_end;
stbi_uc *img_buffer_original;
} stbi__context;
static void stbi__refill_buffer(stbi__context *s);
// initialize a memory-decode context
static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len)
{
s->io.read = NULL;
s->read_from_callbacks = 0;
s->img_buffer = s->img_buffer_original = (stbi_uc *) buffer;
s->img_buffer_end = (stbi_uc *) buffer+len;
}
// initialize a callback-based context
static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user)
{
s->io = *c;
s->io_user_data = user;
s->buflen = sizeof(s->buffer_start);
s->read_from_callbacks = 1;
s->img_buffer_original = s->buffer_start;
stbi__refill_buffer(s);
}
#ifndef STBI_NO_STDIO
static int stbi__stdio_read(void *user, char *data, int size)
{
return (int) fread(data,1,size,(FILE*) user);
}
static void stbi__stdio_skip(void *user, int n)
{
fseek((FILE*) user, n, SEEK_CUR);
}
static int stbi__stdio_eof(void *user)
{
return feof((FILE*) user);
}
static stbi_io_callbacks stbi__stdio_callbacks =
{
stbi__stdio_read,
stbi__stdio_skip,
stbi__stdio_eof,
};
static void stbi__start_file(stbi__context *s, FILE *f)
{
stbi__start_callbacks(s, &stbi__stdio_callbacks, (void *) f);
}
#endif /* !STBI_NO_STDIO */
static void stbi__rewind(stbi__context *s)
{
/* conceptually rewind SHOULD rewind to the beginning of the stream,
* but we just rewind to the beginning of the initial buffer, because
* we only use it after doing 'test', which only ever looks at at most 92 bytes
*/
s->img_buffer = s->img_buffer_original;
}
#ifndef STBI_NO_JPEG
static int stbi__jpeg_test(stbi__context *s);
static stbi_uc *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#ifndef STBI_NO_PNG
static int stbi__png_test(stbi__context *s);
static stbi_uc *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#ifndef STBI_NO_BMP
static int stbi__bmp_test(stbi__context *s);
static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#ifndef STBI_NO_TGA
static int stbi__tga_test(stbi__context *s);
static stbi_uc *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#ifndef STBI_NO_PSD
static int stbi__psd_test(stbi__context *s);
static stbi_uc *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#ifndef STBI_NO_HDR
static int stbi__hdr_test(stbi__context *s);
static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#ifndef STBI_NO_PIC
static int stbi__pic_test(stbi__context *s);
static stbi_uc *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#ifndef STBI_NO_GIF
static int stbi__gif_test(stbi__context *s);
static stbi_uc *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp);
#endif
#ifndef STBI_NO_PNM
static int stbi__pnm_test(stbi__context *s);
static stbi_uc *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp);
static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp);
#endif
// this is not threadsafe
static const char *stbi__g_failure_reason;
STBIDEF const char *stbi_failure_reason(void)
{
return stbi__g_failure_reason;
}
static int stbi__err(const char *str)
{
stbi__g_failure_reason = str;
return 0;
}
static void *stbi__malloc(size_t size)
{
return STBI_MALLOC(size);
}
// stbi__err - error
// stbi__errpf - error returning pointer to float
// stbi__errpuc - error returning pointer to unsigned char
#ifdef STBI_NO_FAILURE_STRINGS
#define stbi__err(x,y) 0
#elif defined(STBI_FAILURE_USERMSG)
#define stbi__err(x,y) stbi__err(y)
#else
#define stbi__err(x,y) stbi__err(x)
#endif
#define stbi__errpf(x,y) ((float *) (stbi__err(x,y)?NULL:NULL))
#define stbi__errpuc(x,y) ((unsigned char *) (stbi__err(x,y)?NULL:NULL))
STBIDEF void stbi_image_free(void *retval_from_stbi_load)
{
STBI_FREE(retval_from_stbi_load);
}
#ifndef STBI_NO_LINEAR
static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp);
#endif
#ifndef STBI_NO_HDR
static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp);
#endif
static int stbi__vertically_flip_on_load = 0;
STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip)
{
stbi__vertically_flip_on_load = flag_true_if_should_flip;
}
static unsigned char *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
#ifndef STBI_NO_JPEG
if (stbi__jpeg_test(s)) return stbi__jpeg_load(s,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_PNG
if (stbi__png_test(s)) return stbi__png_load(s,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_BMP
if (stbi__bmp_test(s)) return stbi__bmp_load(s,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_GIF
if (stbi__gif_test(s)) return stbi__gif_load(s,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_PSD
if (stbi__psd_test(s)) return stbi__psd_load(s,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_PIC
if (stbi__pic_test(s)) return stbi__pic_load(s,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_PNM
if (stbi__pnm_test(s)) return stbi__pnm_load(s,x,y,comp,req_comp);
#endif
#ifndef STBI_NO_HDR
if (stbi__hdr_test(s)) {
float *hdr = stbi__hdr_load(s, x,y,comp,req_comp);
return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp);
}
#endif
#ifndef STBI_NO_TGA
// test tga last because it's a crappy test!
if (stbi__tga_test(s))
return stbi__tga_load(s,x,y,comp,req_comp);
#endif
return stbi__errpuc("unknown image type", "Image not of any known type, or corrupt");
}
static unsigned char *stbi__load_flip(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
unsigned char *result = stbi__load_main(s, x, y, comp, req_comp);
if (stbi__vertically_flip_on_load && result != NULL) {
int w = *x, h = *y;
int depth = req_comp ? req_comp : *comp;
int row,col,z;
stbi_uc temp;
// @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once
for (row = 0; row < (h>>1); row++) {
for (col = 0; col < w; col++) {
for (z = 0; z < depth; z++) {
temp = result[(row * w + col) * depth + z];
result[(row * w + col) * depth + z] = result[((h - row - 1) * w + col) * depth + z];
result[((h - row - 1) * w + col) * depth + z] = temp;
}
}
}
}
return result;
}
#ifndef STBI_NO_HDR
static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp)
{
if (stbi__vertically_flip_on_load && result != NULL) {
int w = *x, h = *y;
int depth = req_comp ? req_comp : *comp;
int row,col,z;
float temp;
// @OPTIMIZE: use a bigger temp buffer and memcpy multiple pixels at once
for (row = 0; row < (h>>1); row++) {
for (col = 0; col < w; col++) {
for (z = 0; z < depth; z++) {
temp = result[(row * w + col) * depth + z];
result[(row * w + col) * depth + z] = result[((h - row - 1) * w + col) * depth + z];
result[((h - row - 1) * w + col) * depth + z] = temp;
}
}
}
}
}
#endif
#ifndef STBI_NO_STDIO
static FILE *stbi__fopen(char const *filename, char const *mode)
{
FILE *f;
#if defined(_MSC_VER) && _MSC_VER >= 1400
if (0 != fopen_s(&f, filename, mode))
f=0;
#else
f = fopen(filename, mode);
#endif
return f;
}
STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp)
{
FILE *f = stbi__fopen(filename, "rb");
unsigned char *result;
if (!f) return stbi__errpuc("can't fopen", "Unable to open file");
result = stbi_load_from_file(f,x,y,comp,req_comp);
fclose(f);
return result;
}
STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
{
unsigned char *result;
stbi__context s;
stbi__start_file(&s,f);
result = stbi__load_flip(&s,x,y,comp,req_comp);
if (result) {
/* need to 'unget' all the characters in the IO buffer */
fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR);
}
return result;
}
#endif /* !STBI_NO_STDIO */
STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
{
stbi__context s;
stbi__start_mem(&s,buffer,len);
return stbi__load_flip(&s,x,y,comp,req_comp);
}
STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp)
{
stbi__context s;
stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user);
return stbi__load_flip(&s,x,y,comp,req_comp);
}
#ifndef STBI_NO_LINEAR
static float *stbi__loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
unsigned char *data;
#ifndef STBI_NO_HDR
if (stbi__hdr_test(s)) {
float *hdr_data = stbi__hdr_load(s,x,y,comp,req_comp);
if (hdr_data)
stbi__float_postprocess(hdr_data,x,y,comp,req_comp);
return hdr_data;
}
#endif
data = stbi__load_flip(s, x, y, comp, req_comp);
if (data)
return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
return stbi__errpf("unknown image type", "Image not of any known type, or corrupt");
}
STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
{
stbi__context s;
stbi__start_mem(&s,buffer,len);
return stbi__loadf_main(&s,x,y,comp,req_comp);
}
STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp)
{
stbi__context s;
stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user);
return stbi__loadf_main(&s,x,y,comp,req_comp);
}
#ifndef STBI_NO_STDIO
STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp)
{
float *result;
FILE *f = stbi__fopen(filename, "rb");
if (!f) return stbi__errpf("can't fopen", "Unable to open file");
result = stbi_loadf_from_file(f,x,y,comp,req_comp);
fclose(f);
return result;
}
STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp)
{
stbi__context s;
stbi__start_file(&s,f);
return stbi__loadf_main(&s,x,y,comp,req_comp);
}
#endif // !STBI_NO_STDIO
#endif // !STBI_NO_LINEAR
// these is-hdr-or-not is defined independent of whether STBI_NO_LINEAR is
// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always
// reports false!
STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len)
{
#ifndef STBI_NO_HDR
stbi__context s;
stbi__start_mem(&s,buffer,len);
return stbi__hdr_test(&s);
#else
STBI_NOTUSED(buffer);
STBI_NOTUSED(len);
return 0;
#endif
}
#ifndef STBI_NO_STDIO
STBIDEF int stbi_is_hdr (char const *filename)
{
FILE *f = stbi__fopen(filename, "rb");
int result=0;
if (f) {
result = stbi_is_hdr_from_file(f);
fclose(f);
}
return result;
}
STBIDEF int stbi_is_hdr_from_file(FILE *f)
{
#ifndef STBI_NO_HDR
stbi__context s;
stbi__start_file(&s,f);
return stbi__hdr_test(&s);
#else
return 0;
#endif
}
#endif // !STBI_NO_STDIO
STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user)
{
#ifndef STBI_NO_HDR
stbi__context s;
stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user);
return stbi__hdr_test(&s);
#else
return 0;
#endif
}
static float stbi__h2l_gamma_i=1.0f/2.2f, stbi__h2l_scale_i=1.0f;
static float stbi__l2h_gamma=2.2f, stbi__l2h_scale=1.0f;
#ifndef STBI_NO_LINEAR
STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; }
STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; }
#endif
/* forward declarations */
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma);
STBIDEF void stbi_hdr_to_ldr_scale(float scale);
STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; }
STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; }
//////////////////////////////////////////////////////////////////////////////
//
// Common code used by all image loaders
//
enum
{
STBI__SCAN_load=0,
STBI__SCAN_type,
STBI__SCAN_header
};
static void stbi__refill_buffer(stbi__context *s)
{
int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen);
if (n == 0) {
// at end of file, treat same as if from memory, but need to handle case
// where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file
s->read_from_callbacks = 0;
s->img_buffer = s->buffer_start;
s->img_buffer_end = s->buffer_start+1;
*s->img_buffer = 0;
} else {
s->img_buffer = s->buffer_start;
s->img_buffer_end = s->buffer_start + n;
}
}
stbi_inline static stbi_uc stbi__get8(stbi__context *s)
{
if (s->img_buffer < s->img_buffer_end)
return *s->img_buffer++;
if (s->read_from_callbacks) {
stbi__refill_buffer(s);
return *s->img_buffer++;
}
return 0;
}
stbi_inline static int stbi__at_eof(stbi__context *s)
{
if (s->io.read) {
if (!(s->io.eof)(s->io_user_data)) return 0;
// if feof() is true, check if buffer = end
// special case: we've only got the special 0 character at the end
if (s->read_from_callbacks == 0) return 1;
}
return s->img_buffer >= s->img_buffer_end;
}
static void stbi__skip(stbi__context *s, int n)
{
if (n < 0) {
s->img_buffer = s->img_buffer_end;
return;
}
if (s->io.read) {
int blen = (int) (s->img_buffer_end - s->img_buffer);
if (blen < n) {
s->img_buffer = s->img_buffer_end;
(s->io.skip)(s->io_user_data, n - blen);
return;
}
}
s->img_buffer += n;
}
static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n)
{
if (s->io.read) {
int blen = (int) (s->img_buffer_end - s->img_buffer);
if (blen < n) {
int res, count;
memcpy(buffer, s->img_buffer, blen);
count = (s->io.read)(s->io_user_data, (char*) buffer + blen, n - blen);
res = (count == (n-blen));
s->img_buffer = s->img_buffer_end;
return res;
}
}
if (s->img_buffer+n <= s->img_buffer_end) {
memcpy(buffer, s->img_buffer, n);
s->img_buffer += n;
return 1;
} else
return 0;
}
static int stbi__get16be(stbi__context *s)
{
int z = stbi__get8(s);
return (z << 8) + stbi__get8(s);
}
static stbi__uint32 stbi__get32be(stbi__context *s)
{
stbi__uint32 z = stbi__get16be(s);
return (z << 16) + stbi__get16be(s);
}
static int stbi__get16le(stbi__context *s)
{
int z = stbi__get8(s);
return z + (stbi__get8(s) << 8);
}
static stbi__uint32 stbi__get32le(stbi__context *s)
{
stbi__uint32 z = stbi__get16le(s);
return z + (stbi__get16le(s) << 16);
}
#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings
//////////////////////////////////////////////////////////////////////////////
//
// generic converter from built-in img_n to req_comp
// individual types do this automatically as much as possible (e.g. jpeg
// does all cases internally since it needs to colorspace convert anyway,
// and it never has alpha, so very few cases ). png can automatically
// interleave an alpha=255 channel, but falls back to this for other cases
//
// assume data buffer is malloced, so malloc a new one and free that one
// only failure mode is malloc failing
static stbi_uc stbi__compute_y(int r, int g, int b)
{
return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8);
}
static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y)
{
int i,j;
unsigned char *good;
if (req_comp == img_n) return data;
STBI_ASSERT(req_comp >= 1 && req_comp <= 4);
good = (unsigned char *) stbi__malloc(req_comp * x * y);
if (good == NULL) {
STBI_FREE(data);
return stbi__errpuc("outofmem", "Out of memory");
}
for (j=0; j < (int) y; ++j) {
unsigned char *src = data + j * x * img_n ;
unsigned char *dest = good + j * x * req_comp;
#define COMBO(a,b) ((a)*8+(b))
#define CASE(a,b) case COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)
// convert source image with img_n components to one with req_comp components;
// avoid switch per pixel, so use switch per scanline and massive macros
switch (COMBO(img_n, req_comp)) {
CASE(1,2) dest[0]=src[0], dest[1]=255; break;
CASE(1,3) dest[0]=dest[1]=dest[2]=src[0]; break;
CASE(1,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=255; break;
CASE(2,1) dest[0]=src[0]; break;
CASE(2,3) dest[0]=dest[1]=dest[2]=src[0]; break;
CASE(2,4) dest[0]=dest[1]=dest[2]=src[0], dest[3]=src[1]; break;
CASE(3,4) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2],dest[3]=255; break;
CASE(3,1) dest[0]=stbi__compute_y(src[0],src[1],src[2]); break;
CASE(3,2) dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = 255; break;
CASE(4,1) dest[0]=stbi__compute_y(src[0],src[1],src[2]); break;
CASE(4,2) dest[0]=stbi__compute_y(src[0],src[1],src[2]), dest[1] = src[3]; break;
CASE(4,3) dest[0]=src[0],dest[1]=src[1],dest[2]=src[2]; break;
default: STBI_ASSERT(0);
}
#undef CASE
}
STBI_FREE(data);
return good;
}
#ifndef STBI_NO_LINEAR
static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp)
{
int i,k,n;
float *output = (float *) stbi__malloc(x * y * comp * sizeof(float));
if (output == NULL) { STBI_FREE(data); return stbi__errpf("outofmem", "Out of memory"); }
// compute number of non-alpha components
if (comp & 1) n = comp; else n = comp-1;
for (i=0; i < x*y; ++i) {
for (k=0; k < n; ++k) {
output[i*comp + k] = (float) (pow(data[i*comp+k]/255.0f, stbi__l2h_gamma) * stbi__l2h_scale);
}
if (k < comp) output[i*comp + k] = data[i*comp+k]/255.0f;
}
STBI_FREE(data);
return output;
}
#endif
#ifndef STBI_NO_HDR
#define stbi__float2int(x) ((int) (x))
static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp)
{
int i,k,n;
stbi_uc *output = (stbi_uc *) stbi__malloc(x * y * comp);
if (output == NULL) { STBI_FREE(data); return stbi__errpuc("outofmem", "Out of memory"); }
// compute number of non-alpha components
if (comp & 1) n = comp; else n = comp-1;
for (i=0; i < x*y; ++i) {
for (k=0; k < n; ++k) {
float z = (float) pow(data[i*comp+k]*stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f;
if (z < 0) z = 0;
if (z > 255) z = 255;
output[i*comp + k] = (stbi_uc) stbi__float2int(z);
}
if (k < comp) {
float z = data[i*comp+k] * 255 + 0.5f;
if (z < 0) z = 0;
if (z > 255) z = 255;
output[i*comp + k] = (stbi_uc) stbi__float2int(z);
}
}
STBI_FREE(data);
return output;
}
#endif
//////////////////////////////////////////////////////////////////////////////
//
// "baseline" JPEG/JFIF decoder
//
// simple implementation
// - doesn't support delayed output of y-dimension
// - simple interface (only one output format: 8-bit interleaved RGB)
// - doesn't try to recover corrupt jpegs
// - doesn't allow partial loading, loading multiple at once
// - still fast on x86 (copying globals into locals doesn't help x86)
// - allocates lots of intermediate memory (full size of all components)
// - non-interleaved case requires this anyway
// - allows good upsampling (see next)
// high-quality
// - upsampled channels are bilinearly interpolated, even across blocks
// - quality integer IDCT derived from IJG's 'slow'
// performance
// - fast huffman; reasonable integer IDCT
// - some SIMD kernels for common paths on targets with SSE2/NEON
// - uses a lot of intermediate memory, could cache poorly
#ifndef STBI_NO_JPEG
// huffman decoding acceleration
#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache
typedef struct
{
stbi_uc fast[1 << FAST_BITS];
// weirdly, repacking this into AoS is a 10% speed loss, instead of a win
stbi__uint16 code[256];
stbi_uc values[256];
stbi_uc size[257];
unsigned int maxcode[18];
int delta[17]; // old 'firstsymbol' - old 'firstcode'
} stbi__huffman;
typedef struct
{
stbi__context *s;
stbi__huffman huff_dc[4];
stbi__huffman huff_ac[4];
stbi_uc dequant[4][64];
stbi__int16 fast_ac[4][1 << FAST_BITS];
// sizes for components, interleaved MCUs
int img_h_max, img_v_max;
int img_mcu_x, img_mcu_y;
int img_mcu_w, img_mcu_h;
// definition of jpeg image component
struct
{
int id;
int h,v;
int tq;
int hd,ha;
int dc_pred;
int x,y,w2,h2;
stbi_uc *data;
void *raw_data, *raw_coeff;
stbi_uc *linebuf;
short *coeff; // progressive only
int coeff_w, coeff_h; // number of 8x8 coefficient blocks
} img_comp[4];
stbi__uint32 code_buffer; // jpeg entropy-coded buffer
int code_bits; // number of valid bits
unsigned char marker; // marker seen while filling entropy buffer
int nomore; // flag if we saw a marker so must stop
int progressive;
int spec_start;
int spec_end;
int succ_high;
int succ_low;
int eob_run;
int scan_n, order[4];
int restart_interval, todo;
// kernels
void (*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]);
void (*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step);
stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs);
} stbi__jpeg;
static int stbi__build_huffman(stbi__huffman *h, int *count)
{
int i,j,k=0,code;
// build size list for each symbol (from JPEG spec)
for (i=0; i < 16; ++i)
for (j=0; j < count[i]; ++j)
h->size[k++] = (stbi_uc) (i+1);
h->size[k] = 0;
// compute actual symbols (from jpeg spec)
code = 0;
k = 0;
for(j=1; j <= 16; ++j) {
// compute delta to add to code to compute symbol id
h->delta[j] = k - code;
if (h->size[k] == j) {
while (h->size[k] == j)
h->code[k++] = (stbi__uint16) (code++);
if (code-1 >= (1 << j)) return stbi__err("bad code lengths","Corrupt JPEG");
}
// compute largest code + 1 for this size, preshifted as needed later
h->maxcode[j] = code << (16-j);
code <<= 1;
}
h->maxcode[j] = 0xffffffff;
// build non-spec acceleration table; 255 is flag for not-accelerated
memset(h->fast, 255, 1 << FAST_BITS);
for (i=0; i < k; ++i) {
int s = h->size[i];
if (s <= FAST_BITS) {
int c = h->code[i] << (FAST_BITS-s);
int m = 1 << (FAST_BITS-s);
for (j=0; j < m; ++j) {
h->fast[c+j] = (stbi_uc) i;
}
}
}
return 1;
}
// build a table that decodes both magnitude and value of small ACs in
// one go.
static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h)
{
int i;
for (i=0; i < (1 << FAST_BITS); ++i) {
stbi_uc fast = h->fast[i];
fast_ac[i] = 0;
if (fast < 255) {
int rs = h->values[fast];
int run = (rs >> 4) & 15;
int magbits = rs & 15;
int len = h->size[fast];
if (magbits && len + magbits <= FAST_BITS) {
// magnitude code followed by receive_extend code
int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits);
int m = 1 << (magbits - 1);
if (k < m) k += (-1 << magbits) + 1;
// if the result is small enough, we can fit it in fast_ac table
if (k >= -128 && k <= 127)
fast_ac[i] = (stbi__int16) ((k << 8) + (run << 4) + (len + magbits));
}
}
}
}
static void stbi__grow_buffer_unsafe(stbi__jpeg *j)
{
do {
int b = j->nomore ? 0 : stbi__get8(j->s);
if (b == 0xff) {
int c = stbi__get8(j->s);
if (c != 0) {
j->marker = (unsigned char) c;
j->nomore = 1;
return;
}
}
j->code_buffer |= b << (24 - j->code_bits);
j->code_bits += 8;
} while (j->code_bits <= 24);
}
// (1 << n) - 1
static stbi__uint32 stbi__bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535};
// decode a jpeg huffman value from the bitstream
stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h)
{
unsigned int temp;
int c,k;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
// look at the top FAST_BITS and determine what symbol ID it is,
// if the code is <= FAST_BITS
c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1);
k = h->fast[c];
if (k < 255) {
int s = h->size[k];
if (s > j->code_bits)
return -1;
j->code_buffer <<= s;
j->code_bits -= s;
return h->values[k];
}
// naive test is to shift the code_buffer down so k bits are
// valid, then test against maxcode. To speed this up, we've
// preshifted maxcode left so that it has (16-k) 0s at the
// end; in other words, regardless of the number of bits, it
// wants to be compared against something shifted to have 16;
// that way we don't need to shift inside the loop.
temp = j->code_buffer >> 16;
for (k=FAST_BITS+1 ; ; ++k)
if (temp < h->maxcode[k])
break;
if (k == 17) {
// error! code not found
j->code_bits -= 16;
return -1;
}
if (k > j->code_bits)
return -1;
// convert the huffman code to the symbol id
c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k];
STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]);
// convert the id to a symbol
j->code_bits -= k;
j->code_buffer <<= k;
return h->values[c];
}
// bias[n] = (-1<<n) + 1
static int const stbi__jbias[16] = {0,-1,-3,-7,-15,-31,-63,-127,-255,-511,-1023,-2047,-4095,-8191,-16383,-32767};
// combined JPEG 'receive' and JPEG 'extend', since baseline
// always extends everything it receives.
stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n)
{
unsigned int k;
int sgn;
if (j->code_bits < n) stbi__grow_buffer_unsafe(j);
sgn = (stbi__int32)j->code_buffer >> 31; // sign bit is always in MSB
k = stbi_lrot(j->code_buffer, n);
STBI_ASSERT(n >= 0 && n < (int) (sizeof(stbi__bmask)/sizeof(*stbi__bmask)));
j->code_buffer = k & ~stbi__bmask[n];
k &= stbi__bmask[n];
j->code_bits -= n;
return k + (stbi__jbias[n] & ~sgn);
}
// get some unsigned bits
stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n)
{
unsigned int k;
if (j->code_bits < n) stbi__grow_buffer_unsafe(j);
k = stbi_lrot(j->code_buffer, n);
j->code_buffer = k & ~stbi__bmask[n];
k &= stbi__bmask[n];
j->code_bits -= n;
return k;
}
stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)
{
unsigned int k;
if (j->code_bits < 1) stbi__grow_buffer_unsafe(j);
k = j->code_buffer;
j->code_buffer <<= 1;
--j->code_bits;
return k & 0x80000000;
}
// given a value that's at position X in the zigzag stream,
// where does it appear in the 8x8 matrix coded as row-major?
static stbi_uc stbi__jpeg_dezigzag[64+15] =
{
0, 1, 8, 16, 9, 2, 3, 10,
17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34,
27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36,
29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46,
53, 60, 61, 54, 47, 55, 62, 63,
// let corrupt input sample past end
63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63
};
// decode one 64-entry block--
static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi_uc *dequant)
{
int diff,dc,k;
int t;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
t = stbi__jpeg_huff_decode(j, hdc);
if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG");
// 0 all the ac values now so we can do it 32-bits at a time
memset(data,0,64*sizeof(data[0]));
diff = t ? stbi__extend_receive(j, t) : 0;
dc = j->img_comp[b].dc_pred + diff;
j->img_comp[b].dc_pred = dc;
data[0] = (short) (dc * dequant[0]);
// decode AC components, see JPEG spec
k = 1;
do {
unsigned int zig;
int c,r,s;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1);
r = fac[c];
if (r) { // fast-AC path
k += (r >> 4) & 15; // run
s = r & 15; // combined length
j->code_buffer <<= s;
j->code_bits -= s;
// decode into unzigzag'd location
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) ((r >> 8) * dequant[zig]);
} else {
int rs = stbi__jpeg_huff_decode(j, hac);
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (rs != 0xf0) break; // end block
k += 16;
} else {
k += r;
// decode into unzigzag'd location
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]);
}
}
} while (k < 64);
return 1;
}
static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b)
{
int diff,dc;
int t;
if (j->spec_end != 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
if (j->succ_high == 0) {
// first scan for DC coefficient, must be first
memset(data,0,64*sizeof(data[0])); // 0 all the ac values now
t = stbi__jpeg_huff_decode(j, hdc);
diff = t ? stbi__extend_receive(j, t) : 0;
dc = j->img_comp[b].dc_pred + diff;
j->img_comp[b].dc_pred = dc;
data[0] = (short) (dc << j->succ_low);
} else {
// refinement scan for DC coefficient
if (stbi__jpeg_get_bit(j))
data[0] += (short) (1 << j->succ_low);
}
return 1;
}
// @OPTIMIZE: store non-zigzagged during the decode passes,
// and only de-zigzag when dequantizing
static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac)
{
int k;
if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG");
if (j->succ_high == 0) {
int shift = j->succ_low;
if (j->eob_run) {
--j->eob_run;
return 1;
}
k = j->spec_start;
do {
unsigned int zig;
int c,r,s;
if (j->code_bits < 16) stbi__grow_buffer_unsafe(j);
c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1);
r = fac[c];
if (r) { // fast-AC path
k += (r >> 4) & 15; // run
s = r & 15; // combined length
j->code_buffer <<= s;
j->code_bits -= s;
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) ((r >> 8) << shift);
} else {
int rs = stbi__jpeg_huff_decode(j, hac);
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (r < 15) {
j->eob_run = (1 << r);
if (r)
j->eob_run += stbi__jpeg_get_bits(j, r);
--j->eob_run;
break;
}
k += 16;
} else {
k += r;
zig = stbi__jpeg_dezigzag[k++];
data[zig] = (short) (stbi__extend_receive(j,s) << shift);
}
}
} while (k <= j->spec_end);
} else {
// refinement scan for these AC coefficients
short bit = (short) (1 << j->succ_low);
if (j->eob_run) {
--j->eob_run;
for (k = j->spec_start; k <= j->spec_end; ++k) {
short *p = &data[stbi__jpeg_dezigzag[k]];
if (*p != 0)
if (stbi__jpeg_get_bit(j))
if ((*p & bit)==0) {
if (*p > 0)
*p += bit;
else
*p -= bit;
}
}
} else {
k = j->spec_start;
do {
int r,s;
int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh
if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
s = rs & 15;
r = rs >> 4;
if (s == 0) {
if (r < 15) {
j->eob_run = (1 << r) - 1;
if (r)
j->eob_run += stbi__jpeg_get_bits(j, r);
r = 64; // force end of block
} else {
// r=15 s=0 should write 16 0s, so we just do
// a run of 15 0s and then write s (which is 0),
// so we don't have to do anything special here
}
} else {
if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG");
// sign bit
if (stbi__jpeg_get_bit(j))
s = bit;
else
s = -bit;
}
// advance by r
while (k <= j->spec_end) {
short *p = &data[stbi__jpeg_dezigzag[k++]];
if (*p != 0) {
if (stbi__jpeg_get_bit(j))
if ((*p & bit)==0) {
if (*p > 0)
*p += bit;
else
*p -= bit;
}
} else {
if (r == 0) {
*p = (short) s;
break;
}
--r;
}
}
} while (k <= j->spec_end);
}
}
return 1;
}
// take a -128..127 value and stbi__clamp it and convert to 0..255
stbi_inline static stbi_uc stbi__clamp(int x)
{
// trick to use a single test to catch both cases
if ((unsigned int) x > 255) {
if (x < 0) return 0;
if (x > 255) return 255;
}
return (stbi_uc) x;
}
#define stbi__f2f(x) ((int) (((x) * 4096 + 0.5)))
#define stbi__fsh(x) ((x) << 12)
// derived from jidctint -- DCT_ISLOW
#define STBI__IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \
int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \
p2 = s2; \
p3 = s6; \
p1 = (p2+p3) * stbi__f2f(0.5411961f); \
t2 = p1 + p3*stbi__f2f(-1.847759065f); \
t3 = p1 + p2*stbi__f2f( 0.765366865f); \
p2 = s0; \
p3 = s4; \
t0 = stbi__fsh(p2+p3); \
t1 = stbi__fsh(p2-p3); \
x0 = t0+t3; \
x3 = t0-t3; \
x1 = t1+t2; \
x2 = t1-t2; \
t0 = s7; \
t1 = s5; \
t2 = s3; \
t3 = s1; \
p3 = t0+t2; \
p4 = t1+t3; \
p1 = t0+t3; \
p2 = t1+t2; \
p5 = (p3+p4)*stbi__f2f( 1.175875602f); \
t0 = t0*stbi__f2f( 0.298631336f); \
t1 = t1*stbi__f2f( 2.053119869f); \
t2 = t2*stbi__f2f( 3.072711026f); \
t3 = t3*stbi__f2f( 1.501321110f); \
p1 = p5 + p1*stbi__f2f(-0.899976223f); \
p2 = p5 + p2*stbi__f2f(-2.562915447f); \
p3 = p3*stbi__f2f(-1.961570560f); \
p4 = p4*stbi__f2f(-0.390180644f); \
t3 += p1+p4; \
t2 += p2+p3; \
t1 += p2+p4; \
t0 += p1+p3;
static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64])
{
int i,val[64],*v=val;
stbi_uc *o;
short *d = data;
// columns
for (i=0; i < 8; ++i,++d, ++v) {
// if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing
if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0
&& d[40]==0 && d[48]==0 && d[56]==0) {
// no shortcut 0 seconds
// (1|2|3|4|5|6|7)==0 0 seconds
// all separate -0.047 seconds
// 1 && 2|3 && 4|5 && 6|7: -0.047 seconds
int dcterm = d[0] << 2;
v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm;
} else {
STBI__IDCT_1D(d[ 0],d[ 8],d[16],d[24],d[32],d[40],d[48],d[56])
// constants scaled things up by 1<<12; let's bring them back
// down, but keep 2 extra bits of precision
x0 += 512; x1 += 512; x2 += 512; x3 += 512;
v[ 0] = (x0+t3) >> 10;
v[56] = (x0-t3) >> 10;
v[ 8] = (x1+t2) >> 10;
v[48] = (x1-t2) >> 10;
v[16] = (x2+t1) >> 10;
v[40] = (x2-t1) >> 10;
v[24] = (x3+t0) >> 10;
v[32] = (x3-t0) >> 10;
}
}
for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) {
// no fast case since the first 1D IDCT spread components out
STBI__IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7])
// constants scaled things up by 1<<12, plus we had 1<<2 from first
// loop, plus horizontal and vertical each scale by sqrt(8) so together
// we've got an extra 1<<3, so 1<<17 total we need to remove.
// so we want to round that, which means adding 0.5 * 1<<17,
// aka 65536. Also, we'll end up with -128 to 127 that we want
// to encode as 0..255 by adding 128, so we'll add that before the shift
x0 += 65536 + (128<<17);
x1 += 65536 + (128<<17);
x2 += 65536 + (128<<17);
x3 += 65536 + (128<<17);
// tried computing the shifts into temps, or'ing the temps to see
// if any were out of range, but that was slower
o[0] = stbi__clamp((x0+t3) >> 17);
o[7] = stbi__clamp((x0-t3) >> 17);
o[1] = stbi__clamp((x1+t2) >> 17);
o[6] = stbi__clamp((x1-t2) >> 17);
o[2] = stbi__clamp((x2+t1) >> 17);
o[5] = stbi__clamp((x2-t1) >> 17);
o[3] = stbi__clamp((x3+t0) >> 17);
o[4] = stbi__clamp((x3-t0) >> 17);
}
}
#ifdef STBI_SSE2
/* sse2 integer IDCT. not the fastest possible implementation but it
* produces bit-identical results to the generic C version so it's
* fully "transparent".
*/
static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
{
/* This is constructed to match our regular (generic) integer IDCT exactly. */
__m128i row0, row1, row2, row3, row4, row5, row6, row7;
__m128i tmp;
/* dot product constant: even elems=x, odd elems=y */
#define dct_const(x,y) _mm_setr_epi16((x),(y),(x),(y),(x),(y),(x),(y))
/* out(0) = c0[even]*x + c0[odd]*y (c0, x, y 16-bit, out 32-bit)
* out(1) = c1[even]*x + c1[odd]*y
*/
#define dct_rot(out0,out1, x,y,c0,c1) \
__m128i c0##lo = _mm_unpacklo_epi16((x),(y)); \
__m128i c0##hi = _mm_unpackhi_epi16((x),(y)); \
__m128i out0##_l = _mm_madd_epi16(c0##lo, c0); \
__m128i out0##_h = _mm_madd_epi16(c0##hi, c0); \
__m128i out1##_l = _mm_madd_epi16(c0##lo, c1); \
__m128i out1##_h = _mm_madd_epi16(c0##hi, c1)
/* out = in << 12 (in 16-bit, out 32-bit) */
#define dct_widen(out, in) \
__m128i out##_l = _mm_srai_epi32(_mm_unpacklo_epi16(_mm_setzero_si128(), (in)), 4); \
__m128i out##_h = _mm_srai_epi32(_mm_unpackhi_epi16(_mm_setzero_si128(), (in)), 4)
/* wide add */
#define dct_wadd(out, a, b) \
__m128i out##_l = _mm_add_epi32(a##_l, b##_l); \
__m128i out##_h = _mm_add_epi32(a##_h, b##_h)
/* wide sub */
#define dct_wsub(out, a, b) \
__m128i out##_l = _mm_sub_epi32(a##_l, b##_l); \
__m128i out##_h = _mm_sub_epi32(a##_h, b##_h)
/* butterfly a/b, add bias, then shift by "s" and pack */
#define dct_bfly32o(out0, out1, a,b,bias,s) \
{ \
__m128i abiased_l = _mm_add_epi32(a##_l, bias); \
__m128i abiased_h = _mm_add_epi32(a##_h, bias); \
dct_wadd(sum, abiased, b); \
dct_wsub(dif, abiased, b); \
out0 = _mm_packs_epi32(_mm_srai_epi32(sum_l, s), _mm_srai_epi32(sum_h, s)); \
out1 = _mm_packs_epi32(_mm_srai_epi32(dif_l, s), _mm_srai_epi32(dif_h, s)); \
}
/* 8-bit interleave step (for transposes) */
#define dct_interleave8(a, b) \
tmp = a; \
a = _mm_unpacklo_epi8(a, b); \
b = _mm_unpackhi_epi8(tmp, b)
/* 16-bit interleave step (for transposes) */
#define dct_interleave16(a, b) \
tmp = a; \
a = _mm_unpacklo_epi16(a, b); \
b = _mm_unpackhi_epi16(tmp, b)
#define dct_pass(bias,shift) \
{ \
/* even part */ \
dct_rot(t2e,t3e, row2,row6, rot0_0,rot0_1); \
__m128i sum04 = _mm_add_epi16(row0, row4); \
__m128i dif04 = _mm_sub_epi16(row0, row4); \
dct_widen(t0e, sum04); \
dct_widen(t1e, dif04); \
dct_wadd(x0, t0e, t3e); \
dct_wsub(x3, t0e, t3e); \
dct_wadd(x1, t1e, t2e); \
dct_wsub(x2, t1e, t2e); \
/* odd part */ \
dct_rot(y0o,y2o, row7,row3, rot2_0,rot2_1); \
dct_rot(y1o,y3o, row5,row1, rot3_0,rot3_1); \
__m128i sum17 = _mm_add_epi16(row1, row7); \
__m128i sum35 = _mm_add_epi16(row3, row5); \
dct_rot(y4o,y5o, sum17,sum35, rot1_0,rot1_1); \
dct_wadd(x4, y0o, y4o); \
dct_wadd(x5, y1o, y5o); \
dct_wadd(x6, y2o, y5o); \
dct_wadd(x7, y3o, y4o); \
dct_bfly32o(row0,row7, x0,x7,bias,shift); \
dct_bfly32o(row1,row6, x1,x6,bias,shift); \
dct_bfly32o(row2,row5, x2,x5,bias,shift); \
dct_bfly32o(row3,row4, x3,x4,bias,shift); \
}
__m128i rot0_0 = dct_const(stbi__f2f(0.5411961f), stbi__f2f(0.5411961f) + stbi__f2f(-1.847759065f));
__m128i rot0_1 = dct_const(stbi__f2f(0.5411961f) + stbi__f2f( 0.765366865f), stbi__f2f(0.5411961f));
__m128i rot1_0 = dct_const(stbi__f2f(1.175875602f) + stbi__f2f(-0.899976223f), stbi__f2f(1.175875602f));
__m128i rot1_1 = dct_const(stbi__f2f(1.175875602f), stbi__f2f(1.175875602f) + stbi__f2f(-2.562915447f));
__m128i rot2_0 = dct_const(stbi__f2f(-1.961570560f) + stbi__f2f( 0.298631336f), stbi__f2f(-1.961570560f));
__m128i rot2_1 = dct_const(stbi__f2f(-1.961570560f), stbi__f2f(-1.961570560f) + stbi__f2f( 3.072711026f));
__m128i rot3_0 = dct_const(stbi__f2f(-0.390180644f) + stbi__f2f( 2.053119869f), stbi__f2f(-0.390180644f));
__m128i rot3_1 = dct_const(stbi__f2f(-0.390180644f), stbi__f2f(-0.390180644f) + stbi__f2f( 1.501321110f));
/* rounding biases in column/row passes, see stbi__idct_block for explanation. */
__m128i bias_0 = _mm_set1_epi32(512);
__m128i bias_1 = _mm_set1_epi32(65536 + (128<<17));
/* load */
row0 = _mm_load_si128((const __m128i *) (data + 0*8));
row1 = _mm_load_si128((const __m128i *) (data + 1*8));
row2 = _mm_load_si128((const __m128i *) (data + 2*8));
row3 = _mm_load_si128((const __m128i *) (data + 3*8));
row4 = _mm_load_si128((const __m128i *) (data + 4*8));
row5 = _mm_load_si128((const __m128i *) (data + 5*8));
row6 = _mm_load_si128((const __m128i *) (data + 6*8));
row7 = _mm_load_si128((const __m128i *) (data + 7*8));
/* column pass */
dct_pass(bias_0, 10);
{
/* 16bit 8x8 transpose pass 1 */
dct_interleave16(row0, row4);
dct_interleave16(row1, row5);
dct_interleave16(row2, row6);
dct_interleave16(row3, row7);
/* transpose pass 2 */
dct_interleave16(row0, row2);
dct_interleave16(row1, row3);
dct_interleave16(row4, row6);
dct_interleave16(row5, row7);
/* transpose pass 3 */
dct_interleave16(row0, row1);
dct_interleave16(row2, row3);
dct_interleave16(row4, row5);
dct_interleave16(row6, row7);
}
/* row pass */
dct_pass(bias_1, 17);
{
/* pack */
__m128i p0 = _mm_packus_epi16(row0, row1); // a0a1a2a3...a7b0b1b2b3...b7
__m128i p1 = _mm_packus_epi16(row2, row3);
__m128i p2 = _mm_packus_epi16(row4, row5);
__m128i p3 = _mm_packus_epi16(row6, row7);
// 8bit 8x8 transpose pass 1
dct_interleave8(p0, p2); // a0e0a1e1...
dct_interleave8(p1, p3); // c0g0c1g1...
// transpose pass 2
dct_interleave8(p0, p1); // a0c0e0g0...
dct_interleave8(p2, p3); // b0d0f0h0...
// transpose pass 3
dct_interleave8(p0, p2); // a0b0c0d0...
dct_interleave8(p1, p3); // a4b4c4d4...
// store
_mm_storel_epi64((__m128i *) out, p0); out += out_stride;
_mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p0, 0x4e)); out += out_stride;
_mm_storel_epi64((__m128i *) out, p2); out += out_stride;
_mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p2, 0x4e)); out += out_stride;
_mm_storel_epi64((__m128i *) out, p1); out += out_stride;
_mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p1, 0x4e)); out += out_stride;
_mm_storel_epi64((__m128i *) out, p3); out += out_stride;
_mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p3, 0x4e));
}
#undef dct_const
#undef dct_rot
#undef dct_widen
#undef dct_wadd
#undef dct_wsub
#undef dct_bfly32o
#undef dct_interleave8
#undef dct_interleave16
#undef dct_pass
}
#endif /* STBI_SSE2 */
#ifdef STBI_NEON
/* NEON integer IDCT. should produce bit-identical
* results to the generic C version. */
static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64])
{
int16x8_t row0, row1, row2, row3, row4, row5, row6, row7;
int16x4_t rot0_0 = vdup_n_s16(stbi__f2f(0.5411961f));
int16x4_t rot0_1 = vdup_n_s16(stbi__f2f(-1.847759065f));
int16x4_t rot0_2 = vdup_n_s16(stbi__f2f( 0.765366865f));
int16x4_t rot1_0 = vdup_n_s16(stbi__f2f( 1.175875602f));
int16x4_t rot1_1 = vdup_n_s16(stbi__f2f(-0.899976223f));
int16x4_t rot1_2 = vdup_n_s16(stbi__f2f(-2.562915447f));
int16x4_t rot2_0 = vdup_n_s16(stbi__f2f(-1.961570560f));
int16x4_t rot2_1 = vdup_n_s16(stbi__f2f(-0.390180644f));
int16x4_t rot3_0 = vdup_n_s16(stbi__f2f( 0.298631336f));
int16x4_t rot3_1 = vdup_n_s16(stbi__f2f( 2.053119869f));
int16x4_t rot3_2 = vdup_n_s16(stbi__f2f( 3.072711026f));
int16x4_t rot3_3 = vdup_n_s16(stbi__f2f( 1.501321110f));
#define dct_long_mul(out, inq, coeff) \
int32x4_t out##_l = vmull_s16(vget_low_s16(inq), coeff); \
int32x4_t out##_h = vmull_s16(vget_high_s16(inq), coeff)
#define dct_long_mac(out, acc, inq, coeff) \
int32x4_t out##_l = vmlal_s16(acc##_l, vget_low_s16(inq), coeff); \
int32x4_t out##_h = vmlal_s16(acc##_h, vget_high_s16(inq), coeff)
#define dct_widen(out, inq) \
int32x4_t out##_l = vshll_n_s16(vget_low_s16(inq), 12); \
int32x4_t out##_h = vshll_n_s16(vget_high_s16(inq), 12)
/* wide add */
#define dct_wadd(out, a, b) \
int32x4_t out##_l = vaddq_s32(a##_l, b##_l); \
int32x4_t out##_h = vaddq_s32(a##_h, b##_h)
/* wide sub */
#define dct_wsub(out, a, b) \
int32x4_t out##_l = vsubq_s32(a##_l, b##_l); \
int32x4_t out##_h = vsubq_s32(a##_h, b##_h)
// butterfly a/b, then shift using "shiftop" by "s" and pack
#define dct_bfly32o(out0,out1, a,b,shiftop,s) \
{ \
dct_wadd(sum, a, b); \
dct_wsub(dif, a, b); \
out0 = vcombine_s16(shiftop(sum_l, s), shiftop(sum_h, s)); \
out1 = vcombine_s16(shiftop(dif_l, s), shiftop(dif_h, s)); \
}
#define dct_pass(shiftop, shift) \
{ \
/* even part */ \
int16x8_t sum26 = vaddq_s16(row2, row6); \
dct_long_mul(p1e, sum26, rot0_0); \
dct_long_mac(t2e, p1e, row6, rot0_1); \
dct_long_mac(t3e, p1e, row2, rot0_2); \
int16x8_t sum04 = vaddq_s16(row0, row4); \
int16x8_t dif04 = vsubq_s16(row0, row4); \
dct_widen(t0e, sum04); \
dct_widen(t1e, dif04); \
dct_wadd(x0, t0e, t3e); \
dct_wsub(x3, t0e, t3e); \
dct_wadd(x1, t1e, t2e); \
dct_wsub(x2, t1e, t2e); \
/* odd part */ \
int16x8_t sum15 = vaddq_s16(row1, row5); \
int16x8_t sum17 = vaddq_s16(row1, row7); \
int16x8_t sum35 = vaddq_s16(row3, row5); \
int16x8_t sum37 = vaddq_s16(row3, row7); \
int16x8_t sumodd = vaddq_s16(sum17, sum35); \
dct_long_mul(p5o, sumodd, rot1_0); \
dct_long_mac(p1o, p5o, sum17, rot1_1); \
dct_long_mac(p2o, p5o, sum35, rot1_2); \
dct_long_mul(p3o, sum37, rot2_0); \
dct_long_mul(p4o, sum15, rot2_1); \
dct_wadd(sump13o, p1o, p3o); \
dct_wadd(sump24o, p2o, p4o); \
dct_wadd(sump23o, p2o, p3o); \
dct_wadd(sump14o, p1o, p4o); \
dct_long_mac(x4, sump13o, row7, rot3_0); \
dct_long_mac(x5, sump24o, row5, rot3_1); \
dct_long_mac(x6, sump23o, row3, rot3_2); \
dct_long_mac(x7, sump14o, row1, rot3_3); \
dct_bfly32o(row0,row7, x0,x7,shiftop,shift); \
dct_bfly32o(row1,row6, x1,x6,shiftop,shift); \
dct_bfly32o(row2,row5, x2,x5,shiftop,shift); \
dct_bfly32o(row3,row4, x3,x4,shiftop,shift); \
}
// load
row0 = vld1q_s16(data + 0*8);
row1 = vld1q_s16(data + 1*8);
row2 = vld1q_s16(data + 2*8);
row3 = vld1q_s16(data + 3*8);
row4 = vld1q_s16(data + 4*8);
row5 = vld1q_s16(data + 5*8);
row6 = vld1q_s16(data + 6*8);
row7 = vld1q_s16(data + 7*8);
// add DC bias
row0 = vaddq_s16(row0, vsetq_lane_s16(1024, vdupq_n_s16(0), 0));
// column pass
dct_pass(vrshrn_n_s32, 10);
// 16bit 8x8 transpose
{
// these three map to a single VTRN.16, VTRN.32, and VSWP, respectively.
// whether compilers actually get this is another story, sadly.
#define dct_trn16(x, y) { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; }
#define dct_trn32(x, y) { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); }
#define dct_trn64(x, y) { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); }
// pass 1
dct_trn16(row0, row1); // a0b0a2b2a4b4a6b6
dct_trn16(row2, row3);
dct_trn16(row4, row5);
dct_trn16(row6, row7);
// pass 2
dct_trn32(row0, row2); // a0b0c0d0a4b4c4d4
dct_trn32(row1, row3);
dct_trn32(row4, row6);
dct_trn32(row5, row7);
// pass 3
dct_trn64(row0, row4); // a0b0c0d0e0f0g0h0
dct_trn64(row1, row5);
dct_trn64(row2, row6);
dct_trn64(row3, row7);
#undef dct_trn16
#undef dct_trn32
#undef dct_trn64
}
// row pass
// vrshrn_n_s32 only supports shifts up to 16, we need
// 17. so do a non-rounding shift of 16 first then follow
// up with a rounding shift by 1.
dct_pass(vshrn_n_s32, 16);
{
/* pack and round */
uint8x8_t p0 = vqrshrun_n_s16(row0, 1);
uint8x8_t p1 = vqrshrun_n_s16(row1, 1);
uint8x8_t p2 = vqrshrun_n_s16(row2, 1);
uint8x8_t p3 = vqrshrun_n_s16(row3, 1);
uint8x8_t p4 = vqrshrun_n_s16(row4, 1);
uint8x8_t p5 = vqrshrun_n_s16(row5, 1);
uint8x8_t p6 = vqrshrun_n_s16(row6, 1);
uint8x8_t p7 = vqrshrun_n_s16(row7, 1);
/* again, these can translate into one instruction, but often don't. */
#define dct_trn8_8(x, y) { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; }
#define dct_trn8_16(x, y) { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); }
#define dct_trn8_32(x, y) { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); }
/* sadly can't use interleaved stores here since we only write
* 8 bytes to each scan line! */
/* 8x8 8-bit transpose pass 1 */
dct_trn8_8(p0, p1);
dct_trn8_8(p2, p3);
dct_trn8_8(p4, p5);
dct_trn8_8(p6, p7);
/* pass 2 */
dct_trn8_16(p0, p2);
dct_trn8_16(p1, p3);
dct_trn8_16(p4, p6);
dct_trn8_16(p5, p7);
/* pass 3 */
dct_trn8_32(p0, p4);
dct_trn8_32(p1, p5);
dct_trn8_32(p2, p6);
dct_trn8_32(p3, p7);
/* store */
vst1_u8(out, p0); out += out_stride;
vst1_u8(out, p1); out += out_stride;
vst1_u8(out, p2); out += out_stride;
vst1_u8(out, p3); out += out_stride;
vst1_u8(out, p4); out += out_stride;
vst1_u8(out, p5); out += out_stride;
vst1_u8(out, p6); out += out_stride;
vst1_u8(out, p7);
#undef dct_trn8_8
#undef dct_trn8_16
#undef dct_trn8_32
}
#undef dct_long_mul
#undef dct_long_mac
#undef dct_widen
#undef dct_wadd
#undef dct_wsub
#undef dct_bfly32o
#undef dct_pass
}
#endif /* STBI_NEON */
#define STBI__MARKER_none 0xff
/* if there's a pending marker from the entropy stream, return that
* otherwise, fetch from the stream and get a marker. if there's no
* marker, return 0xff, which is never a valid marker value
*/
static stbi_uc stbi__get_marker(stbi__jpeg *j)
{
stbi_uc x;
if (j->marker != STBI__MARKER_none) { x = j->marker; j->marker = STBI__MARKER_none; return x; }
x = stbi__get8(j->s);
if (x != 0xff) return STBI__MARKER_none;
while (x == 0xff)
x = stbi__get8(j->s);
return x;
}
/* in each scan, we'll have scan_n components, and the order
* of the components is specified by order[]
*/
#define STBI__RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7)
/* after a restart interval, stbi__jpeg_reset the entropy decoder and
* the dc prediction
*/
static void stbi__jpeg_reset(stbi__jpeg *j)
{
j->code_bits = 0;
j->code_buffer = 0;
j->nomore = 0;
j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = 0;
j->marker = STBI__MARKER_none;
j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff;
j->eob_run = 0;
// no more than 1<<31 MCUs if no restart_interal? that's plenty safe,
// since we don't even allow 1<<30 pixels
}
static int stbi__parse_entropy_coded_data(stbi__jpeg *z)
{
stbi__jpeg_reset(z);
if (!z->progressive) {
if (z->scan_n == 1) {
int i,j;
STBI_SIMD_ALIGN(short, data[64]);
int n = z->order[0];
// non-interleaved data, we just need to process one block at a time,
// in trivial scanline order
// number of blocks to do just depends on how many actual "pixels" this
// component has, independent of interleaved MCU blocking and such
int w = (z->img_comp[n].x+7) >> 3;
int h = (z->img_comp[n].y+7) >> 3;
for (j=0; j < h; ++j) {
for (i=0; i < w; ++i) {
int ha = z->img_comp[n].ha;
if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0;
z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data);
// every data block is an MCU, so countdown the restart interval
if (--z->todo <= 0) {
if (z->code_bits < 24) stbi__grow_buffer_unsafe(z);
// if it's NOT a restart, then just bail, so we get corrupt data
// rather than no data
if (!STBI__RESTART(z->marker)) return 1;
stbi__jpeg_reset(z);
}
}
}
return 1;
} else { // interleaved
int i,j,k,x,y;
STBI_SIMD_ALIGN(short, data[64]);
for (j=0; j < z->img_mcu_y; ++j) {
for (i=0; i < z->img_mcu_x; ++i) {
// scan an interleaved mcu... process scan_n components in order
for (k=0; k < z->scan_n; ++k) {
int n = z->order[k];
// scan out an mcu's worth of this component; that's just determined
// by the basic H and V specified for the component
for (y=0; y < z->img_comp[n].v; ++y) {
for (x=0; x < z->img_comp[n].h; ++x) {
int x2 = (i*z->img_comp[n].h + x)*8;
int y2 = (j*z->img_comp[n].v + y)*8;
int ha = z->img_comp[n].ha;
if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0;
z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data);
}
}
}
// after all interleaved components, that's an interleaved MCU,
// so now count down the restart interval
if (--z->todo <= 0) {
if (z->code_bits < 24) stbi__grow_buffer_unsafe(z);
if (!STBI__RESTART(z->marker)) return 1;
stbi__jpeg_reset(z);
}
}
}
return 1;
}
} else {
if (z->scan_n == 1) {
int i,j;
int n = z->order[0];
// non-interleaved data, we just need to process one block at a time,
// in trivial scanline order
// number of blocks to do just depends on how many actual "pixels" this
// component has, independent of interleaved MCU blocking and such
int w = (z->img_comp[n].x+7) >> 3;
int h = (z->img_comp[n].y+7) >> 3;
for (j=0; j < h; ++j) {
for (i=0; i < w; ++i) {
short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w);
if (z->spec_start == 0) {
if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n))
return 0;
} else {
int ha = z->img_comp[n].ha;
if (!stbi__jpeg_decode_block_prog_ac(z, data, &z->huff_ac[ha], z->fast_ac[ha]))
return 0;
}
// every data block is an MCU, so countdown the restart interval
if (--z->todo <= 0) {
if (z->code_bits < 24) stbi__grow_buffer_unsafe(z);
if (!STBI__RESTART(z->marker)) return 1;
stbi__jpeg_reset(z);
}
}
}
return 1;
} else { // interleaved
int i,j,k,x,y;
for (j=0; j < z->img_mcu_y; ++j) {
for (i=0; i < z->img_mcu_x; ++i) {
// scan an interleaved mcu... process scan_n components in order
for (k=0; k < z->scan_n; ++k) {
int n = z->order[k];
// scan out an mcu's worth of this component; that's just determined
// by the basic H and V specified for the component
for (y=0; y < z->img_comp[n].v; ++y) {
for (x=0; x < z->img_comp[n].h; ++x) {
int x2 = (i*z->img_comp[n].h + x);
int y2 = (j*z->img_comp[n].v + y);
short *data = z->img_comp[n].coeff + 64 * (x2 + y2 * z->img_comp[n].coeff_w);
if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n))
return 0;
}
}
}
// after all interleaved components, that's an interleaved MCU,
// so now count down the restart interval
if (--z->todo <= 0) {
if (z->code_bits < 24) stbi__grow_buffer_unsafe(z);
if (!STBI__RESTART(z->marker)) return 1;
stbi__jpeg_reset(z);
}
}
}
return 1;
}
}
}
static void stbi__jpeg_dequantize(short *data, stbi_uc *dequant)
{
int i;
for (i=0; i < 64; ++i)
data[i] *= dequant[i];
}
static void stbi__jpeg_finish(stbi__jpeg *z)
{
if (z->progressive) {
// dequantize and idct the data
int i,j,n;
for (n=0; n < z->s->img_n; ++n) {
int w = (z->img_comp[n].x+7) >> 3;
int h = (z->img_comp[n].y+7) >> 3;
for (j=0; j < h; ++j) {
for (i=0; i < w; ++i) {
short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w);
stbi__jpeg_dequantize(data, z->dequant[z->img_comp[n].tq]);
z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data);
}
}
}
}
}
static int stbi__process_marker(stbi__jpeg *z, int m)
{
int L;
switch (m) {
case STBI__MARKER_none: // no marker found
return stbi__err("expected marker","Corrupt JPEG");
case 0xDD: // DRI - specify restart interval
if (stbi__get16be(z->s) != 4) return stbi__err("bad DRI len","Corrupt JPEG");
z->restart_interval = stbi__get16be(z->s);
return 1;
case 0xDB: // DQT - define quantization table
L = stbi__get16be(z->s)-2;
while (L > 0) {
int q = stbi__get8(z->s);
int p = q >> 4;
int t = q & 15,i;
if (p != 0) return stbi__err("bad DQT type","Corrupt JPEG");
if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG");
for (i=0; i < 64; ++i)
z->dequant[t][stbi__jpeg_dezigzag[i]] = stbi__get8(z->s);
L -= 65;
}
return L==0;
case 0xC4: // DHT - define huffman table
L = stbi__get16be(z->s)-2;
while (L > 0) {
stbi_uc *v;
int sizes[16],i,n=0;
int q = stbi__get8(z->s);
int tc = q >> 4;
int th = q & 15;
if (tc > 1 || th > 3) return stbi__err("bad DHT header","Corrupt JPEG");
for (i=0; i < 16; ++i) {
sizes[i] = stbi__get8(z->s);
n += sizes[i];
}
L -= 17;
if (tc == 0) {
if (!stbi__build_huffman(z->huff_dc+th, sizes)) return 0;
v = z->huff_dc[th].values;
} else {
if (!stbi__build_huffman(z->huff_ac+th, sizes)) return 0;
v = z->huff_ac[th].values;
}
for (i=0; i < n; ++i)
v[i] = stbi__get8(z->s);
if (tc != 0)
stbi__build_fast_ac(z->fast_ac[th], z->huff_ac + th);
L -= n;
}
return L==0;
}
// check for comment block or APP blocks
if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) {
stbi__skip(z->s, stbi__get16be(z->s)-2);
return 1;
}
return 0;
}
// after we see SOS
static int stbi__process_scan_header(stbi__jpeg *z)
{
int i;
int Ls = stbi__get16be(z->s);
z->scan_n = stbi__get8(z->s);
if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n) return stbi__err("bad SOS component count","Corrupt JPEG");
if (Ls != 6+2*z->scan_n) return stbi__err("bad SOS len","Corrupt JPEG");
for (i=0; i < z->scan_n; ++i) {
int id = stbi__get8(z->s), which;
int q = stbi__get8(z->s);
for (which = 0; which < z->s->img_n; ++which)
if (z->img_comp[which].id == id)
break;
if (which == z->s->img_n) return 0; // no match
z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return stbi__err("bad DC huff","Corrupt JPEG");
z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return stbi__err("bad AC huff","Corrupt JPEG");
z->order[i] = which;
}
{
int aa;
z->spec_start = stbi__get8(z->s);
z->spec_end = stbi__get8(z->s); // should be 63, but might be 0
aa = stbi__get8(z->s);
z->succ_high = (aa >> 4);
z->succ_low = (aa & 15);
if (z->progressive) {
if (z->spec_start > 63 || z->spec_end > 63 || z->spec_start > z->spec_end || z->succ_high > 13 || z->succ_low > 13)
return stbi__err("bad SOS", "Corrupt JPEG");
} else {
if (z->spec_start != 0) return stbi__err("bad SOS","Corrupt JPEG");
if (z->succ_high != 0 || z->succ_low != 0) return stbi__err("bad SOS","Corrupt JPEG");
z->spec_end = 63;
}
}
return 1;
}
static int stbi__process_frame_header(stbi__jpeg *z, int scan)
{
stbi__context *s = z->s;
int Lf,p,i,q, h_max=1,v_max=1,c;
Lf = stbi__get16be(s); if (Lf < 11) return stbi__err("bad SOF len","Corrupt JPEG"); // JPEG
p = stbi__get8(s); if (p != 8) return stbi__err("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline
s->img_y = stbi__get16be(s); if (s->img_y == 0) return stbi__err("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG
s->img_x = stbi__get16be(s); if (s->img_x == 0) return stbi__err("0 width","Corrupt JPEG"); // JPEG requires
c = stbi__get8(s);
if (c != 3 && c != 1) return stbi__err("bad component count","Corrupt JPEG"); // JFIF requires
s->img_n = c;
for (i=0; i < c; ++i) {
z->img_comp[i].data = NULL;
z->img_comp[i].linebuf = NULL;
}
if (Lf != 8+3*s->img_n) return stbi__err("bad SOF len","Corrupt JPEG");
for (i=0; i < s->img_n; ++i) {
z->img_comp[i].id = stbi__get8(s);
if (z->img_comp[i].id != i+1) // JFIF requires
if (z->img_comp[i].id != i) // some version of jpegtran outputs non-JFIF-compliant files!
return stbi__err("bad component ID","Corrupt JPEG");
q = stbi__get8(s);
z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return stbi__err("bad H","Corrupt JPEG");
z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return stbi__err("bad V","Corrupt JPEG");
z->img_comp[i].tq = stbi__get8(s); if (z->img_comp[i].tq > 3) return stbi__err("bad TQ","Corrupt JPEG");
}
if (scan != STBI__SCAN_load) return 1;
if ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err("too large", "Image too large to decode");
for (i=0; i < s->img_n; ++i) {
if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h;
if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v;
}
// compute interleaved mcu info
z->img_h_max = h_max;
z->img_v_max = v_max;
z->img_mcu_w = h_max * 8;
z->img_mcu_h = v_max * 8;
z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w;
z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h;
for (i=0; i < s->img_n; ++i) {
// number of effective pixels (e.g. for non-interleaved MCU)
z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max;
z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max;
// to simplify generation, we'll allocate enough memory to decode
// the bogus oversized data from using interleaved MCUs and their
// big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't
// discard the extra data until colorspace conversion
z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8;
z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8;
z->img_comp[i].raw_data = stbi__malloc(z->img_comp[i].w2 * z->img_comp[i].h2+15);
if (z->img_comp[i].raw_data == NULL) {
for(--i; i >= 0; --i) {
STBI_FREE(z->img_comp[i].raw_data);
z->img_comp[i].data = NULL;
}
return stbi__err("outofmem", "Out of memory");
}
// align blocks for idct using mmx/sse
z->img_comp[i].data = (stbi_uc*) (((size_t) z->img_comp[i].raw_data + 15) & ~15);
z->img_comp[i].linebuf = NULL;
if (z->progressive) {
z->img_comp[i].coeff_w = (z->img_comp[i].w2 + 7) >> 3;
z->img_comp[i].coeff_h = (z->img_comp[i].h2 + 7) >> 3;
z->img_comp[i].raw_coeff = STBI_MALLOC(z->img_comp[i].coeff_w * z->img_comp[i].coeff_h * 64 * sizeof(short) + 15);
z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15);
} else {
z->img_comp[i].coeff = 0;
z->img_comp[i].raw_coeff = 0;
}
}
return 1;
}
// use comparisons since in some cases we handle more than one case (e.g. SOF)
#define stbi__DNL(x) ((x) == 0xdc)
#define stbi__SOI(x) ((x) == 0xd8)
#define stbi__EOI(x) ((x) == 0xd9)
#define stbi__SOF(x) ((x) == 0xc0 || (x) == 0xc1 || (x) == 0xc2)
#define stbi__SOS(x) ((x) == 0xda)
#define stbi__SOF_progressive(x) ((x) == 0xc2)
static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan)
{
int m;
z->marker = STBI__MARKER_none; // initialize cached marker to empty
m = stbi__get_marker(z);
if (!stbi__SOI(m)) return stbi__err("no SOI","Corrupt JPEG");
if (scan == STBI__SCAN_type) return 1;
m = stbi__get_marker(z);
while (!stbi__SOF(m)) {
if (!stbi__process_marker(z,m)) return 0;
m = stbi__get_marker(z);
while (m == STBI__MARKER_none) {
// some files have extra padding after their blocks, so ok, we'll scan
if (stbi__at_eof(z->s)) return stbi__err("no SOF", "Corrupt JPEG");
m = stbi__get_marker(z);
}
}
z->progressive = stbi__SOF_progressive(m);
if (!stbi__process_frame_header(z, scan)) return 0;
return 1;
}
// decode image to YCbCr format
static int stbi__decode_jpeg_image(stbi__jpeg *j)
{
int m;
for (m = 0; m < 4; m++) {
j->img_comp[m].raw_data = NULL;
j->img_comp[m].raw_coeff = NULL;
}
j->restart_interval = 0;
if (!stbi__decode_jpeg_header(j, STBI__SCAN_load)) return 0;
m = stbi__get_marker(j);
while (!stbi__EOI(m)) {
if (stbi__SOS(m)) {
if (!stbi__process_scan_header(j)) return 0;
if (!stbi__parse_entropy_coded_data(j)) return 0;
if (j->marker == STBI__MARKER_none ) {
// handle 0s at the end of image data from IP Kamera 9060
while (!stbi__at_eof(j->s)) {
int x = stbi__get8(j->s);
if (x == 255) {
j->marker = stbi__get8(j->s);
break;
} else if (x != 0) {
return stbi__err("junk before marker", "Corrupt JPEG");
}
}
// if we reach eof without hitting a marker, stbi__get_marker() below will fail and we'll eventually return 0
}
} else {
if (!stbi__process_marker(j, m)) return 0;
}
m = stbi__get_marker(j);
}
if (j->progressive)
stbi__jpeg_finish(j);
return 1;
}
// static jfif-centered resampling (across block boundaries)
typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_uc *in1,
int w, int hs);
#define stbi__div4(x) ((stbi_uc) ((x) >> 2))
static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
{
STBI_NOTUSED(out);
STBI_NOTUSED(in_far);
STBI_NOTUSED(w);
STBI_NOTUSED(hs);
return in_near;
}
static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
{
// need to generate two samples vertically for every one in input
int i;
STBI_NOTUSED(hs);
for (i=0; i < w; ++i)
out[i] = stbi__div4(3*in_near[i] + in_far[i] + 2);
return out;
}
static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
{
// need to generate two samples horizontally for every one in input
int i;
stbi_uc *input = in_near;
if (w == 1) {
// if only one sample, can't do any interpolation
out[0] = out[1] = input[0];
return out;
}
out[0] = input[0];
out[1] = stbi__div4(input[0]*3 + input[1] + 2);
for (i=1; i < w-1; ++i) {
int n = 3*input[i]+2;
out[i*2+0] = stbi__div4(n+input[i-1]);
out[i*2+1] = stbi__div4(n+input[i+1]);
}
out[i*2+0] = stbi__div4(input[w-2]*3 + input[w-1] + 2);
out[i*2+1] = input[w-1];
STBI_NOTUSED(in_far);
STBI_NOTUSED(hs);
return out;
}
#define stbi__div16(x) ((stbi_uc) ((x) >> 4))
static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
{
// need to generate 2x2 samples for every one in input
int i,t0,t1;
if (w == 1) {
out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2);
return out;
}
t1 = 3*in_near[0] + in_far[0];
out[0] = stbi__div4(t1+2);
for (i=1; i < w; ++i) {
t0 = t1;
t1 = 3*in_near[i]+in_far[i];
out[i*2-1] = stbi__div16(3*t0 + t1 + 8);
out[i*2 ] = stbi__div16(3*t1 + t0 + 8);
}
out[w*2-1] = stbi__div4(t1+2);
STBI_NOTUSED(hs);
return out;
}
#if defined(STBI_SSE2) || defined(STBI_NEON)
static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
{
/* need to generate 2x2 samples for every one in input */
int i=0,t0,t1;
if (w == 1) {
out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2);
return out;
}
t1 = 3*in_near[0] + in_far[0];
/* process groups of 8 pixels for as long as we can.
* note we can't handle the last pixel in a row in this loop
* because we need to handle the filter boundary conditions.
*/
for (; i < ((w-1) & ~7); i += 8)
{
#if defined(STBI_SSE2)
/* load and perform the vertical filtering pass
* this uses 3*x + y = 4*x + (y - x) */
__m128i zero = _mm_setzero_si128();
__m128i farb = _mm_loadl_epi64((__m128i *) (in_far + i));
__m128i nearb = _mm_loadl_epi64((__m128i *) (in_near + i));
__m128i farw = _mm_unpacklo_epi8(farb, zero);
__m128i nearw = _mm_unpacklo_epi8(nearb, zero);
__m128i diff = _mm_sub_epi16(farw, nearw);
__m128i nears = _mm_slli_epi16(nearw, 2);
__m128i curr = _mm_add_epi16(nears, diff); /* current row */
/* horizontal filter works the same based on shifted vers of current
* row. "prev" is current row shifted right by 1 pixel; we need to
* insert the previous pixel value (from t1).
* "next" is current row shifted left by 1 pixel, with first pixel
* of next block of 8 pixels added in.
*/
__m128i prv0 = _mm_slli_si128(curr, 2);
__m128i nxt0 = _mm_srli_si128(curr, 2);
__m128i prev = _mm_insert_epi16(prv0, t1, 0);
__m128i next = _mm_insert_epi16(nxt0, 3*in_near[i+8] + in_far[i+8], 7);
/* horizontal filter, polyphase implementation since it's convenient:
* even pixels = 3*cur + prev = cur*4 + (prev - cur)
* odd pixels = 3*cur + next = cur*4 + (next - cur)
* note the shared term. */
__m128i bias = _mm_set1_epi16(8);
__m128i curs = _mm_slli_epi16(curr, 2);
__m128i prvd = _mm_sub_epi16(prev, curr);
__m128i nxtd = _mm_sub_epi16(next, curr);
__m128i curb = _mm_add_epi16(curs, bias);
__m128i even = _mm_add_epi16(prvd, curb);
__m128i odd = _mm_add_epi16(nxtd, curb);
/* interleave even and odd pixels, then undo scaling. */
__m128i int0 = _mm_unpacklo_epi16(even, odd);
__m128i int1 = _mm_unpackhi_epi16(even, odd);
__m128i de0 = _mm_srli_epi16(int0, 4);
__m128i de1 = _mm_srli_epi16(int1, 4);
/* pack and write output */
__m128i outv = _mm_packus_epi16(de0, de1);
_mm_storeu_si128((__m128i *) (out + i*2), outv);
#elif defined(STBI_NEON)
// load and perform the vertical filtering pass
// this uses 3*x + y = 4*x + (y - x)
uint8x8_t farb = vld1_u8(in_far + i);
uint8x8_t nearb = vld1_u8(in_near + i);
int16x8_t diff = vreinterpretq_s16_u16(vsubl_u8(farb, nearb));
int16x8_t nears = vreinterpretq_s16_u16(vshll_n_u8(nearb, 2));
int16x8_t curr = vaddq_s16(nears, diff); // current row
// horizontal filter works the same based on shifted vers of current
// row. "prev" is current row shifted right by 1 pixel; we need to
// insert the previous pixel value (from t1).
// "next" is current row shifted left by 1 pixel, with first pixel
// of next block of 8 pixels added in.
int16x8_t prv0 = vextq_s16(curr, curr, 7);
int16x8_t nxt0 = vextq_s16(curr, curr, 1);
int16x8_t prev = vsetq_lane_s16(t1, prv0, 0);
int16x8_t next = vsetq_lane_s16(3*in_near[i+8] + in_far[i+8], nxt0, 7);
/* horizontal filter, polyphase implementation since it's convenient:
* even pixels = 3*cur + prev = cur*4 + (prev - cur)
* odd pixels = 3*cur + next = cur*4 + (next - cur)
* note the shared term.
*/
int16x8_t curs = vshlq_n_s16(curr, 2);
int16x8_t prvd = vsubq_s16(prev, curr);
int16x8_t nxtd = vsubq_s16(next, curr);
int16x8_t even = vaddq_s16(curs, prvd);
int16x8_t odd = vaddq_s16(curs, nxtd);
/* undo scaling and round, then store with even/odd phases interleaved */
uint8x8x2_t o;
o.val[0] = vqrshrun_n_s16(even, 4);
o.val[1] = vqrshrun_n_s16(odd, 4);
vst2_u8(out + i*2, o);
#endif
/* "previous" value for next iteration */
t1 = 3*in_near[i+7] + in_far[i+7];
}
t0 = t1;
t1 = 3*in_near[i] + in_far[i];
out[i*2] = stbi__div16(3*t1 + t0 + 8);
for (++i; i < w; ++i) {
t0 = t1;
t1 = 3*in_near[i]+in_far[i];
out[i*2-1] = stbi__div16(3*t0 + t1 + 8);
out[i*2 ] = stbi__div16(3*t1 + t0 + 8);
}
out[w*2-1] = stbi__div4(t1+2);
STBI_NOTUSED(hs);
return out;
}
#endif
static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs)
{
/* resample with nearest-neighbor */
int i,j;
STBI_NOTUSED(in_far);
for (i=0; i < w; ++i)
for (j=0; j < hs; ++j)
out[i*hs+j] = in_near[i];
return out;
}
#ifdef STBI_JPEG_OLD
/* this is the same YCbCr-to-RGB calculation that stb_image has used
* historically before the algorithm changes in 1.49 */
#define float2fixed(x) ((int) ((x) * 65536 + 0.5))
static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step)
{
int i;
for (i=0; i < count; ++i) {
int y_fixed = (y[i] << 16) + 32768; // rounding
int r,g,b;
int cr = pcr[i] - 128;
int cb = pcb[i] - 128;
r = y_fixed + cr*float2fixed(1.40200f);
g = y_fixed - cr*float2fixed(0.71414f) - cb*float2fixed(0.34414f);
b = y_fixed + cb*float2fixed(1.77200f);
r >>= 16;
g >>= 16;
b >>= 16;
if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; }
if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; }
if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; }
out[0] = (stbi_uc)r;
out[1] = (stbi_uc)g;
out[2] = (stbi_uc)b;
out[3] = 255;
out += step;
}
}
#else
/* this is a reduced-precision calculation of YCbCr-to-RGB introduced
* to make sure the code produces the same results in both SIMD and scalar */
#define float2fixed(x) (((int) ((x) * 4096.0f + 0.5f)) << 8)
static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step)
{
int i;
for (i=0; i < count; ++i) {
int y_fixed = (y[i] << 20) + (1<<19); /* rounding */
int r,g,b;
int cr = pcr[i] - 128;
int cb = pcb[i] - 128;
r = y_fixed + cr* float2fixed(1.40200f);
g = y_fixed + (cr*-float2fixed(0.71414f)) + ((cb*-float2fixed(0.34414f)) & 0xffff0000);
b = y_fixed + cb* float2fixed(1.77200f);
r >>= 20;
g >>= 20;
b >>= 20;
if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; }
if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; }
if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; }
out[0] = (stbi_uc)r;
out[1] = (stbi_uc)g;
out[2] = (stbi_uc)b;
out[3] = 255;
out += step;
}
}
#endif
#if defined(STBI_SSE2) || defined(STBI_NEON)
static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi_uc const *pcb, stbi_uc const *pcr, int count, int step)
{
int i = 0;
#ifdef STBI_SSE2
/* step == 3 is pretty ugly on the final interleave, and i'm not convinced
* it's useful in practice (you wouldn't use it for textures, for example).
* so just accelerate step == 4 case.
*/
if (step == 4)
{
/* this is a fairly straightforward implementation and not super-optimized. */
__m128i signflip = _mm_set1_epi8(-0x80);
__m128i cr_const0 = _mm_set1_epi16( (short) ( 1.40200f*4096.0f+0.5f));
__m128i cr_const1 = _mm_set1_epi16( - (short) ( 0.71414f*4096.0f+0.5f));
__m128i cb_const0 = _mm_set1_epi16( - (short) ( 0.34414f*4096.0f+0.5f));
__m128i cb_const1 = _mm_set1_epi16( (short) ( 1.77200f*4096.0f+0.5f));
__m128i y_bias = _mm_set1_epi8((char) (unsigned char) 128);
__m128i xw = _mm_set1_epi16(255); /* alpha channel */
for (; i+7 < count; i += 8)
{
// load
__m128i y_bytes = _mm_loadl_epi64((__m128i *) (y+i));
__m128i cr_bytes = _mm_loadl_epi64((__m128i *) (pcr+i));
__m128i cb_bytes = _mm_loadl_epi64((__m128i *) (pcb+i));
__m128i cr_biased = _mm_xor_si128(cr_bytes, signflip); // -128
__m128i cb_biased = _mm_xor_si128(cb_bytes, signflip); // -128
// unpack to short (and left-shift cr, cb by 8)
__m128i yw = _mm_unpacklo_epi8(y_bias, y_bytes);
__m128i crw = _mm_unpacklo_epi8(_mm_setzero_si128(), cr_biased);
__m128i cbw = _mm_unpacklo_epi8(_mm_setzero_si128(), cb_biased);
// color transform
__m128i yws = _mm_srli_epi16(yw, 4);
__m128i cr0 = _mm_mulhi_epi16(cr_const0, crw);
__m128i cb0 = _mm_mulhi_epi16(cb_const0, cbw);
__m128i cb1 = _mm_mulhi_epi16(cbw, cb_const1);
__m128i cr1 = _mm_mulhi_epi16(crw, cr_const1);
__m128i rws = _mm_add_epi16(cr0, yws);
__m128i gwt = _mm_add_epi16(cb0, yws);
__m128i bws = _mm_add_epi16(yws, cb1);
__m128i gws = _mm_add_epi16(gwt, cr1);
// descale
__m128i rw = _mm_srai_epi16(rws, 4);
__m128i bw = _mm_srai_epi16(bws, 4);
__m128i gw = _mm_srai_epi16(gws, 4);
// back to byte, set up for transpose
__m128i brb = _mm_packus_epi16(rw, bw);
__m128i gxb = _mm_packus_epi16(gw, xw);
// transpose to interleave channels
__m128i t0 = _mm_unpacklo_epi8(brb, gxb);
__m128i t1 = _mm_unpackhi_epi8(brb, gxb);
__m128i o0 = _mm_unpacklo_epi16(t0, t1);
__m128i o1 = _mm_unpackhi_epi16(t0, t1);
// store
_mm_storeu_si128((__m128i *) (out + 0), o0);
_mm_storeu_si128((__m128i *) (out + 16), o1);
out += 32;
}
}
#endif
#ifdef STBI_NEON
// in this version, step=3 support would be easy to add. but is there demand?
if (step == 4) {
// this is a fairly straightforward implementation and not super-optimized.
uint8x8_t signflip = vdup_n_u8(0x80);
int16x8_t cr_const0 = vdupq_n_s16( (short) ( 1.40200f*4096.0f+0.5f));
int16x8_t cr_const1 = vdupq_n_s16( - (short) ( 0.71414f*4096.0f+0.5f));
int16x8_t cb_const0 = vdupq_n_s16( - (short) ( 0.34414f*4096.0f+0.5f));
int16x8_t cb_const1 = vdupq_n_s16( (short) ( 1.77200f*4096.0f+0.5f));
for (; i+7 < count; i += 8) {
// load
uint8x8_t y_bytes = vld1_u8(y + i);
uint8x8_t cr_bytes = vld1_u8(pcr + i);
uint8x8_t cb_bytes = vld1_u8(pcb + i);
int8x8_t cr_biased = vreinterpret_s8_u8(vsub_u8(cr_bytes, signflip));
int8x8_t cb_biased = vreinterpret_s8_u8(vsub_u8(cb_bytes, signflip));
// expand to s16
int16x8_t yws = vreinterpretq_s16_u16(vshll_n_u8(y_bytes, 4));
int16x8_t crw = vshll_n_s8(cr_biased, 7);
int16x8_t cbw = vshll_n_s8(cb_biased, 7);
// color transform
int16x8_t cr0 = vqdmulhq_s16(crw, cr_const0);
int16x8_t cb0 = vqdmulhq_s16(cbw, cb_const0);
int16x8_t cr1 = vqdmulhq_s16(crw, cr_const1);
int16x8_t cb1 = vqdmulhq_s16(cbw, cb_const1);
int16x8_t rws = vaddq_s16(yws, cr0);
int16x8_t gws = vaddq_s16(vaddq_s16(yws, cb0), cr1);
int16x8_t bws = vaddq_s16(yws, cb1);
// undo scaling, round, convert to byte
uint8x8x4_t o;
o.val[0] = vqrshrun_n_s16(rws, 4);
o.val[1] = vqrshrun_n_s16(gws, 4);
o.val[2] = vqrshrun_n_s16(bws, 4);
o.val[3] = vdup_n_u8(255);
// store, interleaving r/g/b/a
vst4_u8(out, o);
out += 8*4;
}
}
#endif
for (; i < count; ++i) {
int y_fixed = (y[i] << 20) + (1<<19); // rounding
int r,g,b;
int cr = pcr[i] - 128;
int cb = pcb[i] - 128;
r = y_fixed + cr* float2fixed(1.40200f);
g = y_fixed + cr*-float2fixed(0.71414f) + ((cb*-float2fixed(0.34414f)) & 0xffff0000);
b = y_fixed + cb* float2fixed(1.77200f);
r >>= 20;
g >>= 20;
b >>= 20;
if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; }
if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; }
if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; }
out[0] = (stbi_uc)r;
out[1] = (stbi_uc)g;
out[2] = (stbi_uc)b;
out[3] = 255;
out += step;
}
}
#endif
/* set up the kernels */
static void stbi__setup_jpeg(stbi__jpeg *j)
{
j->idct_block_kernel = stbi__idct_block;
j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_row;
j->resample_row_hv_2_kernel = stbi__resample_row_hv_2;
#ifdef STBI_SSE2
if (stbi__sse2_available()) {
j->idct_block_kernel = stbi__idct_simd;
#ifndef STBI_JPEG_OLD
j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd;
#endif
j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd;
}
#endif
#ifdef STBI_NEON
j->idct_block_kernel = stbi__idct_simd;
#ifndef STBI_JPEG_OLD
j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd;
#endif
j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd;
#endif
}
/* clean up the temporary component buffers */
static void stbi__cleanup_jpeg(stbi__jpeg *j)
{
int i;
for (i=0; i < j->s->img_n; ++i) {
if (j->img_comp[i].raw_data) {
STBI_FREE(j->img_comp[i].raw_data);
j->img_comp[i].raw_data = NULL;
j->img_comp[i].data = NULL;
}
if (j->img_comp[i].raw_coeff) {
STBI_FREE(j->img_comp[i].raw_coeff);
j->img_comp[i].raw_coeff = 0;
j->img_comp[i].coeff = 0;
}
if (j->img_comp[i].linebuf) {
STBI_FREE(j->img_comp[i].linebuf);
j->img_comp[i].linebuf = NULL;
}
}
}
typedef struct
{
resample_row_func resample;
stbi_uc *line0,*line1;
int hs,vs; // expansion factor in each axis
int w_lores; // horizontal pixels pre-expansion
int ystep; // how far through vertical expansion we are
int ypos; // which pre-expansion row we're on
} stbi__resample;
static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp, int req_comp)
{
int n, decode_n;
z->s->img_n = 0; // make stbi__cleanup_jpeg safe
// validate req_comp
if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error");
// load a jpeg image from whichever source, but leave in YCbCr format
if (!stbi__decode_jpeg_image(z)) { stbi__cleanup_jpeg(z); return NULL; }
// determine actual number of components to generate
n = req_comp ? req_comp : z->s->img_n;
if (z->s->img_n == 3 && n < 3)
decode_n = 1;
else
decode_n = z->s->img_n;
// resample and color-convert
{
int k;
unsigned int i,j;
stbi_uc *output;
stbi_uc *coutput[4];
stbi__resample res_comp[4];
for (k=0; k < decode_n; ++k) {
stbi__resample *r = &res_comp[k];
// allocate line buffer big enough for upsampling off the edges
// with upsample factor of 4
z->img_comp[k].linebuf = (stbi_uc *) stbi__malloc(z->s->img_x + 3);
if (!z->img_comp[k].linebuf) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); }
r->hs = z->img_h_max / z->img_comp[k].h;
r->vs = z->img_v_max / z->img_comp[k].v;
r->ystep = r->vs >> 1;
r->w_lores = (z->s->img_x + r->hs-1) / r->hs;
r->ypos = 0;
r->line0 = r->line1 = z->img_comp[k].data;
if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1;
else if (r->hs == 1 && r->vs == 2) r->resample = stbi__resample_row_v_2;
else if (r->hs == 2 && r->vs == 1) r->resample = stbi__resample_row_h_2;
else if (r->hs == 2 && r->vs == 2) r->resample = z->resample_row_hv_2_kernel;
else r->resample = stbi__resample_row_generic;
}
// can't error after this so, this is safe
output = (stbi_uc *) stbi__malloc(n * z->s->img_x * z->s->img_y + 1);
if (!output) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); }
// now go ahead and resample
for (j=0; j < z->s->img_y; ++j) {
stbi_uc *out = output + n * z->s->img_x * j;
for (k=0; k < decode_n; ++k) {
stbi__resample *r = &res_comp[k];
int y_bot = r->ystep >= (r->vs >> 1);
coutput[k] = r->resample(z->img_comp[k].linebuf,
y_bot ? r->line1 : r->line0,
y_bot ? r->line0 : r->line1,
r->w_lores, r->hs);
if (++r->ystep >= r->vs) {
r->ystep = 0;
r->line0 = r->line1;
if (++r->ypos < z->img_comp[k].y)
r->line1 += z->img_comp[k].w2;
}
}
if (n >= 3) {
stbi_uc *y = coutput[0];
if (z->s->img_n == 3) {
z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n);
} else
for (i=0; i < z->s->img_x; ++i) {
out[0] = out[1] = out[2] = y[i];
out[3] = 255; // not used if n==3
out += n;
}
} else {
stbi_uc *y = coutput[0];
if (n == 1)
for (i=0; i < z->s->img_x; ++i) out[i] = y[i];
else
for (i=0; i < z->s->img_x; ++i) *out++ = y[i], *out++ = 255;
}
}
stbi__cleanup_jpeg(z);
*out_x = z->s->img_x;
*out_y = z->s->img_y;
if (comp) *comp = z->s->img_n; // report original components, not output
return output;
}
}
static unsigned char *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
stbi__jpeg j;
j.s = s;
stbi__setup_jpeg(&j);
return load_jpeg_image(&j, x,y,comp,req_comp);
}
static int stbi__jpeg_test(stbi__context *s)
{
int r;
stbi__jpeg j;
j.s = s;
stbi__setup_jpeg(&j);
r = stbi__decode_jpeg_header(&j, STBI__SCAN_type);
stbi__rewind(s);
return r;
}
static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp)
{
if (!stbi__decode_jpeg_header(j, STBI__SCAN_header)) {
stbi__rewind( j->s );
return 0;
}
if (x) *x = j->s->img_x;
if (y) *y = j->s->img_y;
if (comp) *comp = j->s->img_n;
return 1;
}
static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp)
{
stbi__jpeg j;
j.s = s;
return stbi__jpeg_info_raw(&j, x, y, comp);
}
#endif
// public domain zlib decode v0.2 Sean Barrett 2006-11-18
// simple implementation
// - all input must be provided in an upfront buffer
// - all output is written to a single output buffer (can malloc/realloc)
// performance
// - fast huffman
#ifndef STBI_NO_ZLIB
// fast-way is faster to check than jpeg huffman, but slow way is slower
#define STBI__ZFAST_BITS 9 // accelerate all cases in default tables
#define STBI__ZFAST_MASK ((1 << STBI__ZFAST_BITS) - 1)
// zlib-style huffman encoding
// (jpegs packs from left, zlib from right, so can't share code)
typedef struct
{
stbi__uint16 fast[1 << STBI__ZFAST_BITS];
stbi__uint16 firstcode[16];
int maxcode[17];
stbi__uint16 firstsymbol[16];
stbi_uc size[288];
stbi__uint16 value[288];
} stbi__zhuffman;
stbi_inline static int stbi__bitreverse16(int n)
{
n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1);
n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2);
n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4);
n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8);
return n;
}
stbi_inline static int stbi__bit_reverse(int v, int bits)
{
STBI_ASSERT(bits <= 16);
// to bit reverse n bits, reverse 16 and shift
// e.g. 11 bits, bit reverse and shift away 5
return stbi__bitreverse16(v) >> (16-bits);
}
static int stbi__zbuild_huffman(stbi__zhuffman *z, stbi_uc *sizelist, int num)
{
int i,k=0;
int code, next_code[16], sizes[17];
// DEFLATE spec for generating codes
memset(sizes, 0, sizeof(sizes));
memset(z->fast, 0, sizeof(z->fast));
for (i=0; i < num; ++i)
++sizes[sizelist[i]];
sizes[0] = 0;
for (i=1; i < 16; ++i)
if (sizes[i] > (1 << i))
return stbi__err("bad sizes", "Corrupt PNG");
code = 0;
for (i=1; i < 16; ++i) {
next_code[i] = code;
z->firstcode[i] = (stbi__uint16) code;
z->firstsymbol[i] = (stbi__uint16) k;
code = (code + sizes[i]);
if (sizes[i])
if (code-1 >= (1 << i)) return stbi__err("bad codelengths","Corrupt PNG");
z->maxcode[i] = code << (16-i); // preshift for inner loop
code <<= 1;
k += sizes[i];
}
z->maxcode[16] = 0x10000; // sentinel
for (i=0; i < num; ++i) {
int s = sizelist[i];
if (s) {
int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s];
stbi__uint16 fastv = (stbi__uint16) ((s << 9) | i);
z->size [c] = (stbi_uc ) s;
z->value[c] = (stbi__uint16) i;
if (s <= STBI__ZFAST_BITS) {
int k = stbi__bit_reverse(next_code[s],s);
while (k < (1 << STBI__ZFAST_BITS)) {
z->fast[k] = fastv;
k += (1 << s);
}
}
++next_code[s];
}
}
return 1;
}
// zlib-from-memory implementation for PNG reading
// because PNG allows splitting the zlib stream arbitrarily,
// and it's annoying structurally to have PNG call ZLIB call PNG,
// we require PNG read all the IDATs and combine them into a single
// memory buffer
typedef struct
{
stbi_uc *zbuffer, *zbuffer_end;
int num_bits;
stbi__uint32 code_buffer;
char *zout;
char *zout_start;
char *zout_end;
int z_expandable;
stbi__zhuffman z_length, z_distance;
} stbi__zbuf;
stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z)
{
if (z->zbuffer >= z->zbuffer_end) return 0;
return *z->zbuffer++;
}
static void stbi__fill_bits(stbi__zbuf *z)
{
do {
STBI_ASSERT(z->code_buffer < (1U << z->num_bits));
z->code_buffer |= stbi__zget8(z) << z->num_bits;
z->num_bits += 8;
} while (z->num_bits <= 24);
}
stbi_inline static unsigned int stbi__zreceive(stbi__zbuf *z, int n)
{
unsigned int k;
if (z->num_bits < n) stbi__fill_bits(z);
k = z->code_buffer & ((1 << n) - 1);
z->code_buffer >>= n;
z->num_bits -= n;
return k;
}
static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z)
{
int b,s,k;
// not resolved by fast table, so compute it the slow way
// use jpeg approach, which requires MSbits at top
k = stbi__bit_reverse(a->code_buffer, 16);
for (s=STBI__ZFAST_BITS+1; ; ++s)
if (k < z->maxcode[s])
break;
if (s == 16) return -1; // invalid code!
// code size is s, so:
b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];
STBI_ASSERT(z->size[b] == s);
a->code_buffer >>= s;
a->num_bits -= s;
return z->value[b];
}
stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffman *z)
{
int b,s;
if (a->num_bits < 16) stbi__fill_bits(a);
b = z->fast[a->code_buffer & STBI__ZFAST_MASK];
if (b) {
s = b >> 9;
a->code_buffer >>= s;
a->num_bits -= s;
return b & 511;
}
return stbi__zhuffman_decode_slowpath(a, z);
}
static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) // need to make room for n bytes
{
char *q;
int cur, limit;
z->zout = zout;
if (!z->z_expandable) return stbi__err("output buffer limit","Corrupt PNG");
cur = (int) (z->zout - z->zout_start);
limit = (int) (z->zout_end - z->zout_start);
while (cur + n > limit)
limit *= 2;
q = (char *) STBI_REALLOC(z->zout_start, limit);
if (q == NULL) return stbi__err("outofmem", "Out of memory");
z->zout_start = q;
z->zout = q + cur;
z->zout_end = q + limit;
return 1;
}
static int stbi__zlength_base[31] = {
3,4,5,6,7,8,9,10,11,13,
15,17,19,23,27,31,35,43,51,59,
67,83,99,115,131,163,195,227,258,0,0 };
static int stbi__zlength_extra[31]=
{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 };
static int stbi__zdist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,
257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0};
static int stbi__zdist_extra[32] =
{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
static int stbi__parse_huffman_block(stbi__zbuf *a)
{
char *zout = a->zout;
for(;;) {
int z = stbi__zhuffman_decode(a, &a->z_length);
if (z < 256) {
if (z < 0) return stbi__err("bad huffman code","Corrupt PNG"); // error in huffman codes
if (zout >= a->zout_end) {
if (!stbi__zexpand(a, zout, 1)) return 0;
zout = a->zout;
}
*zout++ = (char) z;
} else {
stbi_uc *p;
int len,dist;
if (z == 256) {
a->zout = zout;
return 1;
}
z -= 257;
len = stbi__zlength_base[z];
if (stbi__zlength_extra[z]) len += stbi__zreceive(a, stbi__zlength_extra[z]);
z = stbi__zhuffman_decode(a, &a->z_distance);
if (z < 0) return stbi__err("bad huffman code","Corrupt PNG");
dist = stbi__zdist_base[z];
if (stbi__zdist_extra[z]) dist += stbi__zreceive(a, stbi__zdist_extra[z]);
if (zout - a->zout_start < dist) return stbi__err("bad dist","Corrupt PNG");
if (zout + len > a->zout_end) {
if (!stbi__zexpand(a, zout, len)) return 0;
zout = a->zout;
}
p = (stbi_uc *) (zout - dist);
if (dist == 1) { // run of one byte; common in images.
stbi_uc v = *p;
if (len) { do *zout++ = v; while (--len); }
} else {
if (len) { do *zout++ = *p++; while (--len); }
}
}
}
}
static int stbi__compute_huffman_codes(stbi__zbuf *a)
{
static stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 };
stbi__zhuffman z_codelength;
stbi_uc lencodes[286+32+137];//padding for maximum single op
stbi_uc codelength_sizes[19];
int i,n;
int hlit = stbi__zreceive(a,5) + 257;
int hdist = stbi__zreceive(a,5) + 1;
int hclen = stbi__zreceive(a,4) + 4;
memset(codelength_sizes, 0, sizeof(codelength_sizes));
for (i=0; i < hclen; ++i) {
int s = stbi__zreceive(a,3);
codelength_sizes[length_dezigzag[i]] = (stbi_uc) s;
}
if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0;
n = 0;
while (n < hlit + hdist) {
int c = stbi__zhuffman_decode(a, &z_codelength);
if (c < 0 || c >= 19) return stbi__err("bad codelengths", "Corrupt PNG");
if (c < 16)
lencodes[n++] = (stbi_uc) c;
else if (c == 16) {
c = stbi__zreceive(a,2)+3;
memset(lencodes+n, lencodes[n-1], c);
n += c;
} else if (c == 17) {
c = stbi__zreceive(a,3)+3;
memset(lencodes+n, 0, c);
n += c;
} else {
STBI_ASSERT(c == 18);
c = stbi__zreceive(a,7)+11;
memset(lencodes+n, 0, c);
n += c;
}
}
if (n != hlit+hdist) return stbi__err("bad codelengths","Corrupt PNG");
if (!stbi__zbuild_huffman(&a->z_length, lencodes, hlit)) return 0;
if (!stbi__zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0;
return 1;
}
static int stbi__parse_uncomperssed_block(stbi__zbuf *a)
{
stbi_uc header[4];
int len,nlen,k;
if (a->num_bits & 7)
stbi__zreceive(a, a->num_bits & 7); // discard
// drain the bit-packed data into header
k = 0;
while (a->num_bits > 0) {
header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check
a->code_buffer >>= 8;
a->num_bits -= 8;
}
STBI_ASSERT(a->num_bits == 0);
// now fill header the normal way
while (k < 4)
header[k++] = stbi__zget8(a);
len = header[1] * 256 + header[0];
nlen = header[3] * 256 + header[2];
if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG");
if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG");
if (a->zout + len > a->zout_end)
if (!stbi__zexpand(a, a->zout, len)) return 0;
memcpy(a->zout, a->zbuffer, len);
a->zbuffer += len;
a->zout += len;
return 1;
}
static int stbi__parse_zlib_header(stbi__zbuf *a)
{
int cmf = stbi__zget8(a);
int cm = cmf & 15;
/* int cinfo = cmf >> 4; */
int flg = stbi__zget8(a);
if ((cmf*256+flg) % 31 != 0) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec
if (flg & 32) return stbi__err("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png
if (cm != 8) return stbi__err("bad compression","Corrupt PNG"); // DEFLATE required for png
// window = 1 << (8 + cinfo)... but who cares, we fully buffer output
return 1;
}
// @TODO: should statically initialize these for optimal thread safety
static stbi_uc stbi__zdefault_length[288], stbi__zdefault_distance[32];
static void stbi__init_zdefaults(void)
{
int i; // use <= to match clearly with spec
for (i=0; i <= 143; ++i) stbi__zdefault_length[i] = 8;
for ( ; i <= 255; ++i) stbi__zdefault_length[i] = 9;
for ( ; i <= 279; ++i) stbi__zdefault_length[i] = 7;
for ( ; i <= 287; ++i) stbi__zdefault_length[i] = 8;
for (i=0; i <= 31; ++i) stbi__zdefault_distance[i] = 5;
}
static int stbi__parse_zlib(stbi__zbuf *a, int parse_header)
{
int final, type;
if (parse_header)
if (!stbi__parse_zlib_header(a)) return 0;
a->num_bits = 0;
a->code_buffer = 0;
do {
final = stbi__zreceive(a,1);
type = stbi__zreceive(a,2);
if (type == 0) {
if (!stbi__parse_uncomperssed_block(a)) return 0;
} else if (type == 3) {
return 0;
} else {
if (type == 1) {
// use fixed code lengths
if (!stbi__zdefault_distance[31]) stbi__init_zdefaults();
if (!stbi__zbuild_huffman(&a->z_length , stbi__zdefault_length , 288)) return 0;
if (!stbi__zbuild_huffman(&a->z_distance, stbi__zdefault_distance, 32)) return 0;
} else {
if (!stbi__compute_huffman_codes(a)) return 0;
}
if (!stbi__parse_huffman_block(a)) return 0;
}
} while (!final);
return 1;
}
static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, int parse_header)
{
a->zout_start = obuf;
a->zout = obuf;
a->zout_end = obuf + olen;
a->z_expandable = exp;
return stbi__parse_zlib(a, parse_header);
}
STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen)
{
stbi__zbuf a;
char *p = (char *) stbi__malloc(initial_size);
if (p == NULL) return NULL;
a.zbuffer = (stbi_uc *) buffer;
a.zbuffer_end = (stbi_uc *) buffer + len;
if (stbi__do_zlib(&a, p, initial_size, 1, 1)) {
if (outlen) *outlen = (int) (a.zout - a.zout_start);
return a.zout_start;
} else {
STBI_FREE(a.zout_start);
return NULL;
}
}
STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen)
{
return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen);
}
STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header)
{
stbi__zbuf a;
char *p = (char *) stbi__malloc(initial_size);
if (p == NULL) return NULL;
a.zbuffer = (stbi_uc *) buffer;
a.zbuffer_end = (stbi_uc *) buffer + len;
if (stbi__do_zlib(&a, p, initial_size, 1, parse_header)) {
if (outlen) *outlen = (int) (a.zout - a.zout_start);
return a.zout_start;
} else {
STBI_FREE(a.zout_start);
return NULL;
}
}
STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen)
{
stbi__zbuf a;
a.zbuffer = (stbi_uc *) ibuffer;
a.zbuffer_end = (stbi_uc *) ibuffer + ilen;
if (stbi__do_zlib(&a, obuffer, olen, 0, 1))
return (int) (a.zout - a.zout_start);
else
return -1;
}
STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen)
{
stbi__zbuf a;
char *p = (char *) stbi__malloc(16384);
if (p == NULL) return NULL;
a.zbuffer = (stbi_uc *) buffer;
a.zbuffer_end = (stbi_uc *) buffer+len;
if (stbi__do_zlib(&a, p, 16384, 1, 0)) {
if (outlen) *outlen = (int) (a.zout - a.zout_start);
return a.zout_start;
} else {
STBI_FREE(a.zout_start);
return NULL;
}
}
STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen)
{
stbi__zbuf a;
a.zbuffer = (stbi_uc *) ibuffer;
a.zbuffer_end = (stbi_uc *) ibuffer + ilen;
if (stbi__do_zlib(&a, obuffer, olen, 0, 0))
return (int) (a.zout - a.zout_start);
else
return -1;
}
#endif
// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18
// simple implementation
// - only 8-bit samples
// - no CRC checking
// - allocates lots of intermediate memory
// - avoids problem of streaming data between subsystems
// - avoids explicit window management
// performance
// - uses stb_zlib, a PD zlib implementation with fast huffman decoding
#ifndef STBI_NO_PNG
typedef struct
{
stbi__uint32 length;
stbi__uint32 type;
} stbi__pngchunk;
static stbi__pngchunk stbi__get_chunk_header(stbi__context *s)
{
stbi__pngchunk c;
c.length = stbi__get32be(s);
c.type = stbi__get32be(s);
return c;
}
static int stbi__check_png_header(stbi__context *s)
{
static stbi_uc png_sig[8] = { 137,80,78,71,13,10,26,10 };
int i;
for (i=0; i < 8; ++i)
if (stbi__get8(s) != png_sig[i]) return stbi__err("bad png sig","Not a PNG");
return 1;
}
typedef struct
{
stbi__context *s;
stbi_uc *idata, *expanded, *out;
} stbi__png;
enum {
STBI__F_none=0,
STBI__F_sub=1,
STBI__F_up=2,
STBI__F_avg=3,
STBI__F_paeth=4,
// synthetic filters used for first scanline to avoid needing a dummy row of 0s
STBI__F_avg_first,
STBI__F_paeth_first
};
static stbi_uc first_row_filter[5] =
{
STBI__F_none,
STBI__F_sub,
STBI__F_none,
STBI__F_avg_first,
STBI__F_paeth_first
};
static int stbi__paeth(int a, int b, int c)
{
int p = a + b - c;
int pa = abs(p-a);
int pb = abs(p-b);
int pc = abs(p-c);
if (pa <= pb && pa <= pc) return a;
if (pb <= pc) return b;
return c;
}
static stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 };
// create the png data from post-deflated data
static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color)
{
stbi__context *s = a->s;
stbi__uint32 i,j,stride = x*out_n;
stbi__uint32 img_len, img_width_bytes;
int k;
int img_n = s->img_n; // copy it into a local for later
STBI_ASSERT(out_n == s->img_n || out_n == s->img_n+1);
a->out = (stbi_uc *) stbi__malloc(x * y * out_n); // extra bytes to write off the end into
if (!a->out) return stbi__err("outofmem", "Out of memory");
img_width_bytes = (((img_n * x * depth) + 7) >> 3);
img_len = (img_width_bytes + 1) * y;
if (s->img_x == x && s->img_y == y) {
if (raw_len != img_len) return stbi__err("not enough pixels","Corrupt PNG");
} else { // interlaced:
if (raw_len < img_len) return stbi__err("not enough pixels","Corrupt PNG");
}
for (j=0; j < y; ++j) {
stbi_uc *cur = a->out + stride*j;
stbi_uc *prior = cur - stride;
int filter = *raw++;
int filter_bytes = img_n;
int width = x;
if (filter > 4)
return stbi__err("invalid filter","Corrupt PNG");
if (depth < 8) {
STBI_ASSERT(img_width_bytes <= x);
cur += x*out_n - img_width_bytes; // store output to the rightmost img_len bytes, so we can decode in place
filter_bytes = 1;
width = img_width_bytes;
}
// if first row, use special filter that doesn't sample previous row
if (j == 0) filter = first_row_filter[filter];
// handle first byte explicitly
for (k=0; k < filter_bytes; ++k) {
switch (filter) {
case STBI__F_none : cur[k] = raw[k]; break;
case STBI__F_sub : cur[k] = raw[k]; break;
case STBI__F_up : cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
case STBI__F_avg : cur[k] = STBI__BYTECAST(raw[k] + (prior[k]>>1)); break;
case STBI__F_paeth : cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(0,prior[k],0)); break;
case STBI__F_avg_first : cur[k] = raw[k]; break;
case STBI__F_paeth_first: cur[k] = raw[k]; break;
}
}
if (depth == 8) {
if (img_n != out_n)
cur[img_n] = 255; // first pixel
raw += img_n;
cur += out_n;
prior += out_n;
} else {
raw += 1;
cur += 1;
prior += 1;
}
// this is a little gross, so that we don't switch per-pixel or per-component
if (depth < 8 || img_n == out_n) {
int nk = (width - 1)*img_n;
#define CASE(f) \
case f: \
for (k=0; k < nk; ++k)
switch (filter) {
// "none" filter turns into a memcpy here; make that explicit.
case STBI__F_none: memcpy(cur, raw, nk); break;
CASE(STBI__F_sub) cur[k] = STBI__BYTECAST(raw[k] + cur[k-filter_bytes]); break;
CASE(STBI__F_up) cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
CASE(STBI__F_avg) cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-filter_bytes])>>1)); break;
CASE(STBI__F_paeth) cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],prior[k],prior[k-filter_bytes])); break;
CASE(STBI__F_avg_first) cur[k] = STBI__BYTECAST(raw[k] + (cur[k-filter_bytes] >> 1)); break;
CASE(STBI__F_paeth_first) cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],0,0)); break;
}
#undef CASE
raw += nk;
} else {
STBI_ASSERT(img_n+1 == out_n);
#define CASE(f) \
case f: \
for (i=x-1; i >= 1; --i, cur[img_n]=255,raw+=img_n,cur+=out_n,prior+=out_n) \
for (k=0; k < img_n; ++k)
switch (filter) {
CASE(STBI__F_none) cur[k] = raw[k]; break;
CASE(STBI__F_sub) cur[k] = STBI__BYTECAST(raw[k] + cur[k-out_n]); break;
CASE(STBI__F_up) cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break;
CASE(STBI__F_avg) cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-out_n])>>1)); break;
CASE(STBI__F_paeth) cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-out_n],prior[k],prior[k-out_n])); break;
CASE(STBI__F_avg_first) cur[k] = STBI__BYTECAST(raw[k] + (cur[k-out_n] >> 1)); break;
CASE(STBI__F_paeth_first) cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-out_n],0,0)); break;
}
#undef CASE
}
}
// we make a separate pass to expand bits to pixels; for performance,
// this could run two scanlines behind the above code, so it won't
// intefere with filtering but will still be in the cache.
if (depth < 8) {
for (j=0; j < y; ++j) {
stbi_uc *cur = a->out + stride*j;
stbi_uc *in = a->out + stride*j + x*out_n - img_width_bytes;
// unpack 1/2/4-bit into a 8-bit buffer. allows us to keep the common 8-bit path optimal at minimal cost for 1/2/4-bit
// png guarante byte alignment, if width is not multiple of 8/4/2 we'll decode dummy trailing data that will be skipped in the later loop
stbi_uc scale = (color == 0) ? stbi__depth_scale_table[depth] : 1; // scale grayscale values to 0..255 range
// note that the final byte might overshoot and write more data than desired.
// we can allocate enough data that this never writes out of memory, but it
// could also overwrite the next scanline. can it overwrite non-empty data
// on the next scanline? yes, consider 1-pixel-wide scanlines with 1-bit-per-pixel.
// so we need to explicitly clamp the final ones
if (depth == 4) {
for (k=x*img_n; k >= 2; k-=2, ++in) {
*cur++ = scale * ((*in >> 4) );
*cur++ = scale * ((*in ) & 0x0f);
}
if (k > 0) *cur++ = scale * ((*in >> 4) );
} else if (depth == 2) {
for (k=x*img_n; k >= 4; k-=4, ++in) {
*cur++ = scale * ((*in >> 6) );
*cur++ = scale * ((*in >> 4) & 0x03);
*cur++ = scale * ((*in >> 2) & 0x03);
*cur++ = scale * ((*in ) & 0x03);
}
if (k > 0) *cur++ = scale * ((*in >> 6) );
if (k > 1) *cur++ = scale * ((*in >> 4) & 0x03);
if (k > 2) *cur++ = scale * ((*in >> 2) & 0x03);
} else if (depth == 1) {
for (k=x*img_n; k >= 8; k-=8, ++in) {
*cur++ = scale * ((*in >> 7) );
*cur++ = scale * ((*in >> 6) & 0x01);
*cur++ = scale * ((*in >> 5) & 0x01);
*cur++ = scale * ((*in >> 4) & 0x01);
*cur++ = scale * ((*in >> 3) & 0x01);
*cur++ = scale * ((*in >> 2) & 0x01);
*cur++ = scale * ((*in >> 1) & 0x01);
*cur++ = scale * ((*in ) & 0x01);
}
if (k > 0) *cur++ = scale * ((*in >> 7) );
if (k > 1) *cur++ = scale * ((*in >> 6) & 0x01);
if (k > 2) *cur++ = scale * ((*in >> 5) & 0x01);
if (k > 3) *cur++ = scale * ((*in >> 4) & 0x01);
if (k > 4) *cur++ = scale * ((*in >> 3) & 0x01);
if (k > 5) *cur++ = scale * ((*in >> 2) & 0x01);
if (k > 6) *cur++ = scale * ((*in >> 1) & 0x01);
}
if (img_n != out_n) {
// insert alpha = 255
stbi_uc *cur = a->out + stride*j;
int i;
if (img_n == 1) {
for (i=x-1; i >= 0; --i) {
cur[i*2+1] = 255;
cur[i*2+0] = cur[i];
}
} else {
STBI_ASSERT(img_n == 3);
for (i=x-1; i >= 0; --i) {
cur[i*4+3] = 255;
cur[i*4+2] = cur[i*3+2];
cur[i*4+1] = cur[i*3+1];
cur[i*4+0] = cur[i*3+0];
}
}
}
}
}
return 1;
}
static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stbi__uint32 image_data_len, int out_n, int depth, int color, int interlaced)
{
stbi_uc *final;
int p;
if (!interlaced)
return stbi__create_png_image_raw(a, image_data, image_data_len, out_n, a->s->img_x, a->s->img_y, depth, color);
// de-interlacing
final = (stbi_uc *) stbi__malloc(a->s->img_x * a->s->img_y * out_n);
for (p=0; p < 7; ++p) {
int xorig[] = { 0,4,0,2,0,1,0 };
int yorig[] = { 0,0,4,0,2,0,1 };
int xspc[] = { 8,8,4,4,2,2,1 };
int yspc[] = { 8,8,8,4,4,2,2 };
int i,j,x,y;
// pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1
x = (a->s->img_x - xorig[p] + xspc[p]-1) / xspc[p];
y = (a->s->img_y - yorig[p] + yspc[p]-1) / yspc[p];
if (x && y) {
stbi__uint32 img_len = ((((a->s->img_n * x * depth) + 7) >> 3) + 1) * y;
if (!stbi__create_png_image_raw(a, image_data, image_data_len, out_n, x, y, depth, color)) {
STBI_FREE(final);
return 0;
}
for (j=0; j < y; ++j) {
for (i=0; i < x; ++i) {
int out_y = j*yspc[p]+yorig[p];
int out_x = i*xspc[p]+xorig[p];
memcpy(final + out_y*a->s->img_x*out_n + out_x*out_n,
a->out + (j*x+i)*out_n, out_n);
}
}
STBI_FREE(a->out);
image_data += img_len;
image_data_len -= img_len;
}
}
a->out = final;
return 1;
}
static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int out_n)
{
stbi__context *s = z->s;
stbi__uint32 i, pixel_count = s->img_x * s->img_y;
stbi_uc *p = z->out;
// compute color-based transparency, assuming we've
// already got 255 as the alpha value in the output
STBI_ASSERT(out_n == 2 || out_n == 4);
if (out_n == 2) {
for (i=0; i < pixel_count; ++i) {
p[1] = (p[0] == tc[0] ? 0 : 255);
p += 2;
}
} else {
for (i=0; i < pixel_count; ++i) {
if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])
p[3] = 0;
p += 4;
}
}
return 1;
}
static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n)
{
stbi__uint32 i, pixel_count = a->s->img_x * a->s->img_y;
stbi_uc *p, *temp_out, *orig = a->out;
p = (stbi_uc *) stbi__malloc(pixel_count * pal_img_n);
if (p == NULL) return stbi__err("outofmem", "Out of memory");
// between here and free(out) below, exitting would leak
temp_out = p;
if (pal_img_n == 3) {
for (i=0; i < pixel_count; ++i) {
int n = orig[i]*4;
p[0] = palette[n ];
p[1] = palette[n+1];
p[2] = palette[n+2];
p += 3;
}
} else {
for (i=0; i < pixel_count; ++i) {
int n = orig[i]*4;
p[0] = palette[n ];
p[1] = palette[n+1];
p[2] = palette[n+2];
p[3] = palette[n+3];
p += 4;
}
}
STBI_FREE(a->out);
a->out = temp_out;
STBI_NOTUSED(len);
return 1;
}
static int stbi__unpremultiply_on_load = 0;
static int stbi__de_iphone_flag = 0;
STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply)
{
stbi__unpremultiply_on_load = flag_true_if_should_unpremultiply;
}
STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert)
{
stbi__de_iphone_flag = flag_true_if_should_convert;
}
static void stbi__de_iphone(stbi__png *z)
{
stbi__context *s = z->s;
stbi__uint32 i, pixel_count = s->img_x * s->img_y;
stbi_uc *p = z->out;
if (s->img_out_n == 3) { // convert bgr to rgb
for (i=0; i < pixel_count; ++i) {
stbi_uc t = p[0];
p[0] = p[2];
p[2] = t;
p += 3;
}
} else {
STBI_ASSERT(s->img_out_n == 4);
if (stbi__unpremultiply_on_load) {
// convert bgr to rgb and unpremultiply
for (i=0; i < pixel_count; ++i) {
stbi_uc a = p[3];
stbi_uc t = p[0];
if (a) {
p[0] = p[2] * 255 / a;
p[1] = p[1] * 255 / a;
p[2] = t * 255 / a;
} else {
p[0] = p[2];
p[2] = t;
}
p += 4;
}
} else {
// convert bgr to rgb
for (i=0; i < pixel_count; ++i) {
stbi_uc t = p[0];
p[0] = p[2];
p[2] = t;
p += 4;
}
}
}
}
#define STBI__PNG_TYPE(a,b,c,d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d))
static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)
{
stbi_uc palette[1024], pal_img_n=0;
stbi_uc has_trans=0, tc[3];
stbi__uint32 ioff=0, idata_limit=0, i, pal_len=0;
int first=1,k,interlace=0, color=0, depth=0, is_iphone=0;
stbi__context *s = z->s;
z->expanded = NULL;
z->idata = NULL;
z->out = NULL;
if (!stbi__check_png_header(s)) return 0;
if (scan == STBI__SCAN_type) return 1;
for (;;) {
stbi__pngchunk c = stbi__get_chunk_header(s);
switch (c.type) {
case STBI__PNG_TYPE('C','g','B','I'):
is_iphone = 1;
stbi__skip(s, c.length);
break;
case STBI__PNG_TYPE('I','H','D','R'): {
int comp,filter;
if (!first) return stbi__err("multiple IHDR","Corrupt PNG");
first = 0;
if (c.length != 13) return stbi__err("bad IHDR len","Corrupt PNG");
s->img_x = stbi__get32be(s); if (s->img_x > (1 << 24)) return stbi__err("too large","Very large image (corrupt?)");
s->img_y = stbi__get32be(s); if (s->img_y > (1 << 24)) return stbi__err("too large","Very large image (corrupt?)");
depth = stbi__get8(s); if (depth != 1 && depth != 2 && depth != 4 && depth != 8) return stbi__err("1/2/4/8-bit only","PNG not supported: 1/2/4/8-bit only");
color = stbi__get8(s); if (color > 6) return stbi__err("bad ctype","Corrupt PNG");
if (color == 3) pal_img_n = 3; else if (color & 1) return stbi__err("bad ctype","Corrupt PNG");
comp = stbi__get8(s); if (comp) return stbi__err("bad comp method","Corrupt PNG");
filter= stbi__get8(s); if (filter) return stbi__err("bad filter method","Corrupt PNG");
interlace = stbi__get8(s); if (interlace>1) return stbi__err("bad interlace method","Corrupt PNG");
if (!s->img_x || !s->img_y) return stbi__err("0-pixel image","Corrupt PNG");
if (!pal_img_n) {
s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);
if ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err("too large", "Image too large to decode");
if (scan == STBI__SCAN_header) return 1;
} else {
// if paletted, then pal_n is our final components, and
// img_n is # components to decompress/filter.
s->img_n = 1;
if ((1 << 30) / s->img_x / 4 < s->img_y) return stbi__err("too large","Corrupt PNG");
// if SCAN_header, have to scan to see if we have a tRNS
}
break;
}
case STBI__PNG_TYPE('P','L','T','E'): {
if (first) return stbi__err("first not IHDR", "Corrupt PNG");
if (c.length > 256*3) return stbi__err("invalid PLTE","Corrupt PNG");
pal_len = c.length / 3;
if (pal_len * 3 != c.length) return stbi__err("invalid PLTE","Corrupt PNG");
for (i=0; i < pal_len; ++i) {
palette[i*4+0] = stbi__get8(s);
palette[i*4+1] = stbi__get8(s);
palette[i*4+2] = stbi__get8(s);
palette[i*4+3] = 255;
}
break;
}
case STBI__PNG_TYPE('t','R','N','S'): {
if (first) return stbi__err("first not IHDR", "Corrupt PNG");
if (z->idata) return stbi__err("tRNS after IDAT","Corrupt PNG");
if (pal_img_n) {
if (scan == STBI__SCAN_header) { s->img_n = 4; return 1; }
if (pal_len == 0) return stbi__err("tRNS before PLTE","Corrupt PNG");
if (c.length > pal_len) return stbi__err("bad tRNS len","Corrupt PNG");
pal_img_n = 4;
for (i=0; i < c.length; ++i)
palette[i*4+3] = stbi__get8(s);
} else {
if (!(s->img_n & 1)) return stbi__err("tRNS with alpha","Corrupt PNG");
if (c.length != (stbi__uint32) s->img_n*2) return stbi__err("bad tRNS len","Corrupt PNG");
has_trans = 1;
for (k=0; k < s->img_n; ++k)
tc[k] = (stbi_uc) (stbi__get16be(s) & 255) * stbi__depth_scale_table[depth]; // non 8-bit images will be larger
}
break;
}
case STBI__PNG_TYPE('I','D','A','T'): {
if (first) return stbi__err("first not IHDR", "Corrupt PNG");
if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG");
if (scan == STBI__SCAN_header) { s->img_n = pal_img_n; return 1; }
if ((int)(ioff + c.length) < (int)ioff) return 0;
if (ioff + c.length > idata_limit) {
stbi_uc *p;
if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096;
while (ioff + c.length > idata_limit)
idata_limit *= 2;
p = (stbi_uc *) STBI_REALLOC(z->idata, idata_limit); if (p == NULL) return stbi__err("outofmem", "Out of memory");
z->idata = p;
}
if (!stbi__getn(s, z->idata+ioff,c.length)) return stbi__err("outofdata","Corrupt PNG");
ioff += c.length;
break;
}
case STBI__PNG_TYPE('I','E','N','D'): {
stbi__uint32 raw_len, bpl;
if (first) return stbi__err("first not IHDR", "Corrupt PNG");
if (scan != STBI__SCAN_load) return 1;
if (z->idata == NULL) return stbi__err("no IDAT","Corrupt PNG");
// initial guess for decoded data size to avoid unnecessary reallocs
bpl = (s->img_x * depth + 7) / 8; // bytes per line, per component
raw_len = bpl * s->img_y * s->img_n /* pixels */ + s->img_y /* filter mode per row */;
z->expanded = (stbi_uc *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, raw_len, (int *) &raw_len, !is_iphone);
if (z->expanded == NULL) return 0; // zlib should set error
STBI_FREE(z->idata); z->idata = NULL;
if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans)
s->img_out_n = s->img_n+1;
else
s->img_out_n = s->img_n;
if (!stbi__create_png_image(z, z->expanded, raw_len, s->img_out_n, depth, color, interlace)) return 0;
if (has_trans)
if (!stbi__compute_transparency(z, tc, s->img_out_n)) return 0;
if (is_iphone && stbi__de_iphone_flag && s->img_out_n > 2)
stbi__de_iphone(z);
if (pal_img_n) {
// pal_img_n == 3 or 4
s->img_n = pal_img_n; // record the actual colors we had
s->img_out_n = pal_img_n;
if (req_comp >= 3) s->img_out_n = req_comp;
if (!stbi__expand_png_palette(z, palette, pal_len, s->img_out_n))
return 0;
}
STBI_FREE(z->expanded); z->expanded = NULL;
return 1;
}
default:
// if critical, fail
if (first) return stbi__err("first not IHDR", "Corrupt PNG");
if ((c.type & (1 << 29)) == 0) {
#ifndef STBI_NO_FAILURE_STRINGS
// not threadsafe
static char invalid_chunk[] = "XXXX PNG chunk not known";
invalid_chunk[0] = STBI__BYTECAST(c.type >> 24);
invalid_chunk[1] = STBI__BYTECAST(c.type >> 16);
invalid_chunk[2] = STBI__BYTECAST(c.type >> 8);
invalid_chunk[3] = STBI__BYTECAST(c.type >> 0);
#endif
return stbi__err(invalid_chunk, "PNG not supported: unknown PNG chunk type");
}
stbi__skip(s, c.length);
break;
}
// end of PNG chunk, read and skip CRC
stbi__get32be(s);
}
}
static unsigned char *stbi__do_png(stbi__png *p, int *x, int *y, int *n, int req_comp)
{
unsigned char *result=NULL;
if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error");
if (stbi__parse_png_file(p, STBI__SCAN_load, req_comp)) {
result = p->out;
p->out = NULL;
if (req_comp && req_comp != p->s->img_out_n) {
result = stbi__convert_format(result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y);
p->s->img_out_n = req_comp;
if (result == NULL) return result;
}
*x = p->s->img_x;
*y = p->s->img_y;
if (n) *n = p->s->img_out_n;
}
STBI_FREE(p->out); p->out = NULL;
STBI_FREE(p->expanded); p->expanded = NULL;
STBI_FREE(p->idata); p->idata = NULL;
return result;
}
static unsigned char *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
stbi__png p;
p.s = s;
return stbi__do_png(&p, x,y,comp,req_comp);
}
static int stbi__png_test(stbi__context *s)
{
int r;
r = stbi__check_png_header(s);
stbi__rewind(s);
return r;
}
static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp)
{
if (!stbi__parse_png_file(p, STBI__SCAN_header, 0)) {
stbi__rewind( p->s );
return 0;
}
if (x) *x = p->s->img_x;
if (y) *y = p->s->img_y;
if (comp) *comp = p->s->img_n;
return 1;
}
static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp)
{
stbi__png p;
p.s = s;
return stbi__png_info_raw(&p, x, y, comp);
}
#endif
// Microsoft/Windows BMP image
#ifndef STBI_NO_BMP
static int stbi__bmp_test_raw(stbi__context *s)
{
int r;
int sz;
if (stbi__get8(s) != 'B') return 0;
if (stbi__get8(s) != 'M') return 0;
stbi__get32le(s); // discard filesize
stbi__get16le(s); // discard reserved
stbi__get16le(s); // discard reserved
stbi__get32le(s); // discard data offset
sz = stbi__get32le(s);
r = (sz == 12 || sz == 40 || sz == 56 || sz == 108 || sz == 124);
return r;
}
static int stbi__bmp_test(stbi__context *s)
{
int r = stbi__bmp_test_raw(s);
stbi__rewind(s);
return r;
}
// returns 0..31 for the highest set bit
static int stbi__high_bit(unsigned int z)
{
int n=0;
if (z == 0) return -1;
if (z >= 0x10000) n += 16, z >>= 16;
if (z >= 0x00100) n += 8, z >>= 8;
if (z >= 0x00010) n += 4, z >>= 4;
if (z >= 0x00004) n += 2, z >>= 2;
if (z >= 0x00002) n += 1, z >>= 1;
return n;
}
static int stbi__bitcount(unsigned int a)
{
a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2
a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4
a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits
a = (a + (a >> 8)); // max 16 per 8 bits
a = (a + (a >> 16)); // max 32 per 8 bits
return a & 0xff;
}
static int stbi__shiftsigned(int v, int shift, int bits)
{
int result;
int z=0;
if (shift < 0) v <<= -shift;
else v >>= shift;
result = v;
z = bits;
while (z < 8) {
result += v >> z;
z += bits;
}
return result;
}
static stbi_uc *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
stbi_uc *out;
unsigned int mr=0,mg=0,mb=0,ma=0, fake_a=0;
stbi_uc pal[256][4];
int psize=0,i,j,compress=0,width;
int bpp, flip_vertically, pad, target, offset, hsz;
if (stbi__get8(s) != 'B' || stbi__get8(s) != 'M') return stbi__errpuc("not BMP", "Corrupt BMP");
stbi__get32le(s); // discard filesize
stbi__get16le(s); // discard reserved
stbi__get16le(s); // discard reserved
offset = stbi__get32le(s);
hsz = stbi__get32le(s);
if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) return stbi__errpuc("unknown BMP", "BMP type not supported: unknown");
if (hsz == 12) {
s->img_x = stbi__get16le(s);
s->img_y = stbi__get16le(s);
} else {
s->img_x = stbi__get32le(s);
s->img_y = stbi__get32le(s);
}
if (stbi__get16le(s) != 1) return stbi__errpuc("bad BMP", "bad BMP");
bpp = stbi__get16le(s);
if (bpp == 1) return stbi__errpuc("monochrome", "BMP type not supported: 1-bit");
flip_vertically = ((int) s->img_y) > 0;
s->img_y = abs((int) s->img_y);
if (hsz == 12) {
if (bpp < 24)
psize = (offset - 14 - 24) / 3;
} else {
compress = stbi__get32le(s);
if (compress == 1 || compress == 2) return stbi__errpuc("BMP RLE", "BMP type not supported: RLE");
stbi__get32le(s); // discard sizeof
stbi__get32le(s); // discard hres
stbi__get32le(s); // discard vres
stbi__get32le(s); // discard colorsused
stbi__get32le(s); // discard max important
if (hsz == 40 || hsz == 56) {
if (hsz == 56) {
stbi__get32le(s);
stbi__get32le(s);
stbi__get32le(s);
stbi__get32le(s);
}
if (bpp == 16 || bpp == 32) {
mr = mg = mb = 0;
if (compress == 0) {
if (bpp == 32) {
mr = 0xffu << 16;
mg = 0xffu << 8;
mb = 0xffu << 0;
ma = 0xffu << 24;
fake_a = 1; // @TODO: check for cases like alpha value is all 0 and switch it to 255
STBI_NOTUSED(fake_a);
} else {
mr = 31u << 10;
mg = 31u << 5;
mb = 31u << 0;
}
} else if (compress == 3) {
mr = stbi__get32le(s);
mg = stbi__get32le(s);
mb = stbi__get32le(s);
// not documented, but generated by photoshop and handled by mspaint
if (mr == mg && mg == mb) {
// ?!?!?
return stbi__errpuc("bad BMP", "bad BMP");
}
} else
return stbi__errpuc("bad BMP", "bad BMP");
}
} else {
STBI_ASSERT(hsz == 108 || hsz == 124);
mr = stbi__get32le(s);
mg = stbi__get32le(s);
mb = stbi__get32le(s);
ma = stbi__get32le(s);
stbi__get32le(s); // discard color space
for (i=0; i < 12; ++i)
stbi__get32le(s); // discard color space parameters
if (hsz == 124) {
stbi__get32le(s); // discard rendering intent
stbi__get32le(s); // discard offset of profile data
stbi__get32le(s); // discard size of profile data
stbi__get32le(s); // discard reserved
}
}
if (bpp < 16)
psize = (offset - 14 - hsz) >> 2;
}
s->img_n = ma ? 4 : 3;
if (req_comp && req_comp >= 3) // we can directly decode 3 or 4
target = req_comp;
else
target = s->img_n; // if they want monochrome, we'll post-convert
out = (stbi_uc *) stbi__malloc(target * s->img_x * s->img_y);
if (!out) return stbi__errpuc("outofmem", "Out of memory");
if (bpp < 16) {
int z=0;
if (psize == 0 || psize > 256) { STBI_FREE(out); return stbi__errpuc("invalid", "Corrupt BMP"); }
for (i=0; i < psize; ++i) {
pal[i][2] = stbi__get8(s);
pal[i][1] = stbi__get8(s);
pal[i][0] = stbi__get8(s);
if (hsz != 12) stbi__get8(s);
pal[i][3] = 255;
}
stbi__skip(s, offset - 14 - hsz - psize * (hsz == 12 ? 3 : 4));
if (bpp == 4) width = (s->img_x + 1) >> 1;
else if (bpp == 8) width = s->img_x;
else { STBI_FREE(out); return stbi__errpuc("bad bpp", "Corrupt BMP"); }
pad = (-width)&3;
for (j=0; j < (int) s->img_y; ++j) {
for (i=0; i < (int) s->img_x; i += 2) {
int v=stbi__get8(s),v2=0;
if (bpp == 4) {
v2 = v & 15;
v >>= 4;
}
out[z++] = pal[v][0];
out[z++] = pal[v][1];
out[z++] = pal[v][2];
if (target == 4) out[z++] = 255;
if (i+1 == (int) s->img_x) break;
v = (bpp == 8) ? stbi__get8(s) : v2;
out[z++] = pal[v][0];
out[z++] = pal[v][1];
out[z++] = pal[v][2];
if (target == 4) out[z++] = 255;
}
stbi__skip(s, pad);
}
} else {
int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0;
int z = 0;
int easy=0;
stbi__skip(s, offset - 14 - hsz);
if (bpp == 24) width = 3 * s->img_x;
else if (bpp == 16) width = 2*s->img_x;
else /* bpp = 32 and pad = 0 */ width=0;
pad = (-width) & 3;
if (bpp == 24) {
easy = 1;
} else if (bpp == 32) {
if (mb == 0xff && mg == 0xff00 && mr == 0x00ff0000 && ma == 0xff000000)
easy = 2;
}
if (!easy) {
if (!mr || !mg || !mb) { STBI_FREE(out); return stbi__errpuc("bad masks", "Corrupt BMP"); }
// right shift amt to put high bit in position #7
rshift = stbi__high_bit(mr)-7; rcount = stbi__bitcount(mr);
gshift = stbi__high_bit(mg)-7; gcount = stbi__bitcount(mg);
bshift = stbi__high_bit(mb)-7; bcount = stbi__bitcount(mb);
ashift = stbi__high_bit(ma)-7; acount = stbi__bitcount(ma);
}
for (j=0; j < (int) s->img_y; ++j) {
if (easy) {
for (i=0; i < (int) s->img_x; ++i) {
unsigned char a;
out[z+2] = stbi__get8(s);
out[z+1] = stbi__get8(s);
out[z+0] = stbi__get8(s);
z += 3;
a = (easy == 2 ? stbi__get8(s) : 255);
if (target == 4) out[z++] = a;
}
} else {
for (i=0; i < (int) s->img_x; ++i) {
stbi__uint32 v = (bpp == 16 ? (stbi__uint32) stbi__get16le(s) : stbi__get32le(s));
int a;
out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mr, rshift, rcount));
out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mg, gshift, gcount));
out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mb, bshift, bcount));
a = (ma ? stbi__shiftsigned(v & ma, ashift, acount) : 255);
if (target == 4) out[z++] = STBI__BYTECAST(a);
}
}
stbi__skip(s, pad);
}
}
if (flip_vertically) {
stbi_uc t;
for (j=0; j < (int) s->img_y>>1; ++j) {
stbi_uc *p1 = out + j *s->img_x*target;
stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target;
for (i=0; i < (int) s->img_x*target; ++i) {
t = p1[i], p1[i] = p2[i], p2[i] = t;
}
}
}
if (req_comp && req_comp != target) {
out = stbi__convert_format(out, target, req_comp, s->img_x, s->img_y);
if (out == NULL) return out; // stbi__convert_format frees input on failure
}
*x = s->img_x;
*y = s->img_y;
if (comp) *comp = s->img_n;
return out;
}
#endif
// Targa Truevision - TGA
// by Jonathan Dummer
#ifndef STBI_NO_TGA
static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp)
{
int tga_w, tga_h, tga_comp;
int sz;
stbi__get8(s); // discard Offset
sz = stbi__get8(s); // color type
if( sz > 1 ) {
stbi__rewind(s);
return 0; // only RGB or indexed allowed
}
sz = stbi__get8(s); // image type
// only RGB or grey allowed, +/- RLE
if ((sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11)) return 0;
stbi__skip(s,9);
tga_w = stbi__get16le(s);
if( tga_w < 1 ) {
stbi__rewind(s);
return 0; // test width
}
tga_h = stbi__get16le(s);
if( tga_h < 1 ) {
stbi__rewind(s);
return 0; // test height
}
sz = stbi__get8(s); // bits per pixel
// only RGB or RGBA or grey allowed
if ((sz != 8) && (sz != 16) && (sz != 24) && (sz != 32)) {
stbi__rewind(s);
return 0;
}
tga_comp = sz;
if (x) *x = tga_w;
if (y) *y = tga_h;
if (comp) *comp = tga_comp / 8;
return 1; // seems to have passed everything
}
static int stbi__tga_test(stbi__context *s)
{
int res;
int sz;
stbi__get8(s); // discard Offset
sz = stbi__get8(s); // color type
if ( sz > 1 ) return 0; // only RGB or indexed allowed
sz = stbi__get8(s); // image type
if ( (sz != 1) && (sz != 2) && (sz != 3) && (sz != 9) && (sz != 10) && (sz != 11) ) return 0; // only RGB or grey allowed, +/- RLE
stbi__get16be(s); // discard palette start
stbi__get16be(s); // discard palette length
stbi__get8(s); // discard bits per palette color entry
stbi__get16be(s); // discard x origin
stbi__get16be(s); // discard y origin
if ( stbi__get16be(s) < 1 ) return 0; // test width
if ( stbi__get16be(s) < 1 ) return 0; // test height
sz = stbi__get8(s); // bits per pixel
if ( (sz != 8) && (sz != 16) && (sz != 24) && (sz != 32) )
res = 0;
else
res = 1;
stbi__rewind(s);
return res;
}
static stbi_uc *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
// read in the TGA header stuff
int tga_offset = stbi__get8(s);
int tga_indexed = stbi__get8(s);
int tga_image_type = stbi__get8(s);
int tga_is_RLE = 0;
int tga_palette_start = stbi__get16le(s);
int tga_palette_len = stbi__get16le(s);
int tga_palette_bits = stbi__get8(s);
int tga_x_origin = stbi__get16le(s);
int tga_y_origin = stbi__get16le(s);
int tga_width = stbi__get16le(s);
int tga_height = stbi__get16le(s);
int tga_bits_per_pixel = stbi__get8(s);
int tga_comp = tga_bits_per_pixel / 8;
int tga_inverted = stbi__get8(s);
// image data
unsigned char *tga_data;
unsigned char *tga_palette = NULL;
int i, j;
unsigned char raw_data[4] = {0};
int RLE_count = 0;
int RLE_repeating = 0;
int read_next_pixel = 1;
// do a tiny bit of precessing
if ( tga_image_type >= 8 )
{
tga_image_type -= 8;
tga_is_RLE = 1;
}
/* int tga_alpha_bits = tga_inverted & 15; */
tga_inverted = 1 - ((tga_inverted >> 5) & 1);
// error check
if ( //(tga_indexed) ||
(tga_width < 1) || (tga_height < 1) ||
(tga_image_type < 1) || (tga_image_type > 3) ||
((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16) &&
(tga_bits_per_pixel != 24) && (tga_bits_per_pixel != 32))
)
{
return NULL; // we don't report this as a bad TGA because we don't even know if it's TGA
}
// If I'm paletted, then I'll use the number of bits from the palette
if ( tga_indexed )
{
tga_comp = tga_palette_bits / 8;
}
// tga info
*x = tga_width;
*y = tga_height;
if (comp) *comp = tga_comp;
tga_data = (unsigned char*)stbi__malloc( (size_t)tga_width * tga_height * tga_comp );
if (!tga_data) return stbi__errpuc("outofmem", "Out of memory");
// skip to the data's starting position (offset usually = 0)
stbi__skip(s, tga_offset );
if ( !tga_indexed && !tga_is_RLE) {
for (i=0; i < tga_height; ++i) {
int y = tga_inverted ? tga_height -i - 1 : i;
stbi_uc *tga_row = tga_data + y*tga_width*tga_comp;
stbi__getn(s, tga_row, tga_width * tga_comp);
}
} else {
// do I need to load a palette?
if ( tga_indexed)
{
// any data to skip? (offset usually = 0)
stbi__skip(s, tga_palette_start );
// load the palette
tga_palette = (unsigned char*)stbi__malloc( tga_palette_len * tga_palette_bits / 8 );
if (!tga_palette) {
STBI_FREE(tga_data);
return stbi__errpuc("outofmem", "Out of memory");
}
if (!stbi__getn(s, tga_palette, tga_palette_len * tga_palette_bits / 8 )) {
STBI_FREE(tga_data);
STBI_FREE(tga_palette);
return stbi__errpuc("bad palette", "Corrupt TGA");
}
}
// load the data
for (i=0; i < tga_width * tga_height; ++i)
{
// if I'm in RLE mode, do I need to get a RLE stbi__pngchunk?
if ( tga_is_RLE )
{
if ( RLE_count == 0 )
{
// yep, get the next byte as a RLE command
int RLE_cmd = stbi__get8(s);
RLE_count = 1 + (RLE_cmd & 127);
RLE_repeating = RLE_cmd >> 7;
read_next_pixel = 1;
} else if ( !RLE_repeating )
{
read_next_pixel = 1;
}
} else
{
read_next_pixel = 1;
}
// OK, if I need to read a pixel, do it now
if ( read_next_pixel )
{
// load however much data we did have
if ( tga_indexed )
{
// read in 1 byte, then perform the lookup
int pal_idx = stbi__get8(s);
if ( pal_idx >= tga_palette_len )
{
// invalid index
pal_idx = 0;
}
pal_idx *= tga_bits_per_pixel / 8;
for (j = 0; j*8 < tga_bits_per_pixel; ++j)
{
raw_data[j] = tga_palette[pal_idx+j];
}
} else
{
// read in the data raw
for (j = 0; j*8 < tga_bits_per_pixel; ++j)
{
raw_data[j] = stbi__get8(s);
}
}
// clear the reading flag for the next pixel
read_next_pixel = 0;
} // end of reading a pixel
// copy data
for (j = 0; j < tga_comp; ++j)
tga_data[i*tga_comp+j] = raw_data[j];
// in case we're in RLE mode, keep counting down
--RLE_count;
}
// do I need to invert the image?
if ( tga_inverted )
{
for (j = 0; j*2 < tga_height; ++j)
{
int index1 = j * tga_width * tga_comp;
int index2 = (tga_height - 1 - j) * tga_width * tga_comp;
for (i = tga_width * tga_comp; i > 0; --i)
{
unsigned char temp = tga_data[index1];
tga_data[index1] = tga_data[index2];
tga_data[index2] = temp;
++index1;
++index2;
}
}
}
// clear my palette, if I had one
if ( tga_palette != NULL )
{
STBI_FREE( tga_palette );
}
}
// swap RGB
if (tga_comp >= 3)
{
unsigned char* tga_pixel = tga_data;
for (i=0; i < tga_width * tga_height; ++i)
{
unsigned char temp = tga_pixel[0];
tga_pixel[0] = tga_pixel[2];
tga_pixel[2] = temp;
tga_pixel += tga_comp;
}
}
// convert to target component count
if (req_comp && req_comp != tga_comp)
tga_data = stbi__convert_format(tga_data, tga_comp, req_comp, tga_width, tga_height);
// the things I do to get rid of an error message, and yet keep
// Microsoft's C compilers happy... [8^(
tga_palette_start = tga_palette_len = tga_palette_bits =
tga_x_origin = tga_y_origin = 0;
// OK, done
return tga_data;
}
#endif
/* Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicolas Schulz, tweaked by STB */
#ifndef STBI_NO_PSD
static int stbi__psd_test(stbi__context *s)
{
int r = (stbi__get32be(s) == 0x38425053);
stbi__rewind(s);
return r;
}
static stbi_uc *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
int pixelCount;
int channelCount, compression;
int channel, i, count, len;
int w,h;
stbi_uc *out;
/* Check identifier */
if (stbi__get32be(s) != 0x38425053) // "8BPS"
return stbi__errpuc("not PSD", "Corrupt PSD image");
/* Check file type version. */
if (stbi__get16be(s) != 1)
return stbi__errpuc("wrong version", "Unsupported version of PSD image");
/* Skip 6 reserved bytes. */
stbi__skip(s, 6 );
/* Read the number of channels (R, G, B, A, etc). */
channelCount = stbi__get16be(s);
if (channelCount < 0 || channelCount > 16)
return stbi__errpuc("wrong channel count", "Unsupported number of channels in PSD image");
/* Read the rows and columns of the image. */
h = stbi__get32be(s);
w = stbi__get32be(s);
/* Make sure the depth is 8 bits. */
if (stbi__get16be(s) != 8)
return stbi__errpuc("unsupported bit depth", "PSD bit depth is not 8 bit");
// Make sure the color mode is RGB.
// Valid options are:
// 0: Bitmap
// 1: Grayscale
// 2: Indexed color
// 3: RGB color
// 4: CMYK color
// 7: Multichannel
// 8: Duotone
// 9: Lab color
if (stbi__get16be(s) != 3)
return stbi__errpuc("wrong color format", "PSD is not in RGB color format");
/* Skip the Mode Data. (It's the palette for indexed color; other info for other modes.) */
stbi__skip(s,stbi__get32be(s) );
/* Skip the image resources. (resolution, pen tool paths, etc) */
stbi__skip(s, stbi__get32be(s) );
/* Skip the reserved data. */
stbi__skip(s, stbi__get32be(s) );
// Find out if the data is compressed.
// Known values:
// 0: no compression
// 1: RLE compressed
compression = stbi__get16be(s);
if (compression > 1)
return stbi__errpuc("bad compression", "PSD has an unknown compression format");
// Create the destination image.
out = (stbi_uc *) stbi__malloc(4 * w*h);
if (!out) return stbi__errpuc("outofmem", "Out of memory");
pixelCount = w*h;
/* Finally, the image data. */
if (compression)
{
// RLE as used by .PSD and .TIFF
// Loop until you get the number of unpacked bytes you are expecting:
// Read the next source byte into n.
// If n is between 0 and 127 inclusive, copy the next n+1 bytes literally.
// Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times.
// Else if n is 128, noop.
// Endloop
/* The RLE-compressed data is preceeded by a 2-byte data count
* for each row in the data, which we're going to just skip. */
stbi__skip(s, h * channelCount * 2 );
// Read the RLE data by channel.
for (channel = 0; channel < 4; channel++) {
stbi_uc *p;
p = out+channel;
if (channel >= channelCount) {
// Fill this channel with default data.
for (i = 0; i < pixelCount; i++, p += 4)
*p = (channel == 3 ? 255 : 0);
} else {
// Read the RLE data.
count = 0;
while (count < pixelCount) {
len = stbi__get8(s);
if (len == 128) {
// No-op.
} else if (len < 128) {
// Copy next len+1 bytes literally.
len++;
count += len;
while (len) {
*p = stbi__get8(s);
p += 4;
len--;
}
} else if (len > 128) {
stbi_uc val;
// Next -len+1 bytes in the dest are replicated from next source byte.
// (Interpret len as a negative 8-bit int.)
len ^= 0x0FF;
len += 2;
val = stbi__get8(s);
count += len;
while (len) {
*p = val;
p += 4;
len--;
}
}
}
}
}
} else {
// We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...)
// where each channel consists of an 8-bit value for each pixel in the image.
// Read the data by channel.
for (channel = 0; channel < 4; channel++) {
stbi_uc *p;
p = out + channel;
if (channel > channelCount) {
// Fill this channel with default data.
for (i = 0; i < pixelCount; i++, p += 4)
*p = channel == 3 ? 255 : 0;
} else {
// Read the data.
for (i = 0; i < pixelCount; i++, p += 4)
*p = stbi__get8(s);
}
}
}
if (req_comp && req_comp != 4) {
out = stbi__convert_format(out, 4, req_comp, w, h);
if (out == NULL) return out; // stbi__convert_format frees input on failure
}
if (comp) *comp = 4;
*y = h;
*x = w;
return out;
}
#endif
/* *************************************************************************************************
* Softimage PIC loader
* by Tom Seddon
*
* See http://softimage.wiki.softimage.com/index.php/INFO:_PIC_file_format
* See http://ozviz.wasp.uwa.edu.au/~pbourke/dataformats/softimagepic/
*/
#ifndef STBI_NO_PIC
static int stbi__pic_is4(stbi__context *s,const char *str)
{
int i;
for (i=0; i<4; ++i)
if (stbi__get8(s) != (stbi_uc)str[i])
return 0;
return 1;
}
static int stbi__pic_test_core(stbi__context *s)
{
int i;
if (!stbi__pic_is4(s,"\x53\x80\xF6\x34"))
return 0;
for(i=0;i<84;++i)
stbi__get8(s);
if (!stbi__pic_is4(s,"PICT"))
return 0;
return 1;
}
typedef struct
{
stbi_uc size,type,channel;
} stbi__pic_packet;
static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest)
{
int mask=0x80, i;
for (i=0; i<4; ++i, mask>>=1) {
if (channel & mask) {
if (stbi__at_eof(s)) return stbi__errpuc("bad file","PIC file too short");
dest[i]=stbi__get8(s);
}
}
return dest;
}
static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src)
{
int mask=0x80,i;
for (i=0;i<4; ++i, mask>>=1)
if (channel&mask)
dest[i]=src[i];
}
static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int height,int *comp, stbi_uc *result)
{
int act_comp=0,num_packets=0,y,chained;
stbi__pic_packet packets[10];
/* this will (should...) cater for even some bizarre stuff like having data
* for the same channel in multiple packets.
*/
do
{
stbi__pic_packet *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return stbi__errpuc("bad format","too many packets");
packet = &packets[num_packets++];
chained = stbi__get8(s);
packet->size = stbi__get8(s);
packet->type = stbi__get8(s);
packet->channel = stbi__get8(s);
act_comp |= packet->channel;
if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (reading packets)");
if (packet->size != 8) return stbi__errpuc("bad format","packet isn't 8bpp");
} while (chained);
*comp = (act_comp & 0x10 ? 4 : 3); /* has alpha channel? */
for(y=0; y<height; ++y) {
int packet_idx;
for(packet_idx=0; packet_idx < num_packets; ++packet_idx) {
stbi__pic_packet *packet = &packets[packet_idx];
stbi_uc *dest = result+y*width*4;
switch (packet->type) {
default:
return stbi__errpuc("bad format","packet has bad compression type");
case 0: {//uncompressed
int x;
for(x=0;x<width;++x, dest+=4)
if (!stbi__readval(s,packet->channel,dest))
return 0;
break;
}
case 1://Pure RLE
{
int left=width, i;
while (left>0) {
stbi_uc count,value[4];
count=stbi__get8(s);
if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pure read count)");
if (count > left)
count = (stbi_uc) left;
if (!stbi__readval(s,packet->channel,value)) return 0;
for(i=0; i<count; ++i,dest+=4)
stbi__copyval(packet->channel,dest,value);
left -= count;
}
}
break;
case 2: {//Mixed RLE
int left=width;
while (left>0) {
int count = stbi__get8(s), i;
if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (mixed read count)");
if (count >= 128) { // Repeated
stbi_uc value[4];
int i;
if (count==128)
count = stbi__get16be(s);
else
count -= 127;
if (count > left)
return stbi__errpuc("bad file","scanline overrun");
if (!stbi__readval(s,packet->channel,value))
return 0;
for(i=0;i<count;++i, dest += 4)
stbi__copyval(packet->channel,dest,value);
} else { // Raw
++count;
if (count>left) return stbi__errpuc("bad file","scanline overrun");
for(i=0;i<count;++i, dest+=4)
if (!stbi__readval(s,packet->channel,dest))
return 0;
}
left-=count;
}
break;
}
}
}
}
return result;
}
static stbi_uc *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp)
{
stbi_uc *result;
int i, x,y;
for (i=0; i<92; ++i)
stbi__get8(s);
x = stbi__get16be(s);
y = stbi__get16be(s);
if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pic header)");
if ((1 << 28) / x < y) return stbi__errpuc("too large", "Image too large to decode");
stbi__get32be(s); /* skip `ratio' */
stbi__get16be(s); /* skip `fields' */
stbi__get16be(s); /* skip `pad' */
/* intermediate buffer is RGBA */
result = (stbi_uc *) stbi__malloc(x*y*4);
memset(result, 0xff, x*y*4);
if (!stbi__pic_load_core(s,x,y,comp, result))
{
STBI_FREE(result);
result=0;
}
*px = x;
*py = y;
if (req_comp == 0) req_comp = *comp;
result=stbi__convert_format(result,4,req_comp,x,y);
return result;
}
static int stbi__pic_test(stbi__context *s)
{
int r = stbi__pic_test_core(s);
stbi__rewind(s);
return r;
}
#endif
/* *************************************************************************************************
* GIF loader -- public domain by Jean-Marc Lienher -- simplified/shrunk by stb
*/
#ifndef STBI_NO_GIF
typedef struct
{
stbi__int16 prefix;
stbi_uc first;
stbi_uc suffix;
} stbi__gif_lzw;
typedef struct
{
int w,h;
stbi_uc *out; /* output buffer (always 4 components) */
int flags, bgindex, ratio, transparent, eflags;
stbi_uc pal[256][4];
stbi_uc lpal[256][4];
stbi__gif_lzw codes[4096];
stbi_uc *color_table;
int parse, step;
int lflags;
int start_x, start_y;
int max_x, max_y;
int cur_x, cur_y;
int line_size;
} stbi__gif;
static int stbi__gif_test_raw(stbi__context *s)
{
int sz;
if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') return 0;
sz = stbi__get8(s);
if (sz != '9' && sz != '7') return 0;
if (stbi__get8(s) != 'a') return 0;
return 1;
}
static int stbi__gif_test(stbi__context *s)
{
int r = stbi__gif_test_raw(s);
stbi__rewind(s);
return r;
}
static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256][4], int num_entries, int transp)
{
int i;
for (i=0; i < num_entries; ++i) {
pal[i][2] = stbi__get8(s);
pal[i][1] = stbi__get8(s);
pal[i][0] = stbi__get8(s);
pal[i][3] = transp == i ? 0 : 255;
}
}
static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info)
{
stbi_uc version;
if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8')
return stbi__err("not GIF", "Corrupt GIF");
version = stbi__get8(s);
if (version != '7' && version != '9') return stbi__err("not GIF", "Corrupt GIF");
if (stbi__get8(s) != 'a') return stbi__err("not GIF", "Corrupt GIF");
stbi__g_failure_reason = "";
g->w = stbi__get16le(s);
g->h = stbi__get16le(s);
g->flags = stbi__get8(s);
g->bgindex = stbi__get8(s);
g->ratio = stbi__get8(s);
g->transparent = -1;
if (comp != 0) *comp = 4; /* can't actually tell whether it's 3 or 4 until we parse the comments */
if (is_info) return 1;
if (g->flags & 0x80)
stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1);
return 1;
}
static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp)
{
stbi__gif g;
if (!stbi__gif_header(s, &g, comp, 1)) {
stbi__rewind( s );
return 0;
}
if (x) *x = g.w;
if (y) *y = g.h;
return 1;
}
static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code)
{
stbi_uc *p, *c;
/* recurse to decode the prefixes, since the linked-list is backwards,
* and working backwards through an interleaved image would be nasty
*/
if (g->codes[code].prefix >= 0)
stbi__out_gif_code(g, g->codes[code].prefix);
if (g->cur_y >= g->max_y)
return;
p = &g->out[g->cur_x + g->cur_y];
c = &g->color_table[g->codes[code].suffix * 4];
if (c[3] >= 128) {
p[0] = c[2];
p[1] = c[1];
p[2] = c[0];
p[3] = c[3];
}
g->cur_x += 4;
if (g->cur_x >= g->max_x) {
g->cur_x = g->start_x;
g->cur_y += g->step;
while (g->cur_y >= g->max_y && g->parse > 0) {
g->step = (1 << g->parse) * g->line_size;
g->cur_y = g->start_y + (g->step >> 1);
--g->parse;
}
}
}
static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g)
{
stbi_uc lzw_cs;
stbi__int32 len, code;
stbi__uint32 first;
stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear;
stbi__gif_lzw *p;
lzw_cs = stbi__get8(s);
if (lzw_cs > 12) return NULL;
clear = 1 << lzw_cs;
first = 1;
codesize = lzw_cs + 1;
codemask = (1 << codesize) - 1;
bits = 0;
valid_bits = 0;
for (code = 0; code < clear; code++) {
g->codes[code].prefix = -1;
g->codes[code].first = (stbi_uc) code;
g->codes[code].suffix = (stbi_uc) code;
}
/* support no starting clear code */
avail = clear+2;
oldcode = -1;
len = 0;
for(;;) {
if (valid_bits < codesize) {
if (len == 0) {
len = stbi__get8(s); /* start new block */
if (len == 0)
return g->out;
}
--len;
bits |= (stbi__int32) stbi__get8(s) << valid_bits;
valid_bits += 8;
} else {
stbi__int32 code = bits & codemask;
bits >>= codesize;
valid_bits -= codesize;
// @OPTIMIZE: is there some way we can accelerate the non-clear path?
if (code == clear) { // clear code
codesize = lzw_cs + 1;
codemask = (1 << codesize) - 1;
avail = clear + 2;
oldcode = -1;
first = 0;
} else if (code == clear + 1) { // end of stream code
stbi__skip(s, len);
while ((len = stbi__get8(s)) > 0)
stbi__skip(s,len);
return g->out;
} else if (code <= avail) {
if (first) return stbi__errpuc("no clear code", "Corrupt GIF");
if (oldcode >= 0) {
p = &g->codes[avail++];
if (avail > 4096) return stbi__errpuc("too many codes", "Corrupt GIF");
p->prefix = (stbi__int16) oldcode;
p->first = g->codes[oldcode].first;
p->suffix = (code == avail) ? p->first : g->codes[code].first;
} else if (code == avail)
return stbi__errpuc("illegal code in raster", "Corrupt GIF");
stbi__out_gif_code(g, (stbi__uint16) code);
if ((avail & codemask) == 0 && avail <= 0x0FFF) {
codesize++;
codemask = (1 << codesize) - 1;
}
oldcode = code;
} else {
return stbi__errpuc("illegal code in raster", "Corrupt GIF");
}
}
}
}
static void stbi__fill_gif_background(stbi__gif *g)
{
int i;
stbi_uc *c = g->pal[g->bgindex];
/* @OPTIMIZE: write a dword at a time */
for (i = 0; i < g->w * g->h * 4; i += 4)
{
stbi_uc *p = &g->out[i];
p[0] = c[2];
p[1] = c[1];
p[2] = c[0];
p[3] = c[3];
}
}
/* this function is designed to support animated gifs, although stb_image doesn't support it */
static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp)
{
int i;
stbi_uc *old_out = 0;
if (g->out == 0) {
if (!stbi__gif_header(s, g, comp,0))
return 0;
g->out = (stbi_uc *) stbi__malloc(4 * g->w * g->h);
if (g->out == 0) return stbi__errpuc("outofmem", "Out of memory");
stbi__fill_gif_background(g);
} else {
// animated-gif-only path
if (((g->eflags & 0x1C) >> 2) == 3) {
old_out = g->out;
g->out = (stbi_uc *) stbi__malloc(4 * g->w * g->h);
if (g->out == 0) return stbi__errpuc("outofmem", "Out of memory");
memcpy(g->out, old_out, g->w*g->h*4);
}
}
for (;;) {
switch (stbi__get8(s)) {
case 0x2C: /* Image Descriptor */
{
stbi__int32 x, y, w, h;
stbi_uc *o;
x = stbi__get16le(s);
y = stbi__get16le(s);
w = stbi__get16le(s);
h = stbi__get16le(s);
if (((x + w) > (g->w)) || ((y + h) > (g->h)))
return stbi__errpuc("bad Image Descriptor", "Corrupt GIF");
g->line_size = g->w * 4;
g->start_x = x * 4;
g->start_y = y * g->line_size;
g->max_x = g->start_x + w * 4;
g->max_y = g->start_y + h * g->line_size;
g->cur_x = g->start_x;
g->cur_y = g->start_y;
g->lflags = stbi__get8(s);
if (g->lflags & 0x40) {
g->step = 8 * g->line_size; // first interlaced spacing
g->parse = 3;
} else {
g->step = g->line_size;
g->parse = 0;
}
if (g->lflags & 0x80) {
stbi__gif_parse_colortable(s,g->lpal, 2 << (g->lflags & 7), g->eflags & 0x01 ? g->transparent : -1);
g->color_table = (stbi_uc *) g->lpal;
} else if (g->flags & 0x80) {
for (i=0; i < 256; ++i) // @OPTIMIZE: stbi__jpeg_reset only the previous transparent
g->pal[i][3] = 255;
if (g->transparent >= 0 && (g->eflags & 0x01))
g->pal[g->transparent][3] = 0;
g->color_table = (stbi_uc *) g->pal;
} else
return stbi__errpuc("missing color table", "Corrupt GIF");
o = stbi__process_gif_raster(s, g);
if (o == NULL) return NULL;
if (req_comp && req_comp != 4)
o = stbi__convert_format(o, 4, req_comp, g->w, g->h);
return o;
}
case 0x21: // Comment Extension.
{
int len;
if (stbi__get8(s) == 0xF9) { // Graphic Control Extension.
len = stbi__get8(s);
if (len == 4) {
g->eflags = stbi__get8(s);
stbi__get16le(s); // delay
g->transparent = stbi__get8(s);
} else {
stbi__skip(s, len);
break;
}
}
while ((len = stbi__get8(s)) != 0)
stbi__skip(s, len);
break;
}
case 0x3B: // gif stream termination code
return (stbi_uc *) s; // using '1' causes warning on some compilers
default:
return stbi__errpuc("unknown code", "Corrupt GIF");
}
}
}
static stbi_uc *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
stbi_uc *u = 0;
stbi__gif g;
memset(&g, 0, sizeof(g));
u = stbi__gif_load_next(s, &g, comp, req_comp);
if (u == (stbi_uc *) s) u = 0; // end of animated gif marker
if (u) {
*x = g.w;
*y = g.h;
}
return u;
}
static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp)
{
return stbi__gif_info_raw(s,x,y,comp);
}
#endif
// *************************************************************************************************
// Radiance RGBE HDR loader
// originally by Nicolas Schulz
#ifndef STBI_NO_HDR
static int stbi__hdr_test_core(stbi__context *s)
{
const char *signature = "#?RADIANCE\n";
int i;
for (i=0; signature[i]; ++i)
if (stbi__get8(s) != signature[i])
return 0;
return 1;
}
static int stbi__hdr_test(stbi__context* s)
{
int r = stbi__hdr_test_core(s);
stbi__rewind(s);
return r;
}
#define STBI__HDR_BUFLEN 1024
static char *stbi__hdr_gettoken(stbi__context *z, char *buffer)
{
int len=0;
char c = '\0';
c = (char) stbi__get8(z);
while (!stbi__at_eof(z) && c != '\n') {
buffer[len++] = c;
if (len == STBI__HDR_BUFLEN-1) {
// flush to end of line
while (!stbi__at_eof(z) && stbi__get8(z) != '\n')
;
break;
}
c = (char) stbi__get8(z);
}
buffer[len] = 0;
return buffer;
}
static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp)
{
if ( input[3] != 0 ) {
float f1;
// Exponent
f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8));
if (req_comp <= 2)
output[0] = (input[0] + input[1] + input[2]) * f1 / 3;
else {
output[0] = input[0] * f1;
output[1] = input[1] * f1;
output[2] = input[2] * f1;
}
if (req_comp == 2) output[1] = 1;
if (req_comp == 4) output[3] = 1;
} else {
switch (req_comp) {
case 4: output[3] = 1; /* fallthrough */
case 3: output[0] = output[1] = output[2] = 0;
break;
case 2: output[1] = 1; /* fallthrough */
case 1: output[0] = 0;
break;
}
}
}
static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
char buffer[STBI__HDR_BUFLEN];
char *token;
int valid = 0;
int width, height;
stbi_uc *scanline;
float *hdr_data;
int len;
unsigned char count, value;
int i, j, k, c1,c2, z;
// Check identifier
if (strcmp(stbi__hdr_gettoken(s,buffer), "#?RADIANCE") != 0)
return stbi__errpf("not HDR", "Corrupt HDR image");
// Parse header
for(;;) {
token = stbi__hdr_gettoken(s,buffer);
if (token[0] == 0) break;
if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
}
if (!valid) return stbi__errpf("unsupported format", "Unsupported HDR format");
// Parse width and height
// can't use sscanf() if we're not using stdio!
token = stbi__hdr_gettoken(s,buffer);
if (strncmp(token, "-Y ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format");
token += 3;
height = (int) strtol(token, &token, 10);
while (*token == ' ') ++token;
if (strncmp(token, "+X ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format");
token += 3;
width = (int) strtol(token, NULL, 10);
*x = width;
*y = height;
if (comp) *comp = 3;
if (req_comp == 0) req_comp = 3;
// Read data
hdr_data = (float *) stbi__malloc(height * width * req_comp * sizeof(float));
// Load image data
// image data is stored as some number of sca
if ( width < 8 || width >= 32768) {
// Read flat data
for (j=0; j < height; ++j) {
for (i=0; i < width; ++i) {
stbi_uc rgbe[4];
main_decode_loop:
stbi__getn(s, rgbe, 4);
stbi__hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp);
}
}
} else {
/* Read RLE-encoded data */
scanline = NULL;
for (j = 0; j < height; ++j) {
c1 = stbi__get8(s);
c2 = stbi__get8(s);
len = stbi__get8(s);
if (c1 != 2 || c2 != 2 || (len & 0x80)) {
/* not run-length encoded, so we have to
* actually use THIS data as a decoded
* pixel (note this can't be a valid pixel
* --one of RGB must be >= 128) */
stbi_uc rgbe[4];
rgbe[0] = (stbi_uc) c1;
rgbe[1] = (stbi_uc) c2;
rgbe[2] = (stbi_uc) len;
rgbe[3] = (stbi_uc) stbi__get8(s);
stbi__hdr_convert(hdr_data, rgbe, req_comp);
i = 1;
j = 0;
STBI_FREE(scanline);
goto main_decode_loop; // yes, this makes no sense
}
len <<= 8;
len |= stbi__get8(s);
if (len != width) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("invalid decoded scanline length", "corrupt HDR"); }
if (scanline == NULL) scanline = (stbi_uc *) stbi__malloc(width * 4);
for (k = 0; k < 4; ++k) {
i = 0;
while (i < width) {
count = stbi__get8(s);
if (count > 128) {
// Run
value = stbi__get8(s);
count -= 128;
for (z = 0; z < count; ++z)
scanline[i++ * 4 + k] = value;
} else {
// Dump
for (z = 0; z < count; ++z)
scanline[i++ * 4 + k] = stbi__get8(s);
}
}
}
for (i=0; i < width; ++i)
stbi__hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp);
}
STBI_FREE(scanline);
}
return hdr_data;
}
static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp)
{
char buffer[STBI__HDR_BUFLEN];
char *token;
int valid = 0;
if (strcmp(stbi__hdr_gettoken(s,buffer), "#?RADIANCE") != 0) {
stbi__rewind( s );
return 0;
}
for(;;) {
token = stbi__hdr_gettoken(s,buffer);
if (token[0] == 0) break;
if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
}
if (!valid) {
stbi__rewind( s );
return 0;
}
token = stbi__hdr_gettoken(s,buffer);
if (strncmp(token, "-Y ", 3)) {
stbi__rewind( s );
return 0;
}
token += 3;
*y = (int) strtol(token, &token, 10);
while (*token == ' ') ++token;
if (strncmp(token, "+X ", 3)) {
stbi__rewind( s );
return 0;
}
token += 3;
*x = (int) strtol(token, NULL, 10);
*comp = 3;
return 1;
}
#endif /* STBI_NO_HDR */
#ifndef STBI_NO_BMP
static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp)
{
int hsz;
if (stbi__get8(s) != 'B' || stbi__get8(s) != 'M') {
stbi__rewind( s );
return 0;
}
stbi__skip(s,12);
hsz = stbi__get32le(s);
if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) {
stbi__rewind( s );
return 0;
}
if (hsz == 12) {
*x = stbi__get16le(s);
*y = stbi__get16le(s);
} else {
*x = stbi__get32le(s);
*y = stbi__get32le(s);
}
if (stbi__get16le(s) != 1) {
stbi__rewind( s );
return 0;
}
*comp = stbi__get16le(s) / 8;
return 1;
}
#endif
#ifndef STBI_NO_PSD
static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp)
{
int channelCount;
if (stbi__get32be(s) != 0x38425053) {
stbi__rewind( s );
return 0;
}
if (stbi__get16be(s) != 1) {
stbi__rewind( s );
return 0;
}
stbi__skip(s, 6);
channelCount = stbi__get16be(s);
if (channelCount < 0 || channelCount > 16) {
stbi__rewind( s );
return 0;
}
*y = stbi__get32be(s);
*x = stbi__get32be(s);
if (stbi__get16be(s) != 8) {
stbi__rewind( s );
return 0;
}
if (stbi__get16be(s) != 3) {
stbi__rewind( s );
return 0;
}
*comp = 4;
return 1;
}
#endif
#ifndef STBI_NO_PIC
static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp)
{
int act_comp=0,num_packets=0,chained;
stbi__pic_packet packets[10];
stbi__skip(s, 92);
*x = stbi__get16be(s);
*y = stbi__get16be(s);
if (stbi__at_eof(s)) return 0;
if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) {
stbi__rewind( s );
return 0;
}
stbi__skip(s, 8);
do {
stbi__pic_packet *packet;
if (num_packets==sizeof(packets)/sizeof(packets[0]))
return 0;
packet = &packets[num_packets++];
chained = stbi__get8(s);
packet->size = stbi__get8(s);
packet->type = stbi__get8(s);
packet->channel = stbi__get8(s);
act_comp |= packet->channel;
if (stbi__at_eof(s)) {
stbi__rewind( s );
return 0;
}
if (packet->size != 8) {
stbi__rewind( s );
return 0;
}
} while (chained);
*comp = (act_comp & 0x10 ? 4 : 3);
return 1;
}
#endif
// *************************************************************************************************
// Portable Gray Map and Portable Pixel Map loader
// by Ken Miller
//
// PGM: http://netpbm.sourceforge.net/doc/pgm.html
// PPM: http://netpbm.sourceforge.net/doc/ppm.html
//
// Known limitations:
// Does not support comments in the header section
// Does not support ASCII image data (formats P2 and P3)
// Does not support 16-bit-per-channel
#ifndef STBI_NO_PNM
static int stbi__pnm_test(stbi__context *s)
{
char p, t;
p = (char) stbi__get8(s);
t = (char) stbi__get8(s);
if (p != 'P' || (t != '5' && t != '6')) {
stbi__rewind( s );
return 0;
}
return 1;
}
static stbi_uc *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
stbi_uc *out;
if (!stbi__pnm_info(s, (int *)&s->img_x, (int *)&s->img_y, (int *)&s->img_n))
return 0;
*x = s->img_x;
*y = s->img_y;
*comp = s->img_n;
out = (stbi_uc *) stbi__malloc(s->img_n * s->img_x * s->img_y);
if (!out) return stbi__errpuc("outofmem", "Out of memory");
stbi__getn(s, out, s->img_n * s->img_x * s->img_y);
if (req_comp && req_comp != s->img_n) {
out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y);
if (out == NULL) return out; // stbi__convert_format frees input on failure
}
return out;
}
static int stbi__pnm_isspace(char c)
{
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';
}
static void stbi__pnm_skip_whitespace(stbi__context *s, char *c)
{
while (!stbi__at_eof(s) && stbi__pnm_isspace(*c))
*c = (char) stbi__get8(s);
}
static int stbi__pnm_isdigit(char c)
{
return c >= '0' && c <= '9';
}
static int stbi__pnm_getinteger(stbi__context *s, char *c)
{
int value = 0;
while (!stbi__at_eof(s) && stbi__pnm_isdigit(*c)) {
value = value*10 + (*c - '0');
*c = (char) stbi__get8(s);
}
return value;
}
static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp)
{
int maxv;
char c, p, t;
stbi__rewind( s );
// Get identifier
p = (char) stbi__get8(s);
t = (char) stbi__get8(s);
if (p != 'P' || (t != '5' && t != '6')) {
stbi__rewind( s );
return 0;
}
*comp = (t == '6') ? 3 : 1; // '5' is 1-component .pgm; '6' is 3-component .ppm
c = (char) stbi__get8(s);
stbi__pnm_skip_whitespace(s, &c);
*x = stbi__pnm_getinteger(s, &c); // read width
stbi__pnm_skip_whitespace(s, &c);
*y = stbi__pnm_getinteger(s, &c); // read height
stbi__pnm_skip_whitespace(s, &c);
maxv = stbi__pnm_getinteger(s, &c); // read max value
if (maxv > 255)
return stbi__err("max value > 255", "PPM image not 8-bit");
else
return 1;
}
#endif
static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp)
{
#ifndef STBI_NO_JPEG
if (stbi__jpeg_info(s, x, y, comp)) return 1;
#endif
#ifndef STBI_NO_PNG
if (stbi__png_info(s, x, y, comp)) return 1;
#endif
#ifndef STBI_NO_GIF
if (stbi__gif_info(s, x, y, comp)) return 1;
#endif
#ifndef STBI_NO_BMP
if (stbi__bmp_info(s, x, y, comp)) return 1;
#endif
#ifndef STBI_NO_PSD
if (stbi__psd_info(s, x, y, comp)) return 1;
#endif
#ifndef STBI_NO_PIC
if (stbi__pic_info(s, x, y, comp)) return 1;
#endif
#ifndef STBI_NO_PNM
if (stbi__pnm_info(s, x, y, comp)) return 1;
#endif
#ifndef STBI_NO_HDR
if (stbi__hdr_info(s, x, y, comp)) return 1;
#endif
// test tga last because it's a crappy test!
#ifndef STBI_NO_TGA
if (stbi__tga_info(s, x, y, comp))
return 1;
#endif
return stbi__err("unknown image type", "Image not of any known type, or corrupt");
}
#ifndef STBI_NO_STDIO
STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp)
{
FILE *f = stbi__fopen(filename, "rb");
int result;
if (!f) return stbi__err("can't fopen", "Unable to open file");
result = stbi_info_from_file(f, x, y, comp);
fclose(f);
return result;
}
STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp)
{
int r;
stbi__context s;
long pos = ftell(f);
stbi__start_file(&s, f);
r = stbi__info_main(&s,x,y,comp);
fseek(f,pos,SEEK_SET);
return r;
}
#endif /* !STBI_NO_STDIO */
STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp)
{
stbi__context s;
stbi__start_mem(&s,buffer,len);
return stbi__info_main(&s,x,y,comp);
}
STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int *x, int *y, int *comp)
{
stbi__context s;
stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user);
return stbi__info_main(&s,x,y,comp);
}
#endif /* STB_IMAGE_IMPLEMENTATION */
/*
revision history:
2.06 (2015-04-19) fix bug where PSD returns wrong '*comp' value
2.05 (2015-04-19) fix bug in progressive JPEG handling, fix warning
2.04 (2015-04-15) try to re-enable SIMD on MinGW 64-bit
2.03 (2015-04-12) extra corruption checking (mmozeiko)
stbi_set_flip_vertically_on_load (nguillemot)
fix NEON support; fix mingw support
2.02 (2015-01-19) fix incorrect assert, fix warning
2.01 (2015-01-17) fix various warnings; suppress SIMD on gcc 32-bit without -msse2
2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG
2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg)
progressive JPEG (stb)
PGM/PPM support (Ken Miller)
STBI_MALLOC,STBI_REALLOC,STBI_FREE
GIF bugfix -- seemingly never worked
STBI_NO_*, STBI_ONLY_*
1.48 (2014-12-14) fix incorrectly-named assert()
1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb)
optimize PNG (ryg)
fix bug in interlaced PNG with user-specified channel count (stb)
1.46 (2014-08-26)
fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG
1.45 (2014-08-16)
fix MSVC-ARM internal compiler error by wrapping malloc
1.44 (2014-08-07)
various warning fixes from Ronny Chevalier
1.43 (2014-07-15)
fix MSVC-only compiler problem in code changed in 1.42
1.42 (2014-07-09)
don't define _CRT_SECURE_NO_WARNINGS (affects user code)
fixes to stbi__cleanup_jpeg path
added STBI_ASSERT to avoid requiring assert.h
1.41 (2014-06-25)
fix search&replace from 1.36 that messed up comments/error messages
1.40 (2014-06-22)
fix gcc struct-initialization warning
1.39 (2014-06-15)
fix to TGA optimization when req_comp != number of components in TGA;
fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite)
add support for BMP version 5 (more ignored fields)
1.38 (2014-06-06)
suppress MSVC warnings on integer casts truncating values
fix accidental rename of 'skip' field of I/O
1.37 (2014-06-04)
remove duplicate typedef
1.36 (2014-06-03)
convert to header file single-file library
if de-iphone isn't set, load iphone images color-swapped instead of returning NULL
1.35 (2014-05-27)
various warnings
fix broken STBI_SIMD path
fix bug where stbi_load_from_file no longer left file pointer in correct place
fix broken non-easy path for 32-bit BMP (possibly never used)
TGA optimization by Arseny Kapoulkine
1.34 (unknown)
use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case
1.33 (2011-07-14)
make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements
1.32 (2011-07-13)
support for "info" function for all supported filetypes (SpartanJ)
1.31 (2011-06-20)
a few more leak fixes, bug in PNG handling (SpartanJ)
1.30 (2011-06-11)
added ability to load files via callbacks to accomidate custom input streams (Ben Wenger)
removed deprecated format-specific test/load functions
removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway
error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha)
fix inefficiency in decoding 32-bit BMP (David Woo)
1.29 (2010-08-16)
various warning fixes from Aurelien Pocheville
1.28 (2010-08-01)
fix bug in GIF palette transparency (SpartanJ)
1.27 (2010-08-01)
cast-to-stbi_uc to fix warnings
1.26 (2010-07-24)
fix bug in file buffering for PNG reported by SpartanJ
1.25 (2010-07-17)
refix trans_data warning (Won Chun)
1.24 (2010-07-12)
perf improvements reading from files on platforms with lock-heavy fgetc()
minor perf improvements for jpeg
deprecated type-specific functions so we'll get feedback if they're needed
attempt to fix trans_data warning (Won Chun)
1.23 fixed bug in iPhone support
1.22 (2010-07-10)
removed image *writing* support
stbi_info support from Jetro Lauha
GIF support from Jean-Marc Lienher
iPhone PNG-extensions from James Brown
warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva)
1.21 fix use of 'stbi_uc' in header (reported by jon blow)
1.20 added support for Softimage PIC, by Tom Seddon
1.19 bug in interlaced PNG corruption check (found by ryg)
1.18 (2008-08-02)
fix a threading bug (local mutable static)
1.17 support interlaced PNG
1.16 major bugfix - stbi__convert_format converted one too many pixels
1.15 initialize some fields for thread safety
1.14 fix threadsafe conversion bug
header-file-only version (#define STBI_HEADER_FILE_ONLY before including)
1.13 threadsafe
1.12 const qualifiers in the API
1.11 Support installable IDCT, colorspace conversion routines
1.10 Fixes for 64-bit (don't use "unsigned long")
optimized upsampling by Fabian "ryg" Giesen
1.09 Fix format-conversion for PSD code (bad global variables!)
1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz
1.07 attempt to fix C++ warning/errors again
1.06 attempt to fix C++ warning/errors again
1.05 fix TGA loading to return correct *comp and use good luminance calc
1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free
1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR
1.02 support for (subset of) HDR files, float interface for preferred access to them
1.01 fix bug: possible bug in handling right-side up bmps... not sure
fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all
1.00 interface to zlib that skips zlib header
0.99 correct handling of alpha in palette
0.98 TGA loader by lonesock; dynamically add loaders (untested)
0.97 jpeg errors on too large a file; also catch another malloc failure
0.96 fix detection of invalid v value - particleman@mollyrocket forum
0.95 during header scan, seek to markers in case of padding
0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same
0.93 handle jpegtran output; verbose errors
0.92 read 4,8,16,24,32-bit BMP files of several formats
0.91 output 24-bit Windows 3.0 BMP files
0.90 fix a few more warnings; bump version number to approach 1.0
0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd
0.60 fix compiling as c++
0.59 fix warnings: merge Dave Moore's -Wall fixes
0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian
0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available
0.56 fix bug: zlib uncompressed mode len vs. nlen
0.55 fix bug: restart_interval not initialized to 0
0.54 allow NULL for 'int *comp'
0.53 fix bug in png 3->4; speedup png decoding
0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments
0.51 obey req_comp requests, 1-component jpegs return as 1-component,
on 'test' only check type, not whether we support this variant
0.50 (2006-11-19)
first released version
*/
|
dalter/RetroArch
|
deps/stb/stb_image.h
|
C
|
gpl-3.0
| 221,036 |
/*
* This file is part of RawTherapee.
*
* Copyright (c) 2004-2010 Gabor Horvath <[email protected]>
*
* RawTherapee 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 3 of the License, or
* (at your option) any later version.
*
* RawTherapee 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 RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include "batchqueuebuttonset.h"
#include "multilangmgr.h"
#include "../rtengine/safegtk.h"
extern Glib::ustring argv0;
bool BatchQueueButtonSet::iconsLoaded = false;
Cairo::RefPtr<Cairo::ImageSurface> BatchQueueButtonSet::cancelIcon;
Cairo::RefPtr<Cairo::ImageSurface> BatchQueueButtonSet::headIcon;
Cairo::RefPtr<Cairo::ImageSurface> BatchQueueButtonSet::tailIcon;
BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry)
{
if (!iconsLoaded) {
cancelIcon = safe_create_from_png ("gtk-close.png");
headIcon = safe_create_from_png ("toleftend.png");
tailIcon = safe_create_from_png ("torightend.png");
iconsLoaded = true;
}
add (new LWButton (headIcon, 8, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPMOVEHEAD")));
add (new LWButton (tailIcon, 9, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPMOVEEND")));
add (new LWButton (cancelIcon, 10, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPCANCELJOB")));
}
|
kevinfng/RawTherapee
|
rtgui/batchqueuebuttonset.cc
|
C++
|
gpl-3.0
| 1,801 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math3.distribution;
import org.apache.commons.math3.special.Gamma;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.MathUtils;
/**
* <p>
* Utility class used by various distributions to accurately compute their
* respective probability mass functions. The implementation for this class is
* based on the Catherine Loader's <a target="_blank"
* href="http://www.herine.net/stat/software/dbinom.html">dbinom</a> routines.
* </p>
* <p>
* This class is not intended to be called directly.
* </p>
* <p>
* References:
* <ol>
* <li>Catherine Loader (2000). "Fast and Accurate Computation of Binomial
* Probabilities.". <a target="_blank"
* href="http://www.herine.net/stat/papers/dbinom.pdf">
* http://www.herine.net/stat/papers/dbinom.pdf</a></li>
* </ol>
* </p>
*
* @since 2.1
* @version $Id: SaddlePointExpansion.java 1244107 2012-02-14 16:17:55Z erans $
*/
final class SaddlePointExpansion {
/** 1/2 * log(2 π). */
private static final double HALF_LOG_2_PI = 0.5 * FastMath.log(MathUtils.TWO_PI);
/** exact Stirling expansion error for certain values. */
private static final double[] EXACT_STIRLING_ERRORS = { 0.0, /* 0.0 */
0.1534264097200273452913848, /* 0.5 */
0.0810614667953272582196702, /* 1.0 */
0.0548141210519176538961390, /* 1.5 */
0.0413406959554092940938221, /* 2.0 */
0.03316287351993628748511048, /* 2.5 */
0.02767792568499833914878929, /* 3.0 */
0.02374616365629749597132920, /* 3.5 */
0.02079067210376509311152277, /* 4.0 */
0.01848845053267318523077934, /* 4.5 */
0.01664469118982119216319487, /* 5.0 */
0.01513497322191737887351255, /* 5.5 */
0.01387612882307074799874573, /* 6.0 */
0.01281046524292022692424986, /* 6.5 */
0.01189670994589177009505572, /* 7.0 */
0.01110455975820691732662991, /* 7.5 */
0.010411265261972096497478567, /* 8.0 */
0.009799416126158803298389475, /* 8.5 */
0.009255462182712732917728637, /* 9.0 */
0.008768700134139385462952823, /* 9.5 */
0.008330563433362871256469318, /* 10.0 */
0.007934114564314020547248100, /* 10.5 */
0.007573675487951840794972024, /* 11.0 */
0.007244554301320383179543912, /* 11.5 */
0.006942840107209529865664152, /* 12.0 */
0.006665247032707682442354394, /* 12.5 */
0.006408994188004207068439631, /* 13.0 */
0.006171712263039457647532867, /* 13.5 */
0.005951370112758847735624416, /* 14.0 */
0.005746216513010115682023589, /* 14.5 */
0.005554733551962801371038690 /* 15.0 */
};
/**
* Default constructor.
*/
private SaddlePointExpansion() {
super();
}
/**
* Compute the error of Stirling's series at the given value.
* <p>
* References:
* <ol>
* <li>Eric W. Weisstein. "Stirling's Series." From MathWorld--A Wolfram Web
* Resource. <a target="_blank"
* href="http://mathworld.wolfram.com/StirlingsSeries.html">
* http://mathworld.wolfram.com/StirlingsSeries.html</a></li>
* </ol>
* </p>
*
* @param z the value.
* @return the Striling's series error.
*/
static double getStirlingError(double z) {
double ret;
if (z < 15.0) {
double z2 = 2.0 * z;
if (FastMath.floor(z2) == z2) {
ret = EXACT_STIRLING_ERRORS[(int) z2];
} else {
ret = Gamma.logGamma(z + 1.0) - (z + 0.5) * FastMath.log(z) +
z - HALF_LOG_2_PI;
}
} else {
double z2 = z * z;
ret = (0.083333333333333333333 -
(0.00277777777777777777778 -
(0.00079365079365079365079365 -
(0.000595238095238095238095238 -
0.0008417508417508417508417508 /
z2) / z2) / z2) / z2) / z;
}
return ret;
}
/**
* A part of the deviance portion of the saddle point approximation.
* <p>
* References:
* <ol>
* <li>Catherine Loader (2000). "Fast and Accurate Computation of Binomial
* Probabilities.". <a target="_blank"
* href="http://www.herine.net/stat/papers/dbinom.pdf">
* http://www.herine.net/stat/papers/dbinom.pdf</a></li>
* </ol>
* </p>
*
* @param x the x value.
* @param mu the average.
* @return a part of the deviance.
*/
static double getDeviancePart(double x, double mu) {
double ret;
if (FastMath.abs(x - mu) < 0.1 * (x + mu)) {
double d = x - mu;
double v = d / (x + mu);
double s1 = v * d;
double s = Double.NaN;
double ej = 2.0 * x * v;
v = v * v;
int j = 1;
while (s1 != s) {
s = s1;
ej *= v;
s1 = s + ej / ((j * 2) + 1);
++j;
}
ret = s1;
} else {
ret = x * FastMath.log(x / mu) + mu - x;
}
return ret;
}
/**
* Compute the logarithm of the PMF for a binomial distribution
* using the saddle point expansion.
*
* @param x the value at which the probability is evaluated.
* @param n the number of trials.
* @param p the probability of success.
* @param q the probability of failure (1 - p).
* @return log(p(x)).
*/
static double logBinomialProbability(int x, int n, double p, double q) {
double ret;
if (x == 0) {
if (p < 0.1) {
ret = -getDeviancePart(n, n * q) - n * p;
} else {
ret = n * FastMath.log(q);
}
} else if (x == n) {
if (q < 0.1) {
ret = -getDeviancePart(n, n * p) - n * q;
} else {
ret = n * FastMath.log(p);
}
} else {
ret = getStirlingError(n) - getStirlingError(x) -
getStirlingError(n - x) - getDeviancePart(x, n * p) -
getDeviancePart(n - x, n * q);
double f = (MathUtils.TWO_PI * x * (n - x)) / n;
ret = -0.5 * FastMath.log(f) + ret;
}
return ret;
}
}
|
scptest/scpb
|
org/apache/commons/math3/distribution/SaddlePointExpansion.java
|
Java
|
gpl-3.0
| 7,114 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-07-02 06:15
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
def migrate_win_to_ssh_protocol(apps, schema_editor):
asset_model = apps.get_model("assets", "Asset")
db_alias = schema_editor.connection.alias
asset_model.objects.using(db_alias).filter(platform__startswith='Win').update(protocol='rdp')
class Migration(migrations.Migration):
dependencies = [
('assets', '0016_auto_20180511_1203'),
]
operations = [
migrations.AddField(
model_name='asset',
name='protocol',
field=models.CharField(choices=[('ssh', 'ssh'), ('rdp', 'rdp'), ('telnet', 'telnet (beta)')], default='ssh', max_length=128, verbose_name='Protocol'),
),
migrations.AddField(
model_name='systemuser',
name='login_mode',
field=models.CharField(choices=[('auto', 'Automatic login'), ('manual', 'Manually login')], default='auto', max_length=10, verbose_name='Login mode'),
),
migrations.AlterField(
model_name='adminuser',
name='username',
field=models.CharField(blank=True, max_length=32, validators=[django.core.validators.RegexValidator('^[0-9a-zA-Z_@\\-\\.]*$', 'Special char not allowed')], verbose_name='Username'),
),
migrations.AlterField(
model_name='asset',
name='platform',
field=models.CharField(choices=[('Linux', 'Linux'), ('Unix', 'Unix'), ('MacOS', 'MacOS'), ('BSD', 'BSD'), ('Windows', 'Windows'), ('Windows2016', 'Windows(2016)'), ('Other', 'Other')], default='Linux', max_length=128, verbose_name='Platform'),
),
migrations.AlterField(
model_name='gateway',
name='username',
field=models.CharField(blank=True, max_length=32, validators=[django.core.validators.RegexValidator('^[0-9a-zA-Z_@\\-\\.]*$', 'Special char not allowed')], verbose_name='Username'),
),
migrations.AlterField(
model_name='systemuser',
name='protocol',
field=models.CharField(choices=[('ssh', 'ssh'), ('rdp', 'rdp'), ('telnet', 'telnet (beta)')], default='ssh', max_length=16, verbose_name='Protocol'),
),
migrations.AlterField(
model_name='systemuser',
name='username',
field=models.CharField(blank=True, max_length=32, validators=[django.core.validators.RegexValidator('^[0-9a-zA-Z_@\\-\\.]*$', 'Special char not allowed')], verbose_name='Username'),
),
migrations.RunPython(migrate_win_to_ssh_protocol),
]
|
jumpserver/jumpserver
|
apps/assets/migrations/0017_auto_20180702_1415.py
|
Python
|
gpl-3.0
| 2,702 |
#!/usr/bin/env python
# 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 3 of the License, or
# (at your option) any later version.
modes = {
'argparse':0,
'trivia':1
}
mpd_host = {
'host':'localhost',
'port':'6600'
}
fortunes = [
"A new friend helps you break out of an old routine",
"Friends long absent are coming back to you.",
"The time is right to make new friends.",
"You may be hungry soon: order a takeout now.",
"He who climbs a ladder must begin at the first step.",
"You will travel to many places.",
"You should be able to undertake and complete anything",
"You will enjoy good health, you will be surrounded by luxury",
"Do not hesitate to look for help, an extra hand should always be welcomed.",
"Sometimes advice is what we ask for when we already know the answer.",
"Sooner or later, those who win are those who think they can.",
"We are here on the planet only once, and might as well get a feel for the place.",
"Great works are performed not by strength, but by perseverance.",
"People who are late are often happier than those who have to wait for them",
"Present your best ideas today to an eager and welcoming audience.",
"Every situation, properly perceived, becomes an opportunity.",
"Things which matter most must never be at the mercy of things which matter least.",
"Plan your work and work your plan.",
"How can you have a beautiful ending without making beautiful mistakes?",
"Humour is an affirmation of dignity.",
"You will accept yourself.",
"What's vice today may be virtue tomorrow.",
"Make somebody happy today. Mind your own business.",
"Be a generous friend and a fair enemy.",
"Old friends, old wines and old gold are best",
"If your desires are not extravagant, they will be granted",
"Every Friend Joys in your Success",
"Never quit!",
"Dream lofty dreams, and as you dream, so shall you become.",
"It's easier to fight for one's principles than to live up to them.",
"The valor that struggles is better than the weakness that endures.",
"There is only one success - to be able to spend life in your own way.",
"Destiny is not a matter of chance; but a matter of choice.",
"Reach high, for stars life hidden in your soul. Dream deep, for every dream precedes the goal.",
"The world can only be grasped by action, not by contemplation.",
"You get in life what you have the courage to ask for.",
"Oh, what a tangled website we weave when first we practice.",
"Good day for a change of scene. Repaper the bedroom wall.",
"Do not live your life in fear, for if you do, you will never live your life",
"We know who you are and we saw what you did last summer!",
"Everything is going your way. There is little need for concern, as each path you choose will turn out to be the best one",
"A momentary lapse in vigilance can lead to trouble. If you stay alert, you will eventually reach your goal.",
"You will find something under the bed.",
"even if you are on the right track, you will get run over if you just sit there.",
"wag more, bark less.",
"Heroes do while wannabes wait for the cameras to be watching...",
"The harder you fall, the higher you bounce.",
"the stars, in their infinite wisdom, recommend that you check yourself, as not doing so might lead you to wreck yourself.",
]
quotes = [
"The leader seeks to communicate his vision to his followers.",
"Half the people you know are below average.",
"If you ain't makin' waves, you ain't kickin' hard enough!",
"It's easier to fight for one's principles than to live up to them.",
"The price of greatness is responsibility.",
"There is always time to make right what is wrong.",
"Right now there's an energy pushing you in a new direction.",
"A well-aimed spear is worth three.",
"You don't choose which path to take, but you will keep searching for the answers.",
"When life gives you lemons; you paint them gold.",
"If life gives you melons, you must be dyslexic.",
"If you're going to get in trouble for hitting someone, might as well hit them hard.",
"One size does not fit all.",
"When you assume, you make an ass out of u and me.",
"If explosives don't solve your problems; you aren't using enough.",
"Predictably Unpredictable.",
"Aspire to inspire before you expire.",
"Knowledge is power, and power corrupts. So study hard and be evil.",
"I am disappointment in you're grammar.",
"I'll have a double cappuccino, half-caffeine, non-fat milk, with enough foam to be aesthetically pleasing, but not so much that it would leave a mustache.",
"Don't sweat the petty things; and don't pet the sweaty things.",
"The shinbone is a device for finding furniture in a dark room.",
"A smile is like tight underwear... it makes your cheeks go up.",
"I like work. It fascinates me. I sit and look at it for hours.",
"When in doubt, mumble.",
"A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.",
"If you think nobody cares if you're alive, try missing a couple of payments.",
"If your pants are on fire, being a liar becomes less important.",
"Without geography, you're nowhere.",
"The harder you fall, the higher you bounce.",
"Eagles may soar in the clouds, but weasels never get sucked into jet engines.",
"We should buy a fence and make people pay us two dollars to get in.",
"You're slower than a herd of turtles stampeding through peanut butter.",
"I was going to clean the apartment but had so many things on my 'to do' list that I decided to treat them all equally and draw pictures of sharks instead.",
"I am currently away on leave, travelling through time and will be returning last week.",
"The early bird gets the worm, but the second mouse gets the cheese.",
"If the world didn't suck, we'd all fall off.",
"The depressing thing about tennis is that no matter how good I get, I'll never be as good as a wall.",
"There are three kinds of people; those who can count and those who can't.",
"Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.",
"If you're gonna be two-faced at least make one of them pretty.",
"If you're drinking to forget, please pay in advance.",
"I got food poisoning today. I don't know when I'll use it.",
"Don't get your panties in a knot; it just makes you walk funny.",
"Muffins are just ugly cupcakes.",
"Don't judge a book by its fur.",
"Your x-ray showed a broken rib, but we fixed it with Photoshop.",
"You can pay for school but you can't buy class.",
"People aren't either wicked or noble. They're like chef's salads, with good things and bad things chopped and mixed together in a vinaigrette of confusion and conflict.",
"A day without sunshine is like, you know, night.",
"It takes skills to trip over flat surfaces.",
"You don't have to be crazy to work here. They'll train you.",
"Squares and Triangles Agree: Circles are Pointless.",
"Why be difficult when with a bit of effort you can be impossible?",
"When choosing between two evils, I always like to try the one I've never tried before.",
"I eat lightning and crap thunder.",
"I'd like to help you out. Which way did you come in?",
"Warning: Dates in Calendar are closer than they appear.",
"When you don't know what to do, walk fast and look worried.",
"Your first instinct will be to run, while your second instinct will be to find your legs.",
"you'll finally get into shape this week, though which one exactly, isn't clear yet.",
"it is said that the eyes are the windows to one's soul, which helps explain why so many damn birds keep flying into them.",
"first you take a drink, then the drink takes a drink, then the drink takes you.",
"even if you are on the right track, you will get run over if you just sit there.",
"wag more, bark less.",
"I never forget a face, but in your case I'll be glad to make an exception.",
"if at first you don't succeed, then skydiving definitely isn't for you.",
"the brain is a wonderful organ; it starts working the moment you get up in the morning, and does not stop until you get into the office",
"the shortest distance between two points is under construction.",
"the less they think, the more they talk.",
"I'd love to trade Caller I.D. for Caller I.Q.",
"you can try dancing around the issue all you want, but in the end, you still don't know what to do with your arms while on the dance floor.",
"you will come face to face with your worst fears this week after standing in front of a bathroom mirror.",
"Advances in science will soon allow man to travel to the most distant corners of the universe. Still no word, however, on it being able to get you off that couch.",
"I owe, I owe, so it's off to work I go.",
"Energizer Bunny arrested, charged with battery.",
"Silence is golden, but duct tape is silver.",
"your eyes are like diamonds and your teeth are like glass but your face reminds me of king kong's ass.",
"I'm not confused. I'm just well mixed.",
"how old would you be if you didn't know how old you are?",
"there's nothing better than a long hot shower to wash away all of your worries; except for my bills.They keep clogging the drain.",
"I like nonsense, it wakes up the brain cells.",
"always forgive your enemies; nothing annoys them more.",
"The statistics on sanity are that one out of every four people is suffering from a mental illness. Look at your 3 close friends. If they're ok, then it's you.",
"I love deadlines. I like the whooshing sound they make as they go by.",
"thinking about thinking but thinks thinking would be a bad thing to think about thinking so thinks I should stop thinking about thinking.",
"you look like I could use a drink.",
"if there's an umbrella in my drink, it better be raining.",
"Time flies like an arrow; fruit flies like a banana.",
"a lie can travel halfway around the world while the truth is putting on its shoes.",
"beauty is in the eye of the beholder and it may be necessary from time to time to give a stupid or misinformed beholder a black eye.",
"I like your approach. Now let's see your departure.",
"Some people are like slinkies; not really good for anything, but they bring a smile to your face when pushed down the stairs.",
"it takes a lot more to be unhappy.",
"I didn't slap you, I simply high fived your face.",
"If you ain't makin' waves, you ain't kickin' hard enough!",
"When life gives you lemons; you paint them gold.",
"If life gives you melons, you must be dyslexic.",
"If you're going to get in trouble for hitting someone, might as well hit them hard.",
"One size does not fit all.",
"When you assume, you make an ass out of u and me.",
"If explosives don't solve your problems; you aren't using enough.",
"Predictably Unpredictable.",
"Aspire to inspire before you expire.",
"Knowledge is power, and power corrupts. So study hard and be evil.",
"I am disappointment in you're grammar.",
"I'll have a double cappuccino, half-caffeine, non-fat milk, with enough foam to be aesthetically pleasing, but not so much that it would leave a mustache.",
"Don't sweat the petty things; and don't pet the sweaty things.",
"The shinbone is a device for finding furniture in a dark room.",
"A smile is like tight underwear...it makes your cheeks go up.",
"I like work. It fascinates me. I sit and look at it for hours.",
"When in doubt, mumble.",
"A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.",
"If you think nobody cares if you're alive, try missing a couple of payments.",
"If your pants are on fire, being a liar becomes less important.",
"Without geography, you're nowhere.",
"Eagles may soar in the clouds, but weasels never get sucked into jet engines.",
"We should buy a fence and make people pay us two dollars to get in.",
"You're slower than a herd of turtles stampeding through peanut butter.",
"I was going to clean the apartment but had so many things on my 'to do' list that I decided to treat them all equally and draw pictures of sharks instead.",
"I am currently away on leave, travelling through time and will be returning last week.",
"The early bird gets the worm, but the second mouse gets the cheese.",
"If the world didn't suck, we'd all fall off.",
"The depressing thing about tennis is that no matter how good I get, I'll never be as good as a wall.",
"There are three kinds of people; those who can count and those who can't.",
"Before you criticize someone, you should walk a mile in their shoes. That way when you criticize them, you are a mile away from them and you have their shoes.",
"If you're gonna be two-faced at least make one of them pretty.",
"If you're drinking to forget, please pay in advance.",
"I got food poisoning today. I don't know when I'll use it.",
"Don't get your panties in a knot; it just makes you walk funny.",
"Muffins are just ugly cupcakes.",
"Don't judge a book by its fur.",
"Your x-ray showed a broken rib, but we fixed it with Photoshop.",
"If I was as ugly as you were, I wouldn't say Hi to others, I'd say BOO!",
"You can pay for school but you can't buy class.",
"People aren't either wicked or noble. They're like chef's salads, with good things and bad things chopped and mixed together in a vinaigrette of confusion and conflict.",
"A day without sunshine is like, you know, night.",
"It takes skills to trip over flat surfaces.",
"You don't have to be crazy to work here. They'll train you.",
"Squares and Triangles Agree: Circles are Pointless.",
"Why be difficult when with a bit of effort you can be impossible?",
"When choosing between two evils, I always like to try the one I've never tried before.",
"I eat lightning and crap thunder.",
"I'd like to help you out. Which way did you come in?",
"Warning: Dates in Calendar are closer than they appear.",
"On the other hand, you have different fingers.",
"When you don't know what to do, walk fast and look worried.",
"Your first instinct will be to run, while your second instinct will be to find your legs.",
"Make somebody happy today. Mind your own business.",
"Drink coffee; do stupid things faster with more energy!",
"the stars, in their infinite wisdom, recommend that you check yourself, as not doing so might lead you to wreck yourself.",
"you'll finally get into shape this week, though which one exactly, isn't clear yet.",
"it is said that the eyes are the windows to one's soul, which helps explain why so many damn birds keep flying into them.",
"first you take a drink, then the drink takes a drink, then the drink takes you.",
"I never forget a face, but in your case I'll be glad to make an exception.",
"if at first you don't succeed, then skydiving definitely isn't for you.",
"the brain is a wonderful organ; it starts working the moment you get up in the morning, and does not stop until you get into the office",
"the shortest distance between two points is under construction.",
"the less they think, the more they talk.",
"I'd love to trade Caller I.D. for Caller I.Q.",
"you can try dancing around the issue all you want, but in the end, you still don't know what to do with your arms while on the dance floor.",
"you will come face to face with your worst fears this week after standing in front of a bathroom mirror.",
"Advances in science will soon allow man to travel to the most distant corners of the universe. Still no word, however, on it being able to get you off that couch.",
"I owe, I owe, so it's off to work I go.",
"Energizer Bunny arrested, charged with battery.",
"Silence is golden, but duct tape is silver.",
"your eyes are like diamonds and your teeth are like glass but your face reminds me of king kong's ass.",
"I'm not confused. I'm just well mixed.",
"how old would you be if you didn't know how old you are?",
"there's nothing better than a long hot shower to wash away all of your worries; except for my bills.They keep clogging the drain.",
"I like nonsense, it wakes up the brain cells.",
"always forgive your enemies; nothing annoys them more.",
"The statistics on sanity are that one out of every four people is suffering from a mental illness. Look at your 3 close friends. If they're ok, then it's you.",
"I love deadlines. I like the whooshing sound they make as they go by.",
"thinking about thinking but thinks thinking would be a bad thing to think about thinking so thinks I should stop thinking about thinking.",
"you look like I could use a drink.",
"if there's an umbrella in my drink, it better be raining.",
"Time flies like an arrow; fruit flies like a banana.",
"A lie can travel halfway around the world while the truth is putting on its shoes.",
"beauty is in the eye of the beholder and it may be necessary from time to time to give a stupid or misinformed beholder a black eye.",
"I like your approach. Now let's see your departure.",
"some people are like slinkies; not really good for anything, but they bring a smile to your face when pushed down the stairs.",
"it takes a lot more to be unhappy.",
"I didn't slap you, I simply high fived your face."
]
fmls = [
"Today, it was my wedding day, and while I was standing next to my husband in front of all of our guests, I was rocking on my heels because I was nervous. I rocked too far and fell backward. My husband didn't come to help me up. He just said at the top of his lungs, 'FAIL!' FML",
"Today, I tried whitening my teeth with an off-brand product. It didn't whiten my teeth, but it did burn parts of my gums off. FML",
"Today, I drunkenly staggered home and crashed on the couch. When I woke up I realized it wasn't my house. FML",
"Today, my five year old daughter came up to me and asked, \"Mom, why are we so poor?\" I replied, in a sweet motherly tone \"Honey, we're not poor.\" She then asked, \"Then why do you dress like we are poor?\" FML",
"Today, my flatmate was listening to opera on full volume all afternoon and now he's playing James Bond on the trumpet. FML",
"Today, while mowing the lawn, I ran over a hornet's nest. FML",
"Today, I was practising the violin in my apartment. A man knocks on the door and introduces himself with a smile, says he wants to know my \"schedule.\" I reply, \"I'm pretty busy but maybe we could get a drink sometime.\" To which he retorts, \"No, I just want to know when you'll stop.\" FML",
"Today, my girlfriend of four years friend-zoned me while I was proposing to her. FML",
"Today, my boyfriend and I started our diet. After a long day of being held accountable for every calorie I ate, I went home to sneak a snack. My boyfriend came over to surprise me, and found me on the couch shoveling left-over Indian food into my mouth. FML",
"Today, I was running the 100m sprint in a track meet. Me and another girl were tied for dead last. When we finished, she complained, \"It's so embarrassing how slow I am today. I have shin splints. What happened to you?\" I was actually running my hardest. FML",
"Today, during a slow dance, my date wrapped his arms around my waist. Right as I touched his neck he says, \"Sorry, I'm slightly sweaty.\" He wasn't lying. For the longest two minutes of my life I was swimming in his sweat. FML",
"Today, my 4 year-old daughter's favorite expression became \"shit balls.\" FML",
"Today, I found out my brother blew chunks into the inside of my jeans. How did I find this out? I put them on. FML",
"Today, I learned that my mother now refuses to drink anything but bottled water because she actually believes that the government is putting a chemical in tap water that lowers pregnancy rates. She is trying for her 5th child. FML",
"Today, I went on a date with a woman. She brought along her stuffed rabbit, and introduced us. FML",
"Today, I attended the wrong funeral. I spent twenty minutes trying to hide and walk away without being too conspicuous. FML",
"Today, I made it my life goal to own a towel heater. FML",
"Today, my parents went out of town and I was home all alone. I put up party decorations such as streamers, balloons and confetti. Then, I drank out of red cups, crushed them up and put them all over the house. I didn't have a party, I just wanted to convince my family that I'm not a loser. FML",
"Today, I thought I was home alone, so I started singing to my cat. After a half hour of this, I finally stopped. Then I heard applauding. I turned around to find my parents standing in my doorway. FML",
"Today, my father decided to \"prepare\" me for the real world by telling me that I'm ugly. FML",
"Today, my younger brother brought home his new bagpipes. My older brother plays the drums. I'm currently preparing to sit the most important exams of my schooling life. FML",
"Today, I learned that several thousand people in my state got tickets this month for driving and talking on the phone. My mom called to tell me this while I was driving. I'm now part of that statistic. Thanks, mom. FML",
"Today, I have two black eyes. The first one I got from the girl whose ass I mistakenly grabbed at a party last night. The other one I got from my girlfriend when I explained the first one. FML",
"Today, my friend asked me if I could watch her mother's cats while they go on vacation. I agreed since her house is on my way to work. When I talked to her mother, I found out she has 30-something cats. She reckons she lost count. FML",
"Today, I was kicked out of a Family Dollar. My mom thought it would be fun to press all the buttons on the musical ceramic cathedrals so they would all play at the same time. FML",
"Today, while I was mowing the lawn in my backyard, I ran over a glass bottle. My legs looked like a disco ball. FML",
"Today, I caught my pregnant wife smoking. This is after I quit over a month ago to show her my support and be a good influence on our child. FML",
"Today, my co-worker came back from Thailand with big new breasts. She told me to go ahead and touch them because they have a funny texture for the first few months. When our GM entered the room, I had both hands down my co-worker's shirt, agreeing that they were unnaturally firm. FML",
"Today, I was getting off of work, talking to my boss and I asked if I could get a ride home, since my usual ride was too lazy to come get me. He said, sure, but to be really careful since he just had his car detailed. I was getting in the car, tripped and threw my hot cocoa all inside of his car. FML",
"Today, my favorite fish died. To make things better my parents thought to take me out to dinner. We ate sushi. FML",
"Today, I asked my mother if she thought my cat was getting fat. She replied \"It's not the cat you should worry about\". FML",
"Today, I was going home with the tomato plant I just bought in my cup holder. The smell of it was filling the car and I love the smell so I picked it up and took a wiff. A few moments later I got pulled over. Apparantly, the cop saw me sniff it and thought I was smelling a marijuana plant. FML",
"Today, we got our yearbooks for school. I opened to my profile to see that they misspelled my first name which is James. They wrote Lames. FML",
"Today, my math teacher told me to learn how to say \"welcome to wal-mart\". FML",
"Today, I was out drinking with some friends in a Safeway parking lot, when I saw a familiar-looking vehicle pull up beside us. It was my dad, who angrily got out and demanded that I come home. I'm twenty-four, and now the laughingstock of my social circle. FML",
"Today, I came back to my apartment to see that my roommate had left out bread, deli meat, and cheese on the counter, and made myself a sandwich. When she came back, she informs me that she found bugs in the fridge and took out all the food she thought would be contaminated. FML",
"Today, I bit into a Reese's Cup that had been sitting on my desk for a while. As I did, half of a yellow meal worm fell out and landed in front of me, the other half was in my mouth. It was wiggling. FML",
"Today, I was woken up by my 5 year old daughter hitting me with a pillow because she had a dream that I was using her tooth brush on the dog. We don't have a dog. She is now refusing to brush her teeth. FML",
"Today, I found out that if you don't clean the inside of your sonicare toothbrush, it can grow masses of fungus. I've been brushing my teeth with a vibrating mushroom for the past 5 months. FML",
"Today, I learned the hard way that if you're going to pour bleach on bugs to kill them, you need to be prepared for them to fly up and try to attack your face. FML",
"Today, I tried to close my desk drawer by hitting it with my hip, like they do in the movies. Everything on my desk fell off. FML",
"Today, I was late for the bus. I chased after it for 3 blocks until I realized that the bus driver was laughing at me trying to catch her. FML",
"Today, after finally getting a job offer after months of unemployment, I found out that the person who was going to hire me got fired. Which means I'm not getting the job. FML",
"Today, my friends thought it would be a good idea to make fun of a homeless man. I didn't fancy making fun of the less fortunate, so I stayed a bit back. Still, the homeless man didn't think it would matter to throw a rock at me after my buddies ran away. FML",
"Today, I was expecting a very important work call. Today was also the day I got insuppressible diarrhea. As I was running to the washroom, the phone rang. I didn't make it to the washroom or the phone. FML",
"Today, my book bag was so heavy that it set off my car's passenger detection system in the front seat. I had to buckle in my textbooks. FML",
"Today, I cleaned out my house and placed multiple boxes of clothes and books in my two-seated truck to take to the Goodwill. While turning onto the highway, everything tumbled on top of me, sending me crashing into a guardrail. FML",
"Today, I brought my girlfriend of four months home for dinner to meet my parents. The first thing my mom says to her? \"Oh my God, you're real!\" FML",
"Today, I had a job interview for a job I've been dying to have. As I'm walking into the office, the manager says, \"Aren't you my son's ex, the one he cheated on?\" All I could do was sit there quietly as he laughed at me. FML",
"Today, I took a shower at my friend's house. The shampoo smelled really good that I asked my friend where she bought it so I could get one also. Her reply? Petco. I just washed my hair with dog shampoo. FML",
"Today, my wife and I were planning our nursery for our future child. She said that we'd be painting it pink either way. I asked what would happen if we had a boy. She said \"Oh, he'll be gay\" with a menacing glare. I'm worried. FML",
]
tolds = [
"TOLDASAURUS REX",
"Cash4told.com",
"No country for told men",
"Knights of the told Republic",
"ToldSpice",
"The Elder Tolds IV: Oblivious",
"Command & Conquer: Toldberian Sun",
"GuiTold Hero: World Told",
"Told King of Boletaria",
"Countold Strike",
"Unreal Toldament",
"Stone-told Steve Austin",
"Half Life 2: Episode Told",
"World of Warcraft: Catoldclysm",
"Roller Coaster Toldcoon",
"Assassin's Creed: Tolderhood",
"Battletolds",
"S.T.A.L.K.E.R.: Shatold of Chernobyl",
"Toldasauraus Rex 2: Electric Toldaloo",
"Told of Duty 4: Modern Toldfare",
"Pokemon Told and Silver",
"The Legend of Eldorado : The Lost City of Told",
"Rampage: Toldal Destruction",
"Told Fortress Classic",
"Toldman: Arkham Told",
"The Good, The Bad, and The Told",
"Super Mario SunTold",
"Legend of Zelda: Toldacarnia of Time",
"Toldstone creamery",
"Mario Golf: Toldstool Tour",
"Super Told Boy",
"Left 4 Told",
"Battoldfield: Bad Company 2",
"Toldman Sachs",
"Conker's Bad Fur Day: Live and Retolded",
"Lead and Told: Gangs of the Wild West",
"Portold 2",
"Avatold: The Last Airbender",
"Dragon Ball Z Toldkaichi Budokai",
"Toldcraft II: Tolds of Toldberty",
"Leo Toldstoy",
"Metal Gear Toldid 3: Snake Eater",
"J.R.R Toldkien's Lord of the Told",
"Told you that ps3 has no games",
"LitTOLD Big Planet",
"Rome: Toldal War",
"Gran Toldrismo 5",
"Told Calibur 4",
"Told Fortress 2",
"Castlevania: RonTold of Blood",
"Guilty Gear XX Accent Told",
"Cyndaquil, Chicorita, and Toldodile",
"was foretold",
"Demon's Told",
"youtold.com",
"Tolden Sun: Dark Dawn",
"Tic-Tac-Told",
"Biotold 2",
"Toldbound",
"icetold",
"Told of the Rings"
]
trivias = {
'misc':[
['A phobia characterized by a fear of blood?', 'Hemophobia'],
['What is a more common name in this country for an item originally called an "India rubber"?', 'eraser'],
['What is the fastest land animal in the world?', 'Cheetah'],
['Is a dolphin a mammal?', 'Yes'],
['What is converted into alcohol during brewing?', 'Sugar'],
['If cats are feline, what are sheep?', 'Ovine'],
['What is the other name for Wildebeest?', 'GNU'],
],
'a':[
['What was the first James Bond novel?', 'Casino Royale'],
['What popular operating system are the Mac OS X series based on?', 'Unix'],
["What chess piece has a horse's head?", 'Knight'],
['What was the first US city to have a public school system?', 'Boston'],
['What does NATO stand for?', 'North Atlantic Treaty Organization'],
],
'b':[
['What is the name for a human third molar?', 'Wisdom Tooth'],
['What playing card symbolizes death?', 'Ace of spades'],
['The Himalayas are located on which continent?', 'Asia'],
['Basic Brich?', 'Sarah'],
['When was the Red Bull energy drink first introduced?', '1987'],
],
'c':[
['What do whales feed their young?', 'Milk'],
['What animated movie takes its name from a Yiddish word meaning monster?', 'Shrek'],
['What is the device that measures the number of steps you take when walking or running?', 'Pedometer'],
['What is the main ingredient in glass?', 'Sand'],
['The title of the final "A Song of Ice and Fire" novel will be...?', 'A Dream of Spring'],
],
'd':[
['Which country has the longest coastline?', 'Canada'],
['What is heaven to fallen Norse warriors?', 'Valhalla'],
['What name was given to people who made illegal booze during prohibition?', 'Bootleggers'],
['What is the strongest muscle in the human body?', 'Tongue'],
['The folklore characters known as "oni" originated in which country?', 'Japan'],
],
'e':[
['What year was the movie "Titanic" released?', '1997'],
['Which Spice girl was the only one named after a spice?', 'Ginger'],
['What slogan did Nancy Reagan create for her drug awareness campaign?', 'Just Say No'],
['Which British prime minister was awarded the Nobel Prize for Literature?', 'Winston Churchill'],
['Who directed the 1996 movie "Mars Attacks!"?', 'Tim Burton'],
],
'gameofthrones':[
['In "A Song of Ice and Fire" what is the motto of House Lannister?', 'Hear Me Roar'],
['Characters in the show derisively refer to Tyrion Lannister as "The ____"', 'Imp'],
['What is the name of the youngest Stark child?', 'Rickon'],
['What is the Dothraki word for "thank you"?', 'none'],
['Game of Thrones is set in the fictional land of Westeros. How many Kingdoms does it have?', '7'],
],
}
links = [
'https://www.shippingsoon.com',
'http://www.mylesburke.net',
'http://www.joeygrasso.com',
'http://www.pageben.com',
'http://www.dracsoft.com',
'http://www.calebsuttles.com',
'http://www.livinmoti.com',
'http://robincrockett.writersresidence.com',
'Basic Brich: http://WWW.SARAHLEIGHBRICH.COM'
]
VERSION = 'Vada v0.7'
COPYRIGHT = 'GNU General Public License v3.0 - All Rights Reversed'
#Copyright 2014 Shippingsoon - All Rights Reserved
|
shippingsoon/Shippingsoon
|
uploads/articles/src/12/config.py
|
Python
|
gpl-3.0
| 31,703 |
//#include "stdafx.h"
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
#include <vld/vld.h>
#endif
#include <iostream>
#include <stdexcept>
#include <cstdlib>
int main(int argc, char* argv[])
{
int gnuplot_main(int argc, char* argv[]);
int graphviz_main(int argc, char* argv[]);
int mathgl_main(int argc, char* argv[]);
int plplot_main(int argc, char *argv[]);
int vtk_main(int argc, char* argv[]);
int retval = EXIT_SUCCESS;
try
{
std::cout << "gnuplot -------------------------------------------------------------" << std::endl;
retval = gnuplot_main(argc, argv);
std::cout << "\nGraphviz library ----------------------------------------------------" << std::endl;
//retval = graphviz_main(argc, argv); // Not yet implemented.
std::cout << "\nMathGL library ------------------------------------------------------" << std::endl;
//retval = mathgl_main(argc, argv);
std::cout << "\nPLplot library ------------------------------------------------------" << std::endl;
//retval = plplot_main(argc, argv);
std::cout << "\nVTK library ---------------------------------------------------------" << std::endl;
//retval = vtk_main(argc, argv); // Not yet implemented.
}
catch (const std::bad_alloc &e)
{
std::cout << "std::bad_alloc caught: " << e.what() << std::endl;
retval = EXIT_FAILURE;
}
catch (const std::exception &e)
{
std::cout << "std::exception caught: " << e.what() << std::endl;
retval = EXIT_FAILURE;
}
catch (...)
{
std::cout << "Unknown exception caught" << std::endl;
retval = EXIT_FAILURE;
}
std::cout << "Press any key to exit ..." << std::endl;
std::cin.get();
return retval;
}
|
sangwook236/SWDT
|
sw_dev/cpp/ext/test/visualization/main.cpp
|
C++
|
gpl-3.0
| 1,743 |
package pt.ist.fenixframework.dml.runtime;
import java.util.LinkedList;
import pt.ist.fenixframework.DomainObject;
public class DirectRelation<C1 extends DomainObject, C2 extends DomainObject> implements Relation<C1, C2> {
private Relation<C2, C1> inverse;
private Role<C1, C2> firstRole;
private final String name;
private LinkedList<RelationListener<C1, C2>> listeners = null;
public DirectRelation(Role<C1, C2> firstRole, String name) {
this.firstRole = firstRole;
this.name = name;
inverse = new InverseRelation<C2, C1>(this, name);
}
public DirectRelation(Role<C1, C2> firstRole, String name, RelationListener<C1, C2>... listeners) {
this(firstRole, name);
for (RelationListener<C1, C2> listener : listeners) {
addListener(listener);
}
}
@Override
public boolean add(C1 o1, C2 o2) {
if (listeners != null) {
for (RelationListener<C1, C2> l : listeners) {
l.beforeAdd(this, o1, o2);
}
}
boolean added = firstRole.add(o1, o2, this);
firstRole.getInverseRole().add(o2, o1, inverse);
if (listeners != null) {
for (RelationListener<C1, C2> l : listeners) {
l.afterAdd(this, o1, o2);
}
}
return added;
}
@Override
public boolean remove(C1 o1, C2 o2) {
if (listeners != null) {
for (RelationListener<C1, C2> l : listeners) {
l.beforeRemove(this, o1, o2);
}
}
boolean removed = firstRole.remove(o1, o2);
firstRole.getInverseRole().remove(o2, o1);
if (listeners != null) {
for (RelationListener<C1, C2> l : listeners) {
l.afterRemove(this, o1, o2);
}
}
return removed;
}
@Override
public Relation<C2, C1> getInverseRelation() {
return inverse;
}
protected LinkedList<RelationListener<C1, C2>> getListeners() {
if (listeners == null) {
listeners = new LinkedList<RelationListener<C1, C2>>();
}
return listeners;
}
public void addListener(RelationListener<C1, C2> listener) {
getListeners().add(listener);
}
public void removeListener(RelationListener<C1, C2> listener) {
getListeners().remove(listener);
}
@Override
public String getName() {
return name;
}
}
|
jcarvalho/fenix-framework
|
core/dml-compiler/dml/src/main/java/pt/ist/fenixframework/dml/runtime/DirectRelation.java
|
Java
|
gpl-3.0
| 2,475 |
#region License
// Copyright (c) 2013, ClearCanvas Inc.
// All rights reserved.
// http://www.ClearCanvas.ca
//
// This file is part of the ClearCanvas RIS/PACS open source project.
//
// The ClearCanvas RIS/PACS open source project 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 3 of the
// License, or (at your option) any later version.
//
// The ClearCanvas RIS/PACS open source project 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
// the ClearCanvas RIS/PACS open source project. If not, see
// <http://www.gnu.org/licenses/>.
#endregion
using Macro.Common;
using Macro.Desktop.Tools;
using Macro.Desktop.Actions;
namespace Macro.Desktop.ExtensionBrowser
{
[MenuAction("show", "global-menus/MenuTools/MenuUtilities/MenuExtensionBrowser", "Show", Flags = ClickActionFlags.CheckAction)]
[ActionPermission("show", AuthorityTokens.Desktop.ExtensionBrowser)]
[GroupHint("show", "Application.Browsing.Extensions")]
[Macro.Common.ExtensionOf(typeof(DesktopToolExtensionPoint))]
public class ExtensionBrowserTool : Tool<IDesktopToolContext>
{
private IShelf _shelf;
public ExtensionBrowserTool()
{
}
public void Show()
{
if (_shelf != null)
{
_shelf.Activate();
}
else
{
ExtensionBrowserComponent browser = new ExtensionBrowserComponent();
_shelf = ApplicationComponent.LaunchAsShelf(
this.Context.DesktopWindow,
browser,
SR.TitleExtensionBrowser,
"Extension Browser",
ShelfDisplayHint.DockLeft | ShelfDisplayHint.DockAutoHide);
_shelf.Closed += OnShelfClosed;
}
}
private void OnShelfClosed(object sender, ClosedEventArgs e)
{
_shelf = null;
}
protected override void Dispose(bool disposing)
{
if (_shelf != null)
_shelf.Closed -= OnShelfClosed;
base.Dispose(disposing);
}
}
}
|
151706061/MacroMedicalSystem
|
Desktop/ExtensionBrowser/ExtensionBrowserTool.cs
|
C#
|
gpl-3.0
| 2,301 |
/* Unobtrustive Code Highlighter By Dan Webb 11/2005
Version: 0.4
Usage:
Add a script tag for this script and any stylesets you need to use
to the page in question, add correct class names to CODE elements,
define CSS styles for elements. That's it!
Known to work on:
IE 5.5+ PC
Firefox/Mozilla PC/Mac
Opera 7.23 + PC
Known to degrade gracefully on:
IE5.0 PC
Safari (until it supports functions in replace statements)
Note: IE5.0 fails due to the use of lookahead in some stylesets. To avoid script errors
in older browsers use expressions that use lookahead in string format when defining stylesets.
This script is inspired by star-light by entirely cunning Dean Edwards
http://dean.edwards.name/star-light/.
*/
var CodeHighlighter = { styleSets : new Array };
CodeHighlighter.addStyle = function(name, rules) {
// using push test to disallow older browsers from adding styleSets
if ([].push) this.styleSets.push({
name : name,
rules : rules,
ignoreCase : arguments[2] || false
})
function setEvent() {
// set highlighter to run on load
var old = window.onload;
if (typeof window.onload != 'function') {
window.onload = function() { CodeHighlighter.init() }
} else {
window.onload = function() {
oldonload();
CodeHighlighter.init();
}
}
}
// only set the event when the first style is added
if (this.styleSets.length==1) setEvent();
}
CodeHighlighter.init = function() {
if (!document.getElementsByTagName) return;
if ("a".replace(/a/, function() {return "b"}) != "b") return; // throw out Safari versions that don't support replace function
// throw out older browsers
var codeEls = document.getElementsByTagName("CODE");
// collect array of all pre elements
codeEls.filter = function(f) {
var a = new Array;
for (var i = 0; i < this.length; i++) if (f(this[i])) a[a.length] = this[i];
return a;
}
var rules = new Array;
rules.toString = function() {
// joins regexes into one big parallel regex
var exps = new Array;
for (var i = 0; i < this.length; i++) exps.push(this[i].exp);
return exps.join("|");
}
function addRule(className, rule) {
// add a replace rule
var exp = (typeof rule.exp != "string")?String(rule.exp).substr(1, String(rule.exp).length-2):rule.exp;
// converts regex rules to strings and chops of the slashes
rules.push({
className : className,
exp : "(" + exp + ")",
length : (exp.match(/(^|[^\\])\([^?]/g) || "").length + 1, // number of subexps in rule
replacement : rule.replacement || null
});
}
function parse(text, ignoreCase) {
// main text parsing and replacement
return text.replace(new RegExp(rules, (ignoreCase)?"gi":"g"), function() {
var i = 0, j = 1, rule;
while (rule = rules[i++]) {
if (arguments[j]) {
// if no custom replacement defined do the simple replacement
if (!rule.replacement) return "<span class=\"" + rule.className + "\">" + arguments[0] + "</span>";
else {
// replace $0 with the className then do normal replaces
var str = rule.replacement.replace("$0", rule.className);
for (var k = 1; k <= rule.length - 1; k++) str = str.replace("$" + k, arguments[j + k]);
return str;
}
} else j+= rule.length;
}
});
}
function highlightCode(styleSet) {
// clear rules array
var parsed;
rules.length = 0;
// get stylable elements by filtering out all code elements without the correct className
var stylableEls = codeEls.filter(function(item) {return (item.className.indexOf(styleSet.name)>=0)});
// add style rules to parser
for (var className in styleSet.rules) addRule(className, styleSet.rules[className]);
// replace for all elements
for (var i = 0; i < stylableEls.length; i++) {
// EVIL hack to fix IE whitespace badness if it's inside a <pre>
if (/MSIE/.test(navigator.appVersion) && stylableEls[i].parentNode.nodeName == 'PRE') {
stylableEls[i] = stylableEls[i].parentNode;
parsed = stylableEls[i].innerHTML.replace(/(<code[^>]*>)([^<]*)<\/code>/i, function() {
return arguments[1] + parse(arguments[2], styleSet.ignoreCase) + "</code>"
});
parsed = parsed.replace(/\n( *)/g, function() {
var spaces = "";
for (var i = 0; i < arguments[1].length; i++) spaces+= " ";
return "\n" + spaces;
});
parsed = parsed.replace(/\t/g, " ");
parsed = parsed.replace(/\n(<\/\w+>)?/g, "<br />$1").replace(/<br \/>[\n\r\s]*<br \/>/g, "<p><br></p>");
} else parsed = parse(stylableEls[i].innerHTML, styleSet.ignoreCase);
stylableEls[i].innerHTML = parsed;
}
}
// run highlighter on all stylesets
for (var i in this.styleSets) highlightCode(this.styleSets[i]);
}
|
REI-Systems/GovDashboard-Community
|
webapp/sites/all/libraries/fixheadertable/highlighter/codehighlighter.js
|
JavaScript
|
gpl-3.0
| 4,763 |
#include <gtest/gtest.h>
#include <cucumber-cpp/defs.hpp>
#include <Calculator.h>
struct CalcCtx {
Calculator calc;
double result;
};
GIVEN("^I have entered (\\d+) into the calculator$") {
REGEX_PARAM(double, n);
USING_CONTEXT(CalcCtx, context);
context->calc.push(n);
}
WHEN("^I press add") {
USING_CONTEXT(CalcCtx, context);
context->result = context->calc.add();
}
WHEN("^I press divide") {
USING_CONTEXT(CalcCtx, context);
context->result = context->calc.divide();
}
THEN("^the result should be (.*) on the screen$") {
REGEX_PARAM(double, expected);
USING_CONTEXT(CalcCtx, context);
EXPECT_EQ(expected, context->result);
}
|
TomasMM/emir
|
3rd_party/cucumber-cpp/examples/Calc/CalcFeatures/GTestCalculatorSteps.cpp
|
C++
|
gpl-3.0
| 682 |
package work.billing.Export;
import work.billing.Cache.BaseSpreadSheetMatrix;
import work.billing.Cache.MonthlyReportCache;
import work.billing.ProjectSpreadSheet.ProjectSpreadsheetToTrackTimeMapper;
import work.billing.Setting.FileSettingReader;
import work.billing.Setting.FileSettings;
import com.masterhilli.google.spreadsheet.api.connector.Spreadsheet;
import work.billing.Timesheet.TrackedTime;
import work.billing.Timesheet.TrackedTimeAlreadyExistsException;
import work.billing.Timesheet.TrackedTimeSummary;
import java.util.ArrayList;
import java.util.List;
/**
* Created by mhillbrand on 3/6/2016.
*/
public class BillingExporter {
public static void exportProjectDataToSpreadSheet(String worksheetName, String pathToSetting) {
long startTime = System.currentTimeMillis();
FileSettings settings = FileSettingReader.ReadFileSettingsFromFile(pathToSetting);
TrackedTimeSummary trackedTimeSum = getTrackedTimeSummary(worksheetName, settings);
MonthlyReportCache reportCache = initializeReport(settings, trackedTimeSum);
List<Thread> threads = startExportOfInternalCacheToSpreadSheet(worksheetName, settings, reportCache);
waitForExportThreadsToBeFinished(threads);
long stopTime = System.currentTimeMillis();
long elapsedTime = (stopTime - startTime)/1000;
System.out.println("Elapsed time: " + elapsedTime + "s");
}
private static TrackedTimeSummary getTrackedTimeSummary(String worksheetName, FileSettings settings) {
TrackedTimeSummary trackedTimeSum = new TrackedTimeSummary();
for (String key : settings.importFileId.keySet()) {
receiveTrackedTimeForSpreadSheetAndAddToTrackedTimeSum(worksheetName, settings, trackedTimeSum, key);
}
return trackedTimeSum;
}
private static MonthlyReportCache initializeReport(FileSettings settings, TrackedTimeSummary trackedTimeSum) {
MonthlyReportCache reportCache = new MonthlyReportCache(trackedTimeSum,settings.getHourRateAsHashMapPerTeamMember());
reportCache.initializeCache();
return reportCache;
}
private static void waitForExportThreadsToBeFinished(List<Thread> threads) {
boolean threadsStillRunning;
do {
threadsStillRunning = false;
for (Thread t : threads) {
threadsStillRunning = threadsStillRunning || t.isAlive();
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.print(".");
} while (threadsStillRunning);
}
private static List<Thread> startExportOfInternalCacheToSpreadSheet(String worksheetName, FileSettings settings, MonthlyReportCache reportCache) {
Spreadsheet spreadsheet = new Spreadsheet(settings.exportFileId, worksheetName);
List<Thread> threads = new ArrayList<>();
for (BaseSpreadSheetMatrix cachedMatrix : reportCache.getSpreadSheetMatrixList()) {
Thread t = new Thread(new BillingExporterThread(cachedMatrix, spreadsheet, worksheetName));
t.start();
threads.add(t);
}
return threads;
}
private static void receiveTrackedTimeForSpreadSheetAndAddToTrackedTimeSum(String worksheetName, FileSettings settings, TrackedTimeSummary trackedTimeSum, String key) {
Spreadsheet timeSheet = new Spreadsheet(key, worksheetName);
TrackedTime timeTracked = ProjectSpreadsheetToTrackTimeMapper.createTrackedTimeFromSpreadsheet(
timeSheet, worksheetName, settings.getHourRateAsHashMapPerTeamMember());
try {
trackedTimeSum.addTrackedTime(timeTracked);
} catch (TrackedTimeAlreadyExistsException e) {
e.printStackTrace();
}
}
}
|
masterhilli/java-google-drive-api
|
src/main/java/work/billing/Export/BillingExporter.java
|
Java
|
gpl-3.0
| 3,856 |
<?php
/**
* @file plugins/oaiMetadataFormats/dc/OAIMetadataFormatPlugin_DC.inc.php
*
* Copyright (c) 2013-2015 Simon Fraser University Library
* Copyright (c) 2003-2015 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class OAIMetadataFormatPlugin_DC
* @ingroup oai_format
* @see OAI
*
* @brief dc metadata format plugin for OAI.
*/
import('lib.pkp.plugins.oaiMetadataFormats.dc.PKPOAIMetadataFormatPlugin_DC');
class OAIMetadataFormatPlugin_DC extends PKPOAIMetadataFormatPlugin_DC {
/**
* Constructor
*/
function OAIMetadataFormatPlugin_DC() {
parent::PKPOAIMetadataFormatPlugin_DC();
}
}
?>
|
jasonzou/journal.calaijol.org
|
tools/plugins/oaiMetadataFormats/dc/OAIMetadataFormatPlugin_DC.inc.php
|
PHP
|
gpl-3.0
| 668 |
/* phpBB3 Style Sheet
--------------------------------------------------------------
Style name: prosilver (the default phpBB 3.0.x style)
Based on style:
Original author: Tom Beddard ( http://www.subblue.com/ )
Modified by: phpBB Group ( http://www.phpbb.com/ )
--------------------------------------------------------------
*/
/* General Markup Styles
---------------------------------------- */
* {
/* Reset browsers default margin, padding and font sizes */
margin: 0;
padding: 0;
}
html {
font-size: 100%;
/* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-IE browsers */
height: 101%;
}
body {
/* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */
font-family: Verdana, Helvetica, Arial, sans-serif;
color: #828282;
background-color: #FFFFFF;
/*font-size: 62.5%; This sets the default font size to be equivalent to 10px */
font-size: 10px;
margin: 0;
padding: 0;
}
h1 {
/* Forum name */
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
margin-right: 200px;
color: #FFFFFF;
margin-top: 15px;
font-weight: bold;
font-size: 2em;
}
h2 {
/* Forum header titles */
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-weight: normal;
color: #3f3f3f;
font-size: 2em;
margin: 0.8em 0 0.2em 0;
}
h2.solo {
margin-bottom: 1em;
}
h3 {
/* Sub-headers (also used as post headers, but defined later) */
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
text-transform: uppercase;
border-bottom: 1px solid #CCCCCC;
margin-bottom: 3px;
padding-bottom: 2px;
font-size: 1.05em;
color: #989898;
margin-top: 20px;
}
h4 {
/* Forum and topic list titles */
font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Sans-serif;
font-size: 1.3em;
}
p {
line-height: 1.3em;
font-size: 1.1em;
margin-bottom: 1.5em;
}
img {
border-width: 0;
}
hr {
/* Also see tweaks.css */
border: 0 none #FFFFFF;
border-top: 1px solid #CCCCCC;
height: 1px;
margin: 5px 0;
display: block;
clear: both;
}
hr.dashed {
border-top: 1px dashed #CCCCCC;
margin: 10px 0;
}
hr.divider {
display: none;
}
p.right {
text-align: right;
}
/* Main blocks
---------------------------------------- */
#wrap {
padding: 0px;
width:753px;
min-width: 600px;
}
#simple-wrap {
padding: 6px 10px;
}
#page-body {
margin: 4px 0;
clear: both;
}
#page-footer {
clear: both;
}
#page-footer h3 {
margin-top: 20px;
}
#logo {
float: left;
width: auto;
padding: 10px 13px 0 10px;
}
a#logo:hover {
text-decoration: none;
}
/* Search box
--------------------------------------------- */
#search-box {
color: #FFFFFF;
position: relative;
margin-top: 30px;
margin-right: 5px;
display: block;
float: right;
text-align: right;
white-space: nowrap; /* For Opera */
}
#search-box #keywords {
width: 95px;
background-color: #FFF;
}
#search-box input {
border: 1px solid #b0b0b0;
}
/* .button1 style defined later, just a few tweaks for the search button version */
#search-box input.button1 {
padding: 1px 5px;
}
#search-box li {
text-align: right;
margin-top: 4px;
}
#search-box img {
vertical-align: middle;
margin-right: 3px;
}
/* Site description and logo */
#site-description {
float: left;
width: 70%;
}
#site-description h1 {
margin-right: 0;
}
/* Round cornered boxes and backgrounds
---------------------------------------- */
.headerbar {
background: #ebebeb none repeat-x 0 0;
color: #FFFFFF;
margin-bottom: 4px;
padding: 0 5px;
}
.navbar {
background-color: #ebebeb;
padding: 0 10px;
}
.forabg {
background: #b1b1b1 none repeat-x 0 0;
margin-bottom: 4px;
padding: 0 5px;
clear: both;
}
.forumbg {
background: #ebebeb none repeat-x 0 0;
margin-bottom: 4px;
padding: 0 5px;
clear: both;
}
.panel {
margin-bottom: 4px;
padding: 0 10px;
background-color: #f3f3f3;
color: #3f3f3f;
}
.post {
padding: 0 10px;
margin-bottom: 4px;
background-repeat: no-repeat;
background-position: 100% 0;
}
.post:target .content {
color: #000000;
}
.post:target h3 a {
color: #000000;
}
.bg1 { background-color: #f7f7f7;}
.bg2 { background-color: #f2f2f2; }
.bg3 { background-color: #ebebeb; }
.rowbg {
margin: 5px 5px 2px 5px;
}
.ucprowbg {
background-color: #e2e2e2;
}
.fieldsbg {
/*border: 1px #DBDEE2 solid;*/
background-color: #eaeaea;
}
span.corners-top, span.corners-bottom, span.corners-top span, span.corners-bottom span {
font-size: 1px;
line-height: 1px;
display: block;
height: 5px;
background-repeat: no-repeat;
}
span.corners-top {
background-image: none;
background-position: 0 0;
margin: 0 -5px;
}
span.corners-top span {
background-image: none;
background-position: 100% 0;
}
span.corners-bottom {
background-image: none;
background-position: 0 100%;
margin: 0 -5px;
clear: both;
}
span.corners-bottom span {
background-image: none;
background-position: 100% 100%;
}
.headbg span.corners-bottom {
margin-bottom: -1px;
}
.post span.corners-top, .post span.corners-bottom, .panel span.corners-top, .panel span.corners-bottom, .navbar span.corners-top, .navbar span.corners-bottom {
margin: 0 -10px;
}
.rules span.corners-top {
margin: 0 -10px 5px -10px;
}
.rules span.corners-bottom {
margin: 5px -10px 0 -10px;
}
/* Horizontal lists
----------------------------------------*/
ul.linklist {
display: block;
margin: 0;
}
ul.linklist li {
display: block;
list-style-type: none;
float: left;
width: auto;
margin-right: 5px;
font-size: 1.1em;
line-height: 2.2em;
}
ul.linklist li.rightside, p.rightside {
float: right;
margin-right: 0;
margin-left: 5px;
text-align: right;
}
ul.navlinks {
padding-bottom: 1px;
margin-bottom: 1px;
border-bottom: 1px solid #FFFFFF;
font-weight: bold;
}
ul.leftside {
float: left;
margin-left: 0;
margin-right: 5px;
text-align: left;
}
ul.rightside {
float: right;
margin-left: 5px;
margin-right: -5px;
text-align: right;
}
/* Table styles
----------------------------------------*/
table.table1 {
/* See tweaks.css */
}
#ucp-main table.table1 {
padding: 2px;
}
table.table1 thead th {
font-weight: normal;
text-transform: uppercase;
color: #FFFFFF;
line-height: 1.3em;
font-size: 1em;
padding: 0 0 4px 3px;
}
table.table1 thead th span {
padding-left: 7px;
}
table.table1 tbody tr {
border: 1px solid #cfcfcf;
}
table.table1 tbody tr:hover, table.table1 tbody tr.hover {
background-color: #f6f6f6;
color: #000;
}
table.table1 td {
color: #6a6a6a;
font-size: 1.1em;
}
table.table1 tbody td {
padding: 5px;
border-top: 1px solid #FAFAFA;
}
table.table1 tbody th {
padding: 5px;
border-bottom: 1px solid #000000;
text-align: left;
color: #333333;
background-color: #FFFFFF;
}
/* Specific column styles */
table.table1 .name { text-align: left; }
table.table1 .posts { text-align: center !important; width: 7%; }
table.table1 .joined { text-align: left; width: 15%; }
table.table1 .active { text-align: left; width: 15%; }
table.table1 .mark { text-align: center; width: 7%; }
table.table1 .info { text-align: left; width: 30%; }
table.table1 .info div { width: 100%; white-space: normal; overflow: hidden; }
table.table1 .autocol { line-height: 2em; white-space: nowrap; }
table.table1 thead .autocol { padding-left: 1em; }
table.table1 span.rank-img {
float: right;
width: auto;
}
table.info td {
padding: 3px;
}
table.info tbody th {
padding: 3px;
text-align: right;
vertical-align: top;
color: #000000;
font-weight: normal;
}
.forumbg table.table1 {
margin: 0 -2px -1px -1px;
}
/* Misc layout styles
---------------------------------------- */
/* column[1-2] styles are containers for two column layouts
Also see tweaks.css */
.column1 {
float: left;
clear: left;
width: 49%;
}
.column2 {
float: right;
clear: right;
width: 49%;
}
/* General classes for placing floating blocks */
.left-box {
float: left;
width: auto;
text-align: left;
}
.right-box {
float: right;
width: auto;
text-align: right;
}
dl.details {
/*font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;*/
font-size: 1.1em;
}
dl.details dt {
float: left;
clear: left;
width: 30%;
text-align: right;
color: #000000;
display: block;
}
dl.details dd {
margin-left: 0;
padding-left: 5px;
margin-bottom: 5px;
color: #828282;
float: left;
width: 65%;
}
/* Pagination
---------------------------------------- */
.pagination {
height: 1%; /* IE tweak (holly hack) */
width: auto;
text-align: right;
margin-top: 5px;
float: right;
}
.pagination span.page-sep {
display: none;
}
li.pagination {
margin-top: 0;
}
.pagination strong, .pagination b {
font-weight: normal;
}
.pagination span strong {
padding: 0 2px;
margin: 0 2px;
font-weight: normal;
color: #FFFFFF;
background-color: #bfbfbf;
border: 1px solid #bfbfbf;
font-size: 0.9em;
}
.pagination span a, .pagination span a:link, .pagination span a:visited, .pagination span a:active {
font-weight: normal;
text-decoration: none;
color: #747474;
margin: 0 2px;
padding: 0 2px;
background-color: #eeeeee;
border: 1px solid #bababa;
font-size: 0.9em;
line-height: 1.5em;
}
.pagination span a:hover {
border-color: #d2d2d2;
background-color: #d2d2d2;
color: #FFF;
text-decoration: none;
}
.pagination img {
vertical-align: middle;
}
/* Pagination in viewforum for multipage topics */
.row .pagination {
display: block;
float: right;
width: auto;
margin-top: 0;
padding: 1px 0 1px 15px;
font-size: 0.9em;
background: none 0 50% no-repeat;
}
.row .pagination span a, li.pagination span a {
background-color: #FFFFFF;
}
.row .pagination span a:hover, li.pagination span a:hover {
background-color: #d2d2d2;
}
/* Miscellaneous styles
---------------------------------------- */
#forum-permissions {
float: right;
width: auto;
padding-left: 5px;
margin-left: 5px;
margin-top: 10px;
text-align: right;
}
.copyright {
padding: 5px;
text-align: center;
color: #555555;
}
.small {
font-size: 0.9em !important;
}
.titlespace {
margin-bottom: 15px;
}
.headerspace {
margin-top: 20px;
}
.error {
color: #bcbcbc;
font-weight: bold;
font-size: 1em;
}
.reported {
background-color: #f7f7f7;
}
li.reported:hover {
background-color: #ececec;
}
div.rules {
background-color: #ececec;
color: #bcbcbc;
padding: 0 10px;
margin: 10px 0;
font-size: 1.1em;
}
div.rules ul, div.rules ol {
margin-left: 20px;
}
p.rules {
background-color: #ececec;
background-image: none;
padding: 5px;
}
p.rules img {
vertical-align: middle;
padding-top: 5px;
}
p.rules a {
vertical-align: middle;
clear: both;
}
#top {
position: absolute;
top: -20px;
}
.clear {
display: block;
clear: both;
font-size: 1px;
line-height: 1px;
background: transparent;
}
/* Link Styles
---------------------------------------- */
/* Links adjustment to correctly display an order of rtl/ltr mixed content */
a {
direction: ltr;
unicode-bidi: embed;
}
a:link { color: #898989; text-decoration: none; }
a:visited { color: #898989; text-decoration: none; }
a:hover { color: #d3d3d3; text-decoration: underline; }
a:active { color: #d2d2d2; text-decoration: none; }
/* Coloured usernames */
.username-coloured {
font-weight: bold;
display: inline !important;
padding: 0 !important;
}
/* Links on gradient backgrounds */
#search-box a:link, .navbg a:link, .forumbg .header a:link, .forabg .header a:link, th a:link {
color: #FFFFFF;
text-decoration: none;
}
#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited {
color: #FFFFFF;
text-decoration: none;
}
#search-box a:hover, .navbg a:hover, .forumbg .header a:hover, .forabg .header a:hover, th a:hover {
color: #ffffff;
text-decoration: underline;
}
#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active {
color: #ffffff;
text-decoration: none;
}
/* Links for forum/topic lists */
a.forumtitle {
font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif;
font-size: 1.2em;
font-weight: bold;
color: #898989;
text-decoration: none;
}
/* a.forumtitle:visited { color: #898989; } */
a.forumtitle:hover {
color: #bcbcbc;
text-decoration: underline;
}
a.forumtitle:active {
color: #898989;
}
a.topictitle {
font-family: "Trebuchet MS", Helvetica, Arial, Sans-serif;
font-size: 1.2em;
font-weight: bold;
color: #898989;
text-decoration: none;
}
/* a.topictitle:visited { color: #d2d2d2; } */
a.topictitle:hover {
color: #bcbcbc;
text-decoration: underline;
}
a.topictitle:active {
color: #898989;
}
/* Post body links */
.postlink {
text-decoration: none;
color: #d2d2d2;
border-bottom: 1px solid #d2d2d2;
padding-bottom: 0;
}
/* .postlink:visited { color: #bdbdbd; } */
.postlink:active {
color: #d2d2d2;
}
.postlink:hover {
background-color: #f6f6f6;
text-decoration: none;
color: #404040;
}
.signature a, .signature a:visited, .signature a:hover, .signature a:active {
border: none;
text-decoration: underline;
background-color: transparent;
}
/* Profile links */
.postprofile a:link, .postprofile a:visited, .postprofile dt.author a {
font-weight: bold;
color: #898989;
text-decoration: none;
}
.postprofile a:hover, .postprofile dt.author a:hover {
text-decoration: underline;
color: #d3d3d3;
}
/* CSS spec requires a:link, a:visited, a:hover and a:active rules to be specified in this order. */
/* See http://www.phpbb.com/bugs/phpbb3/59685 */
.postprofile a:active {
font-weight: bold;
color: #898989;
text-decoration: none;
}
/* Profile searchresults */
.search .postprofile a {
color: #898989;
text-decoration: none;
font-weight: normal;
}
.search .postprofile a:hover {
color: #d3d3d3;
text-decoration: underline;
}
/* Back to top of page */
.back2top {
clear: both;
height: 11px;
text-align: right;
}
a.top {
background: none no-repeat top left;
text-decoration: none;
width: 11px;
height: 11px;
display: block;
float: right;
overflow: hidden;
letter-spacing: 1000px;
text-indent: 11px;
}
a.top2 {
background: none no-repeat 0 50%;
text-decoration: none;
padding-left: 15px;
}
/* Arrow links */
a.up { background: none no-repeat left center; }
a.down { background: none no-repeat right center; }
a.left { background: none no-repeat 3px 60%; }
a.right { background: none no-repeat 95% 60%; }
a.up, a.up:link, a.up:active, a.up:visited {
padding-left: 10px;
text-decoration: none;
border-bottom-width: 0;
}
a.up:hover {
background-position: left top;
background-color: transparent;
}
a.down, a.down:link, a.down:active, a.down:visited {
padding-right: 10px;
}
a.down:hover {
background-position: right bottom;
text-decoration: none;
}
a.left, a.left:active, a.left:visited {
padding-left: 12px;
}
a.left:hover {
color: #d2d2d2;
text-decoration: none;
background-position: 0 60%;
}
a.right, a.right:active, a.right:visited {
padding-right: 12px;
}
a.right:hover {
color: #d2d2d2;
text-decoration: none;
background-position: 100% 60%;
}
/* invisible skip link, used for accessibility */
.skiplink {
position: absolute;
left: -999px;
width: 990px;
}
/* Feed icon in forumlist_body.html */
a.feed-icon-forum {
float: right;
margin: 3px;
}
/* Content Styles
---------------------------------------- */
ul.topiclist {
display: block;
list-style-type: none;
margin: 0;
}
ul.forums {
background: #f9f9f9 none repeat-x 0 0;
}
ul.topiclist li {
display: block;
list-style-type: none;
color: #777777;
margin: 0;
}
ul.topiclist dl {
position: relative;
}
ul.topiclist li.row dl {
padding: 2px 0;
}
ul.topiclist dt {
display: block;
float: left;
width: 50%;
font-size: 1.1em;
padding-left: 5px;
padding-right: 5px;
}
ul.topiclist dd {
display: block;
float: left;
border-left: 1px solid #FFFFFF;
padding: 4px 0;
}
ul.topiclist dfn {
/* Labels for post/view counts */
position: absolute;
left: -999px;
width: 990px;
}
ul.topiclist li.row dt a.subforum {
background-image: none;
background-position: 0 50%;
background-repeat: no-repeat;
position: relative;
white-space: nowrap;
padding: 0 0 0 12px;
}
.forum-image {
float: left;
padding-top: 5px;
margin-right: 5px;
}
li.row {
border-top: 1px solid #FFFFFF;
border-bottom: 1px solid #8f8f8f;
}
li.row strong {
font-weight: normal;
color: #000000;
}
li.row:hover {
background-color: #f6f6f6;
}
li.row:hover dd {
border-left-color: #CCCCCC;
}
li.header dt, li.header dd {
line-height: 1em;
border-left-width: 0;
margin: 2px 0 4px 0;
color: #FFFFFF;
padding-top: 2px;
padding-bottom: 2px;
font-size: 1em;
font-family: Arial, Helvetica, sans-serif;
text-transform: uppercase;
}
li.header dt {
font-weight: bold;
}
li.header dd {
margin-left: 1px;
}
li.header dl.icon {
min-height: 0;
}
li.header dl.icon dt {
/* Tweak for headers alignment when folder icon used */
padding-left: 0;
padding-right: 50px;
}
/* Forum list column styles */
dl.icon {
min-height: 35px;
background-position: 10px 50%; /* Position of folder icon */
background-repeat: no-repeat;
}
dl.icon dt {
padding-left: 45px; /* Space for folder icon */
background-repeat: no-repeat;
background-position: 5px 95%; /* Position of topic icon */
}
dd.posts, dd.topics, dd.views {
width: 8%;
text-align: center;
line-height: 2.2em;
font-size: 1.2em;
}
/* List in forum description */
dl.icon dt ol,
dl.icon dt ul {
list-style-position: inside;
margin-left: 1em;
}
dl.icon dt li {
display: list-item;
list-style-type: inherit;
}
dd.lastpost {
width: 25%;
font-size: 1.1em;
}
dd.redirect {
font-size: 1.1em;
line-height: 2.5em;
}
dd.moderation {
font-size: 1.1em;
}
dd.lastpost span, ul.topiclist dd.searchby span, ul.topiclist dd.info span, ul.topiclist dd.time span, dd.redirect span, dd.moderation span {
display: block;
padding-left: 5px;
}
dd.time {
width: auto;
line-height: 200%;
font-size: 1.1em;
}
dd.extra {
width: 12%;
line-height: 200%;
text-align: center;
font-size: 1.1em;
}
dd.mark {
float: right !important;
width: 9%;
text-align: center;
line-height: 200%;
font-size: 1.2em;
}
dd.info {
width: 30%;
}
dd.option {
width: 15%;
line-height: 200%;
text-align: center;
font-size: 1.1em;
}
dd.searchby {
width: 47%;
font-size: 1.1em;
line-height: 1em;
}
ul.topiclist dd.searchextra {
margin-left: 5px;
padding: 0.2em 0;
font-size: 1.1em;
color: #333333;
border-left: none;
clear: both;
width: 98%;
overflow: hidden;
}
/* Container for post/reply buttons and pagination */
.topic-actions {
margin-bottom: 3px;
font-size: 1.1em;
height: 28px;
min-height: 28px;
}
div[class].topic-actions {
height: auto;
}
/* Post body styles
----------------------------------------*/
.postbody {
padding: 0;
line-height: 1.48em;
color: #333333;
width: 76%;
float: left;
clear: both;
}
.postbody .ignore {
font-size: 1.1em;
}
.postbody h3.first {
/* The first post on the page uses this */
font-size: 1.7em;
}
.postbody h3 {
/* Postbody requires a different h3 format - so change it here */
font-size: 1.5em;
padding: 2px 0 0 0;
margin: 0 0 0.3em 0 !important;
text-transform: none;
border: none;
font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
line-height: 125%;
}
.postbody h3 img {
/* Also see tweaks.css */
vertical-align: bottom;
}
.postbody .content {
font-size: 1.3em;
}
.search .postbody {
width: 68%
}
/* Topic review panel
----------------------------------------*/
#review {
margin-top: 2em;
}
#topicreview {
padding-right: 5px;
overflow: auto;
height: 300px;
}
#topicreview .postbody {
width: auto;
float: none;
margin: 0;
height: auto;
}
#topicreview .post {
height: auto;
}
#topicreview h2 {
border-bottom-width: 0;
}
.post-ignore .postbody {
display: none;
}
/* MCP Post details
----------------------------------------*/
#post_details
{
/* This will only work in IE7+, plus the others */
overflow: auto;
max-height: 300px;
}
#expand
{
clear: both;
}
/* Content container styles
----------------------------------------*/
.content {
min-height: 3em;
overflow: hidden;
line-height: 1.4em;
font-family: "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
font-size: 1em;
color: #333333;
padding-bottom: 1px;
}
.content h2, .panel h2 {
font-weight: normal;
color: #989898;
border-bottom: 1px solid #CCCCCC;
font-size: 1.6em;
margin-top: 0.5em;
margin-bottom: 0.5em;
padding-bottom: 0.5em;
}
.panel h3 {
margin: 0.5em 0;
}
.panel p {
font-size: 1.2em;
margin-bottom: 1em;
line-height: 1.4em;
}
.content p {
font-family: "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
font-size: 1.2em;
margin-bottom: 1em;
line-height: 1.4em;
}
dl.faq {
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
font-size: 1.1em;
margin-top: 1em;
margin-bottom: 2em;
line-height: 1.4em;
}
dl.faq dt {
font-weight: bold;
color: #333333;
}
.content dl.faq {
font-size: 1.2em;
margin-bottom: 0.5em;
}
.content li {
list-style-type: inherit;
}
.content ul, .content ol {
margin-bottom: 1em;
margin-left: 3em;
}
.posthilit {
background-color: #f3f3f3;
color: #BCBCBC;
padding: 0 2px 1px 2px;
}
.announce, .unreadpost {
/* Highlight the announcements & unread posts box */
border-left-color: #BCBCBC;
border-right-color: #BCBCBC;
}
/* Post author */
p.author {
margin: 0 15em 0.6em 0;
padding: 0 0 5px 0;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 1em;
line-height: 1.2em;
}
/* Post signature */
.signature {
margin-top: 1.5em;
padding-top: 0.2em;
font-size: 1.1em;
border-top: 1px solid #CCCCCC;
clear: left;
line-height: 140%;
overflow: hidden;
width: 100%;
}
dd .signature {
margin: 0;
padding: 0;
clear: none;
border: none;
}
.signature li {
list-style-type: inherit;
}
.signature ul, .signature ol {
margin-bottom: 1em;
margin-left: 3em;
}
/* Post noticies */
.notice {
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
width: auto;
margin-top: 1.5em;
padding-top: 0.2em;
font-size: 1em;
border-top: 1px dashed #CCCCCC;
clear: left;
line-height: 130%;
}
/* Jump to post link for now */
ul.searchresults {
list-style: none;
text-align: right;
clear: both;
}
/* BB Code styles
----------------------------------------*/
/* Quote block */
blockquote {
background: #ebebeb none 6px 8px no-repeat;
border: 1px solid #dbdbdb;
font-size: 0.95em;
margin: 0.5em 1px 0 25px;
overflow: hidden;
padding: 5px;
}
blockquote blockquote {
/* Nested quotes */
background-color: #bababa;
font-size: 1em;
margin: 0.5em 1px 0 15px;
}
blockquote blockquote blockquote {
/* Nested quotes */
background-color: #e4e4e4;
}
blockquote cite {
/* Username/source of quoter */
font-style: normal;
font-weight: bold;
margin-left: 20px;
display: block;
font-size: 0.9em;
}
blockquote cite cite {
font-size: 1em;
}
blockquote.uncited {
padding-top: 25px;
}
/* Code block */
dl.codebox {
padding: 3px;
background-color: #FFFFFF;
border: 1px solid #d8d8d8;
font-size: 1em;
}
dl.codebox dt {
text-transform: uppercase;
border-bottom: 1px solid #CCCCCC;
margin-bottom: 3px;
font-size: 0.8em;
font-weight: bold;
display: block;
}
blockquote dl.codebox {
margin-left: 0;
}
dl.codebox code {
/* Also see tweaks.css */
overflow: auto;
display: block;
height: auto;
max-height: 200px;
white-space: normal;
padding-top: 5px;
font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono;
line-height: 1.3em;
color: #8b8b8b;
margin: 2px 0;
}
.syntaxbg { color: #FFFFFF; }
.syntaxcomment { color: #000000; }
.syntaxdefault { color: #bcbcbc; }
.syntaxhtml { color: #000000; }
.syntaxkeyword { color: #585858; }
.syntaxstring { color: #a7a7a7; }
/* Attachments
----------------------------------------*/
.attachbox {
float: left;
width: auto;
margin: 5px 5px 5px 0;
padding: 6px;
background-color: #FFFFFF;
border: 1px dashed #d8d8d8;
clear: left;
}
.pm-message .attachbox {
background-color: #f3f3f3;
}
.attachbox dt {
font-family: Arial, Helvetica, sans-serif;
text-transform: uppercase;
}
.attachbox dd {
margin-top: 4px;
padding-top: 4px;
clear: left;
border-top: 1px solid #d8d8d8;
}
.attachbox dd dd {
border: none;
}
.attachbox p {
line-height: 110%;
color: #666666;
font-weight: normal;
clear: left;
}
.attachbox p.stats
{
line-height: 110%;
color: #666666;
font-weight: normal;
clear: left;
}
.attach-image {
margin: 3px 0;
width: 100%;
max-height: 350px;
overflow: auto;
}
.attach-image img {
border: 1px solid #999999;
/* cursor: move; */
cursor: default;
}
/* Inline image thumbnails */
div.inline-attachment dl.thumbnail, div.inline-attachment dl.file {
display: block;
margin-bottom: 4px;
}
div.inline-attachment p {
font-size: 100%;
}
dl.file {
font-family: Verdana, Arial, Helvetica, sans-serif;
display: block;
}
dl.file dt {
text-transform: none;
margin: 0;
padding: 0;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
dl.file dd {
color: #666666;
margin: 0;
padding: 0;
}
dl.thumbnail img {
padding: 3px;
border: 1px solid #666666;
background-color: #FFF;
}
dl.thumbnail dd {
color: #666666;
font-style: italic;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.attachbox dl.thumbnail dd {
font-size: 100%;
}
dl.thumbnail dt a:hover {
background-color: #EEEEEE;
}
dl.thumbnail dt a:hover img {
border: 1px solid #d2d2d2;
}
/* Post poll styles
----------------------------------------*/
fieldset.polls {
font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
}
fieldset.polls dl {
margin-top: 5px;
border-top: 1px solid #e2e2e2;
padding: 5px 0 0 0;
line-height: 120%;
color: #666666;
}
fieldset.polls dl.voted {
font-weight: bold;
color: #000000;
}
fieldset.polls dt {
text-align: left;
float: left;
display: block;
width: 30%;
border-right: none;
padding: 0;
margin: 0;
font-size: 1.1em;
}
fieldset.polls dd {
float: left;
width: 10%;
border-left: none;
padding: 0 5px;
margin-left: 0;
font-size: 1.1em;
}
fieldset.polls dd.resultbar {
width: 50%;
}
fieldset.polls dd input {
margin: 2px 0;
}
fieldset.polls dd div {
text-align: right;
font-family: Arial, Helvetica, sans-serif;
color: #FFFFFF;
font-weight: bold;
padding: 0 2px;
overflow: visible;
min-width: 2%;
}
.pollbar1 {
background-color: #aaaaaa;
border-bottom: 1px solid #747474;
border-right: 1px solid #747474;
}
.pollbar2 {
background-color: #bebebe;
border-bottom: 1px solid #8c8c8c;
border-right: 1px solid #8c8c8c;
}
.pollbar3 {
background-color: #D1D1D1;
border-bottom: 1px solid #aaaaaa;
border-right: 1px solid #aaaaaa;
}
.pollbar4 {
background-color: #e4e4e4;
border-bottom: 1px solid #bebebe;
border-right: 1px solid #bebebe;
}
.pollbar5 {
background-color: #f8f8f8;
border-bottom: 1px solid #D1D1D1;
border-right: 1px solid #D1D1D1;
}
/* Poster profile block
----------------------------------------*/
.postprofile {
/* Also see tweaks.css */
margin: 5px 0 10px 0;
min-height: 80px;
color: #666666;
border-left: 1px solid #FFFFFF;
width: 22%;
float: right;
display: inline;
}
.pm .postprofile {
border-left: 1px solid #DDDDDD;
}
.postprofile dd, .postprofile dt {
line-height: 1.2em;
margin-left: 8px;
}
.postprofile strong {
font-weight: normal;
color: #000000;
}
.avatar {
border: none;
margin-bottom: 3px;
}
.online {
background-image: none;
background-position: 100% 0;
background-repeat: no-repeat;
}
/* Poster profile used by search*/
.search .postprofile {
width: 30%;
}
/* pm list in compose message if mass pm is enabled */
dl.pmlist dt {
width: 60% !important;
}
dl.pmlist dt textarea {
width: 95%;
}
dl.pmlist dd {
margin-left: 61% !important;
margin-bottom: 2px;
}
/* Button Styles
---------------------------------------- */
/* Rollover buttons
Based on: http://wellstyled.com/css-nopreload-rollovers.html
----------------------------------------*/
.buttons {
float: left;
width: auto;
height: auto;
}
/* Rollover state */
.buttons div {
float: left;
margin: 0 5px 0 0;
background-position: 0 100%;
}
/* Rolloff state */
.buttons div a {
display: block;
width: 100%;
height: 100%;
background-position: 0 0;
position: relative;
overflow: hidden;
}
/* Hide <a> text and hide off-state image when rolling over (prevents flicker in IE) */
/*.buttons div span { display: none; }*/
/*.buttons div a:hover { background-image: none; }*/
.buttons div span { position: absolute; width: 100%; height: 100%; cursor: pointer;}
.buttons div a:hover span { background-position: 0 100%; }
/* Big button images */
.reply-icon span { background: transparent none 0 0 no-repeat; }
.post-icon span { background: transparent none 0 0 no-repeat; }
.locked-icon span { background: transparent none 0 0 no-repeat; }
.pmreply-icon span { background: none 0 0 no-repeat; }
.newpm-icon span { background: none 0 0 no-repeat; }
.forwardpm-icon span { background: none 0 0 no-repeat; }
/* Set big button dimensions */
.buttons div.reply-icon { width: 96px; height: 25px; }
.buttons div.post-icon { width: 96px; height: 25px; }
.buttons div.locked-icon { width: 88px; height: 25px; }
.buttons div.pmreply-icon { width: 96px; height: 25px; }
.buttons div.newpm-icon { width: 84px; height: 25px; }
.buttons div.forwardpm-icon { width: 96px; height: 25px; }
/* Sub-header (navigation bar)
--------------------------------------------- */
a.print, a.sendemail, a.fontsize {
display: block;
overflow: hidden;
height: 18px;
text-indent: -5000px;
text-align: left;
background-repeat: no-repeat;
}
a.print {
background-image: none;
width: 22px;
}
a.sendemail {
background-image: none;
width: 22px;
}
a.fontsize {
background-image: none;
background-position: 0 -1px;
width: 29px;
}
a.fontsize:hover {
background-position: 0 -20px;
text-decoration: none;
}
/* Icon images
---------------------------------------- */
.sitehome, .icon-faq, .icon-members, .icon-home, .icon-ucp, .icon-register, .icon-logout,
.icon-bookmark, .icon-bump, .icon-subscribe, .icon-unsubscribe, .icon-pages, .icon-search {
background-position: 0 50%;
background-repeat: no-repeat;
background-image: none;
padding: 1px 0 0 17px;
}
/* Poster profile icons
----------------------------------------*/
ul.profile-icons {
padding-top: 10px;
list-style: none;
}
/* Rollover state */
ul.profile-icons li {
float: left;
margin: 0 6px 3px 0;
background-position: 0 100%;
}
/* Rolloff state */
ul.profile-icons li a {
display: block;
width: 100%;
height: 100%;
background-position: 0 0;
}
/* Hide <a> text and hide off-state image when rolling over (prevents flicker in IE) */
ul.profile-icons li span { display:none; }
ul.profile-icons li a:hover { background: none; }
/* Positioning of moderator icons */
.postbody ul.profile-icons {
float: right;
width: auto;
padding: 0;
}
.postbody ul.profile-icons li {
margin: 0 3px;
}
/* Profile & navigation icons */
.email-icon, .email-icon a { background: none top left no-repeat; }
.aim-icon, .aim-icon a { background: none top left no-repeat; }
.yahoo-icon, .yahoo-icon a { background: none top left no-repeat; }
.web-icon, .web-icon a { background: none top left no-repeat; }
.thank-icon, .thank-icon a { background: none top left no-repeat; }
.msnm-icon, .msnm-icon a { background: none top left no-repeat; }
.icq-icon, .icq-icon a { background: none top left no-repeat; }
.jabber-icon, .jabber-icon a { background: none top left no-repeat; }
.pm-icon, .pm-icon a { background: none top left no-repeat; }
.quote-icon, .quote-icon a { background: none top left no-repeat; }
/* Moderator icons */
.report-icon, .report-icon a { background: none top left no-repeat; }
.warn-icon, .warn-icon a { background: none top left no-repeat; }
.edit-icon, .edit-icon a { background: none top left no-repeat; }
.delete-icon, .delete-icon a { background: none top left no-repeat; }
.info-icon, .info-icon a { background: none top left no-repeat; }
/* Set profile icon dimensions */
ul.profile-icons li.email-icon { width: 20px; height: 20px; }
ul.profile-icons li.aim-icon { width: 20px; height: 20px; }
ul.profile-icons li.yahoo-icon { width: 20px; height: 20px; }
ul.profile-icons li.web-icon { width: 20px; height: 20px; }
ul.profile-icons li.thank-icon { width: 20px; height: 20px; }
ul.profile-icons li.msnm-icon { width: 20px; height: 20px; }
ul.profile-icons li.icq-icon { width: 20px; height: 20px; }
ul.profile-icons li.jabber-icon { width: 20px; height: 20px; }
ul.profile-icons li.pm-icon { width: 28px; height: 20px; }
ul.profile-icons li.quote-icon { width: 54px; height: 20px; }
ul.profile-icons li.report-icon { width: 20px; height: 20px; }
ul.profile-icons li.edit-icon { width: 42px; height: 20px; }
ul.profile-icons li.delete-icon { width: 20px; height: 20px; }
ul.profile-icons li.info-icon { width: 20px; height: 20px; }
ul.profile-icons li.warn-icon { width: 20px; height: 20px; }
/* Fix profile icon default margins */
ul.profile-icons li.edit-icon { margin: 0 0 0 3px; }
ul.profile-icons li.quote-icon { margin: 0 0 0 10px; }
ul.profile-icons li.info-icon, ul.profile-icons li.report-icon { margin: 0 3px 0 0; }
/* Control Panel Styles
---------------------------------------- */
/* Main CP box
----------------------------------------*/
#cp-menu {
float:left;
width: 19%;
margin-top: 1em;
margin-bottom: 5px;
}
#cp-main {
float: left;
width: 81%;
}
#cp-main .content {
padding: 0;
}
#cp-main h3, #cp-main hr, #cp-menu hr {
border-color: #bfbfbf;
}
#cp-main .panel p {
font-size: 1.1em;
}
#cp-main .panel ol {
margin-left: 2em;
font-size: 1.1em;
}
#cp-main .panel li.row {
border-bottom: 1px solid #cbcbcb;
border-top: 1px solid #F9F9F9;
}
ul.cplist {
margin-bottom: 5px;
border-top: 1px solid #cbcbcb;
}
#cp-main .panel li.header dd, #cp-main .panel li.header dt {
color: #000000;
margin-bottom: 2px;
}
#cp-main table.table1 {
margin-bottom: 1em;
}
#cp-main table.table1 thead th {
color: #333333;
font-weight: bold;
border-bottom: 1px solid #333333;
padding: 5px;
}
#cp-main table.table1 tbody th {
font-style: italic;
background-color: transparent !important;
border-bottom: none;
}
#cp-main .pagination {
float: right;
width: auto;
padding-top: 1px;
}
#cp-main .postbody p {
font-size: 1.1em;
}
#cp-main .pm-message {
border: 1px solid #e2e2e2;
margin: 10px 0;
background-color: #FFFFFF;
width: auto;
float: none;
}
.pm-message h2 {
padding-bottom: 5px;
}
#cp-main .postbody h3, #cp-main .box2 h3 {
margin-top: 0;
}
#cp-main .buttons {
margin-left: 0;
}
#cp-main ul.linklist {
margin: 0;
}
/* MCP Specific tweaks */
.mcp-main .postbody {
width: 100%;
}
/* CP tabbed menu
----------------------------------------*/
#tabs {
line-height: normal;
margin: 20px 0 -1px 7px;
min-width: 570px;
}
#tabs ul {
margin:0;
padding: 0;
list-style: none;
}
#tabs li {
display: inline;
margin: 0;
padding: 0;
font-size: 1em;
font-weight: bold;
}
#tabs a {
float: left;
background: none no-repeat 0% -35px;
margin: 0 1px 0 0;
padding: 0 0 0 5px;
text-decoration: none;
position: relative;
cursor: pointer;
}
#tabs a span {
float: left;
display: block;
background: none no-repeat 100% -35px;
padding: 6px 10px 6px 5px;
color: #828282;
white-space: nowrap;
}
#tabs a:hover span {
color: #bcbcbc;
}
#tabs .activetab a {
background-position: 0 0;
border-bottom: 1px solid #ebebeb;
}
#tabs .activetab a span {
background-position: 100% 0;
padding-bottom: 7px;
color: #333333;
}
#tabs a:hover {
background-position: 0 -70px;
}
#tabs a:hover span {
background-position:100% -70px;
}
#tabs .activetab a:hover {
background-position: 0 0;
}
#tabs .activetab a:hover span {
color: #000000;
background-position: 100% 0;
}
/* Mini tabbed menu used in MCP
----------------------------------------*/
#minitabs {
line-height: normal;
margin: -20px 7px 0 0;
}
#minitabs ul {
margin:0;
padding: 0;
list-style: none;
}
#minitabs li {
display: block;
float: right;
padding: 0 10px 4px 10px;
font-size: 1em;
font-weight: bold;
background-color: #f2f2f2;
margin-left: 2px;
}
#minitabs a {
}
#minitabs a:hover {
text-decoration: none;
}
#minitabs li.activetab {
background-color: #F9F9F9;
}
#minitabs li.activetab a, #minitabs li.activetab a:hover {
color: #333333;
}
/* UCP navigation menu
----------------------------------------*/
/* Container for sub-navigation list */
#navigation {
width: 100%;
padding-top: 36px;
}
#navigation ul {
list-style:none;
}
/* Default list state */
#navigation li {
margin: 1px 0;
padding: 0;
font-weight: bold;
display: inline;
}
/* Link styles for the sub-section links */
#navigation a {
display: block;
padding: 5px;
margin: 1px 0;
text-decoration: none;
font-weight: bold;
color: #333;
background: #cfcfcf none repeat-y 100% 0;
}
#navigation a:hover {
text-decoration: none;
background-color: #c6c6c6;
color: #bcbcbc;
background-image: none;
}
#navigation #active-subsection a {
display: block;
color: #d3d3d3;
background-color: #F9F9F9;
background-image: none;
}
#navigation #active-subsection a:hover {
color: #d3d3d3;
}
/* Preferences pane layout
----------------------------------------*/
#cp-main h2 {
border-bottom: none;
padding: 0;
margin-left: 10px;
color: #333333;
}
#cp-main .panel {
background-color: #F9F9F9;
}
#cp-main .pm {
background-color: #FFFFFF;
}
#cp-main span.corners-top, #cp-menu span.corners-top {
background-image: none;
}
#cp-main span.corners-top span, #cp-menu span.corners-top span {
background-image: none;
}
#cp-main span.corners-bottom, #cp-menu span.corners-bottom {
background-image: none;
}
#cp-main span.corners-bottom span, #cp-menu span.corners-bottom span {
background-image: none;
}
/* Topicreview */
#cp-main .panel #topicreview span.corners-top, #cp-menu .panel #topicreview span.corners-top {
background-image: none;
}
#cp-main .panel #topicreview span.corners-top span, #cp-menu .panel #topicreview span.corners-top span {
background-image: none;
}
#cp-main .panel #topicreview span.corners-bottom, #cp-menu .panel #topicreview span.corners-bottom {
background-image: none;
}
#cp-main .panel #topicreview span.corners-bottom span, #cp-menu .panel #topicreview span.corners-bottom span {
background-image: none;
}
/* Friends list */
.cp-mini {
background-color: #f9f9f9;
padding: 0 5px;
margin: 10px 15px 10px 5px;
}
.cp-mini span.corners-top, .cp-mini span.corners-bottom {
margin: 0 -5px;
}
dl.mini dt {
font-weight: bold;
color: #676767;
}
dl.mini dd {
padding-top: 4px;
}
.friend-online {
font-weight: bold;
}
.friend-offline {
font-style: italic;
}
/* PM Styles
----------------------------------------*/
#pm-menu {
line-height: 2.5em;
}
/* PM panel adjustments */
.pm-panel-header {
margin: 0;
padding-bottom: 10px;
border-bottom: 1px dashed #A4B3BF;
}
.reply-all {
display: block;
padding-top: 4px;
clear: both;
float: left;
}
.pm-panel-message {
padding-top: 10px;
}
.pm-return-to {
padding-top: 23px;
}
#cp-main .pm-message-nav {
margin: 0;
padding: 2px 10px 5px 10px;
border-bottom: 1px dashed #A4B3BF;
}
/* PM Message history */
.current {
color: #999999;
}
/* Defined rules list for PM options */
ol.def-rules {
padding-left: 0;
}
ol.def-rules li {
line-height: 180%;
padding: 1px;
}
/* PM marking colours */
.pmlist li.bg1 {
padding: 0 3px;
}
.pmlist li.bg2 {
padding: 0 3px;
}
.pmlist li.pm_message_reported_colour, .pm_message_reported_colour {
border-left-color: #bcbcbc;
border-right-color: #bcbcbc;
}
.pmlist li.pm_marked_colour, .pm_marked_colour {
padding: 0;
border: solid 3px #ffffff;
border-width: 0 3px;
}
.pmlist li.pm_replied_colour, .pm_replied_colour {
padding: 0;
border: solid 3px #c2c2c2;
border-width: 0 3px;
}
.pmlist li.pm_friend_colour, .pm_friend_colour {
padding: 0;
border: solid 3px #bdbdbd;
border-width: 0 3px;
}
.pmlist li.pm_foe_colour, .pm_foe_colour {
padding: 0;
border: solid 3px #000000;
border-width: 0 3px;
}
.pm-legend {
border-left-width: 10px;
border-left-style: solid;
border-right-width: 0;
margin-bottom: 3px;
padding-left: 3px;
}
/* Avatar gallery */
#gallery label {
position: relative;
float: left;
margin: 10px;
padding: 5px;
width: auto;
background: #FFFFFF;
border: 1px solid #CCC;
text-align: center;
}
#gallery label:hover {
background-color: #EEE;
}
/* Form Styles
---------------------------------------- */
/* General form styles
----------------------------------------*/
fieldset {
border-width: 0;
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 1.1em;
}
input {
font-weight: normal;
cursor: pointer;
vertical-align: middle;
padding: 0 3px;
font-size: 1em;
font-family: Verdana, Helvetica, Arial, sans-serif;
}
select {
font-family: Verdana, Helvetica, Arial, sans-serif;
font-weight: normal;
cursor: pointer;
vertical-align: middle;
border: 1px solid #666666;
padding: 1px;
background-color: #FAFAFA;
font-size: 1em;
}
option {
padding-right: 1em;
}
option.disabled-option {
color: graytext;
}
textarea {
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
width: 60%;
padding: 2px;
font-size: 1em;
line-height: 1.4em;
}
label {
cursor: default;
padding-right: 5px;
color: #676767;
}
label input {
vertical-align: middle;
}
label img {
vertical-align: middle;
}
/* Definition list layout for forms
---------------------------------------- */
fieldset dl {
padding: 4px 0;
}
fieldset dt {
float: left;
width: 40%;
text-align: left;
display: block;
}
fieldset dd {
margin-left: 41%;
vertical-align: top;
margin-bottom: 3px;
}
/* Specific layout 1 */
fieldset.fields1 dt {
width: 15em;
border-right-width: 0;
}
fieldset.fields1 dd {
margin-left: 15em;
border-left-width: 0;
}
fieldset.fields1 {
background-color: transparent;
}
fieldset.fields1 div {
margin-bottom: 3px;
}
/* Set it back to 0px for the reCaptcha divs: PHPBB3-9587 */
fieldset.fields1 #recaptcha_widget_div div {
margin-bottom: 0;
}
/* Specific layout 2 */
fieldset.fields2 dt {
width: 15em;
border-right-width: 0;
}
fieldset.fields2 dd {
margin-left: 16em;
border-left-width: 0;
}
/* Form elements */
dt label {
font-weight: bold;
text-align: left;
}
dd label {
white-space: nowrap;
color: #333;
}
dd input, dd textarea {
margin-right: 3px;
}
dd select {
width: auto;
}
dd textarea {
width: 85%;
}
/* Hover effects */
fieldset dl:hover dt label {
color: #000000;
}
fieldset.fields2 dl:hover dt label {
color: inherit;
}
#timezone {
width: 95%;
}
* html #timezone {
width: 50%;
}
/* Quick-login on index page */
fieldset.quick-login {
margin-top: 5px;
}
fieldset.quick-login input {
width: auto;
}
fieldset.quick-login input.inputbox {
width: 15%;
vertical-align: middle;
margin-right: 5px;
background-color: #f3f3f3;
}
fieldset.quick-login label {
white-space: nowrap;
padding-right: 2px;
}
/* Display options on viewtopic/viewforum pages */
fieldset.display-options {
text-align: center;
margin: 3px 0 5px 0;
}
fieldset.display-options label {
white-space: nowrap;
padding-right: 2px;
}
fieldset.display-options a {
margin-top: 3px;
}
/* Display actions for ucp and mcp pages */
fieldset.display-actions {
text-align: right;
line-height: 2em;
white-space: nowrap;
padding-right: 1em;
}
fieldset.display-actions label {
white-space: nowrap;
padding-right: 2px;
}
fieldset.sort-options {
line-height: 2em;
}
/* MCP forum selection*/
fieldset.forum-selection {
margin: 5px 0 3px 0;
float: right;
}
fieldset.forum-selection2 {
margin: 13px 0 3px 0;
float: right;
}
/* Jumpbox */
fieldset.jumpbox {
text-align: right;
margin-top: 15px;
height: 2.5em;
}
fieldset.quickmod {
width: 50%;
float: right;
text-align: right;
height: 2.5em;
}
/* Submit button fieldset */
fieldset.submit-buttons {
text-align: center;
vertical-align: middle;
margin: 5px 0;
}
fieldset.submit-buttons input {
vertical-align: middle;
padding-top: 3px;
padding-bottom: 3px;
}
/* Posting page styles
----------------------------------------*/
/* Buttons used in the editor */
#format-buttons {
margin: 15px 0 2px 0;
}
#format-buttons input, #format-buttons select {
vertical-align: middle;
}
/* Main message box */
#message-box {
width: 80%;
}
#message-box textarea {
font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
width: 450px;
height: 270px;
min-width: 100%;
max-width: 100%;
font-size: 1.2em;
color: #333333;
}
/* Emoticons panel */
#smiley-box {
width: 18%;
float: right;
}
#smiley-box img {
margin: 3px;
}
/* Input field styles
---------------------------------------- */
.inputbox {
background-color: #FFFFFF;
border: 1px solid #c0c0c0;
color: #333333;
padding: 2px;
cursor: text;
}
.inputbox:hover {
border: 1px solid #eaeaea;
}
.inputbox:focus {
border: 1px solid #eaeaea;
color: #4b4b4b;
}
input.inputbox { width: 85%; }
input.medium { width: 50%; }
input.narrow { width: 25%; }
input.tiny { width: 125px; }
textarea.inputbox {
width: 85%;
}
.autowidth {
width: auto !important;
}
/* Form button styles
---------------------------------------- */
input.button1, input.button2 {
font-size: 1em;
}
a.button1, input.button1, input.button3, a.button2, input.button2 {
width: auto !important;
padding-top: 1px;
padding-bottom: 1px;
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
color: #000;
background: #FAFAFA none repeat-x top left;
}
a.button1, input.button1 {
font-weight: bold;
border: 1px solid #666666;
}
input.button3 {
padding: 0;
margin: 0;
line-height: 5px;
height: 12px;
background-image: none;
font-variant: small-caps;
}
/* Alternative button */
a.button2, input.button2, input.button3 {
border: 1px solid #666666;
}
/* <a> button in the style of the form buttons */
a.button1, a.button1:link, a.button1:visited, a.button1:active, a.button2, a.button2:link, a.button2:visited, a.button2:active {
text-decoration: none;
color: #000000;
padding: 2px 8px;
line-height: 250%;
vertical-align: text-bottom;
background-position: 0 1px;
}
/* Hover states */
a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover {
border: 1px solid #BCBCBC;
background-position: 0 100%;
color: #BCBCBC;
}
input.disabled {
font-weight: normal;
color: #666666;
}
/* Topic and forum Search */
.search-box {
margin-top: 3px;
margin-left: 5px;
float: left;
}
.search-box input {
}
input.search {
background-image: none;
background-repeat: no-repeat;
background-position: left 1px;
padding-left: 17px;
}
.full { width: 95%; }
.medium { width: 50%;}
.narrow { width: 25%;}
.tiny { width: 10%;}
/* Style Sheet Tweaks
These style definitions are mainly IE specific
tweaks required due to its poor CSS support.
-------------------------------------------------*/
* html table, * html select, * html input { font-size: 100%; }
* html hr { margin: 0; }
* html span.corners-top, * html span.corners-bottom { background-image: url("./styles/prosilver/theme/images/corners_left.gif"); }
* html span.corners-top span, * html span.corners-bottom span { background-image: url("./styles/prosilver/theme/images/corners_right.gif"); }
table.table1 {
width: 99%; /* IE < 6 browsers */
/* Tantek hack */
voice-family: "\"}\"";
voice-family: inherit;
width: 100%;
}
html>body table.table1 { width: 100%; } /* Reset 100% for opera */
* html ul.topiclist li { position: relative; }
* html .postbody h3 img { vertical-align: middle; }
/* Form styles */
html>body dd label input { vertical-align: text-bottom; } /* Align checkboxes/radio buttons nicely */
* html input.button1, * html input.button2 {
padding-bottom: 0;
margin-bottom: 1px;
}
/* Misc layout styles */
* html .column1, * html .column2 { width: 45%; }
/* Nice method for clearing floated blocks without having to insert any extra markup (like spacer above)
From http://www.positioniseverything.net/easyclearing.html
#tabs:after, #minitabs:after, .post:after, .navbar:after, fieldset dl:after, ul.topiclist dl:after, ul.linklist:after, dl.polls:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}*/
.clearfix, #tabs, #minitabs, fieldset dl, ul.topiclist dl, dl.polls {
height: 1%;
overflow: hidden;
}
/* viewtopic fix */
* html .post {
height: 25%;
overflow: hidden;
}
/* navbar fix */
* html .clearfix, * html .navbar, ul.linklist {
height: 4%;
overflow: hidden;
}
/* Simple fix so forum and topic lists always have a min-height set, even in IE6
From http://www.dustindiaz.com/min-height-fast-hack */
dl.icon {
min-height: 35px;
height: auto !important;
height: 35px;
}
* html li.row dl.icon dt {
height: 35px;
overflow: visible;
}
* html #search-box {
width: 25%;
}
/* Correctly clear floating for details on profile view */
*:first-child+html dl.details dd {
margin-left: 30%;
float: none;
}
* html dl.details dd {
margin-left: 30%;
float: none;
}
* html .forumbg table.table1 {
margin: 0 -2px 0px -1px;
}
/* Headerbar height fix for IE7 and below */
* html #site-description p {
margin-bottom: 1.0em;
}
*:first-child+html #site-description p {
margin-bottom: 1.0em;
}
/*
--------------------------------------------------------------
Colours and backgrounds for common.css
-------------------------------------------------------------- */
html, body {
color: #536482;
}
h1 {
color: #FFFFFF;
}
h2 {
color: #28313F;
}
h3 {
border-bottom-color: #CCCCCC;
color: #115098;
}
hr {
border-color: #FFFFFF;
border-top-color: #CCCCCC;
}
hr.dashed {
border-top-color: #CCCCCC;
}
/* Search box
--------------------------------------------- */
#search-box {
color: #FFFFFF;
}
#search-box #keywords {
background-color: #FFF;
}
#search-box input {
border-color: #0075B0;
}
/* Round cornered boxes and backgrounds
---------------------------------------- */
.headerbar {
background-color: #12A3EB;
background-image: url("./styles/prosilver/theme/images/bg_header.gif");
color: #FFFFFF;
}
.navbar {
background-color: #cadceb;
}
.forabg {
background-color: #bbcde0;
background-image: url("./styles/prosilver/theme/images/bg_list.gif");
}
.forumbg {
background-color: #abbfd4;
background-image: url("./styles/prosilver/theme/images/bg_header.gif");
}
.panel {
background-color: #ECF1F3;
color: #28313F;
}
.post:target .content {
color: #000000;
}
.post:target h3 a {
color: #000000;
}
.bg1 { background-color: #ECF3F7; }
.bg2 { background-color: #e1ebf2; }
.bg3 { background-color: #cadceb; }
.ucprowbg {
background-color: #DCDEE2;
}
.fieldsbg {
background-color: #E7E8EA;
}
span.corners-top {
background-image: url("./styles/prosilver/theme/images/corners_left.png");
}
span.corners-top span {
background-image: url("./styles/prosilver/theme/images/corners_right.png");
}
span.corners-bottom {
background-image: url("./styles/prosilver/theme/images/corners_left.png");
}
span.corners-bottom span {
background-image: url("./styles/prosilver/theme/images/corners_right.png");
}
/* Horizontal lists
----------------------------------------*/
ul.navlinks {
border-bottom-color: #FFFFFF;
}
/* Table styles
----------------------------------------*/
table.table1 thead th {
color: #FFFFFF;
}
table.table1 tbody tr {
border-color: #BFC1CF;
}
table.table1 tbody tr:hover, table.table1 tbody tr.hover {
background-color: #CFE1F6;
color: #000;
}
table.table1 td {
color: #536482;
}
table.table1 tbody td {
border-top-color: #FAFAFA;
}
table.table1 tbody th {
border-bottom-color: #000000;
color: #333333;
background-color: #FFFFFF;
}
table.info tbody th {
color: #000000;
}
/* Misc layout styles
---------------------------------------- */
dl.details dt {
color: #000000;
}
dl.details dd {
color: #536482;
}
.sep {
color: #1198D9;
}
/* Pagination
---------------------------------------- */
.pagination span strong {
color: #FFFFFF;
background-color: #4692BF;
border-color: #4692BF;
}
.pagination span a, .pagination span a:link, .pagination span a:visited {
color: #5C758C;
background-color: #ECEDEE;
border-color: #B4BAC0;
}
.pagination span a:hover {
border-color: #368AD2;
background-color: #368AD2;
color: #FFF;
}
.pagination span a:active {
color: #5C758C;
background-color: #ECEDEE;
border-color: #B4BAC0;
}
/* Pagination in viewforum for multipage topics */
.row .pagination {
background-image: url("./styles/prosilver/theme/images/icon_pages.gif");
}
.row .pagination span a, li.pagination span a {
background-color: #FFFFFF;
}
.row .pagination span a:hover, li.pagination span a:hover {
background-color: #368AD2;
}
/* Miscellaneous styles
---------------------------------------- */
.copyright {
color: #555555;
}
.error {
color: #BC2A4D;
}
.reported {
background-color: #F7ECEF;
}
li.reported:hover {
background-color: #ECD5D8 !important;
}
.sticky, .announce {
/* you can add a background for stickies and announcements*/
}
div.rules {
background-color: #ECD5D8;
color: #BC2A4D;
}
p.rules {
background-color: #ECD5D8;
background-image: none;
}
/*
--------------------------------------------------------------
Colours and backgrounds for links.css
-------------------------------------------------------------- */
a:link { color: #105289; }
a:visited { color: #105289; }
a:hover { color: #D31141; }
a:active { color: #368AD2; }
/* Links on gradient backgrounds */
#search-box a:link, .navbg a:link, .forumbg .header a:link, .forabg .header a:link, th a:link {
color: #FFFFFF;
}
#search-box a:visited, .navbg a:visited, .forumbg .header a:visited, .forabg .header a:visited, th a:visited {
color: #FFFFFF;
}
#search-box a:hover, .navbg a:hover, .forumbg .header a:hover, .forabg .header a:hover, th a:hover {
color: #A8D8FF;
}
#search-box a:active, .navbg a:active, .forumbg .header a:active, .forabg .header a:active, th a:active {
color: #C8E6FF;
}
/* Links for forum/topic lists */
a.forumtitle {
color: #105289;
}
/* a.forumtitle:visited { color: #105289; } */
a.forumtitle:hover {
color: #BC2A4D;
}
a.forumtitle:active {
color: #105289;
}
a.topictitle {
color: #105289;
}
/* a.topictitle:visited { color: #368AD2; } */
a.topictitle:hover {
color: #BC2A4D;
}
a.topictitle:active {
color: #105289;
}
/* Post body links */
.postlink {
color: #368AD2;
border-bottom-color: #368AD2;
}
.postlink:visited {
color: #5D8FBD;
border-bottom-color: #5D8FBD;
}
.postlink:active {
color: #368AD2;
}
.postlink:hover {
background-color: #D0E4F6;
color: #0D4473;
}
.signature a, .signature a:visited, .signature a:hover, .signature a:active {
background-color: transparent;
}
/* Profile links */
.postprofile a:link, .postprofile a:visited, .postprofile dt.author a {
color: #105289;
}
.postprofile a:hover, .postprofile dt.author a:hover {
color: #D31141;
}
.postprofile a:active {
color: #105289;
}
/* Profile searchresults */
.search .postprofile a {
color: #105289;
}
.search .postprofile a:hover {
color: #D31141;
}
/* Back to top of page */
a.top {
background-image: url("./styles/prosilver/imageset/icon_back_top.gif");
}
a.top2 {
background-image: url("./styles/prosilver/imageset/icon_back_top.gif");
}
/* Arrow links */
a.up { background-image: url("./styles/prosilver/theme/images/arrow_up.gif") }
a.down { background-image: url("./styles/prosilver/theme/images/arrow_down.gif") }
a.left { background-image: url("./styles/prosilver/theme/images/arrow_left.gif") }
a.right { background-image: url("./styles/prosilver/theme/images/arrow_right.gif") }
a.up:hover {
background-color: transparent;
}
a.left:hover {
color: #368AD2;
}
a.right:hover {
color: #368AD2;
}
/*
--------------------------------------------------------------
Colours and backgrounds for content.css
-------------------------------------------------------------- */
ul.forums {
background-color: #eef5f9;
background-image: url("./styles/prosilver/theme/images/gradient.gif");
}
ul.topiclist li {
color: #4C5D77;
}
ul.topiclist dd {
border-left-color: #FFFFFF;
}
.rtl ul.topiclist dd {
border-right-color: #fff;
border-left-color: transparent;
}
ul.topiclist li.row dt a.subforum.read {
background-image: url("./styles/prosilver/imageset/subforum_read.gif");
}
ul.topiclist li.row dt a.subforum.unread {
background-image: url("./styles/prosilver/imageset/subforum_unread.gif");
}
li.row {
border-top-color: #FFFFFF;
border-bottom-color: #00608F;
}
li.row strong {
color: #000000;
}
li.row:hover {
background-color: #F6F4D0;
}
li.row:hover dd {
border-left-color: #CCCCCC;
}
.rtl li.row:hover dd {
border-right-color: #CCCCCC;
border-left-color: transparent;
}
li.header dt, li.header dd {
color: #FFFFFF;
}
/* Forum list column styles */
ul.topiclist dd.searchextra {
color: #333333;
}
/* Post body styles
----------------------------------------*/
.postbody {
color: #333333;
}
/* Content container styles
----------------------------------------*/
.content {
color: #333333;
}
.content h2, .panel h2 {
color: #115098;
border-bottom-color: #CCCCCC;
}
dl.faq dt {
color: #333333;
}
.posthilit {
background-color: #F3BFCC;
color: #BC2A4D;
}
/* Post signature */
.signature {
border-top-color: #CCCCCC;
}
/* Post noticies */
.notice {
border-top-color: #CCCCCC;
}
/* BB Code styles
----------------------------------------*/
/* Quote block */
blockquote {
background-color: #EBEADD;
background-image: url("./styles/prosilver/theme/images/quote.gif");
border-color:#DBDBCE;
}
.rtl blockquote {
background-image: url("./styles/prosilver/theme/images/quote_rtl.gif");
}
blockquote blockquote {
/* Nested quotes */
background-color:#EFEED9;
}
blockquote blockquote blockquote {
/* Nested quotes */
background-color: #EBEADD;
}
/* Code block */
dl.codebox {
background-color: #FFFFFF;
border-color: #C9D2D8;
}
dl.codebox dt {
border-bottom-color: #CCCCCC;
}
dl.codebox code {
color: #2E8B57;
}
.syntaxbg { color: #FFFFFF; }
.syntaxcomment { color: #FF8000; }
.syntaxdefault { color: #0000BB; }
.syntaxhtml { color: #000000; }
.syntaxkeyword { color: #007700; }
.syntaxstring { color: #DD0000; }
/* Attachments
----------------------------------------*/
.attachbox {
background-color: #FFFFFF;
border-color: #C9D2D8;
}
.pm-message .attachbox {
background-color: #F2F3F3;
}
.attachbox dd {
border-top-color: #C9D2D8;
}
.attachbox p {
color: #666666;
}
.attachbox p.stats {
color: #666666;
}
.attach-image img {
border-color: #999999;
}
/* Inline image thumbnails */
dl.file dd {
color: #666666;
}
dl.thumbnail img {
border-color: #666666;
background-color: #FFFFFF;
}
dl.thumbnail dd {
color: #666666;
}
dl.thumbnail dt a:hover {
background-color: #EEEEEE;
}
dl.thumbnail dt a:hover img {
border-color: #368AD2;
}
/* Post poll styles
----------------------------------------*/
fieldset.polls dl {
border-top-color: #DCDEE2;
color: #666666;
}
fieldset.polls dl.voted {
color: #000000;
}
fieldset.polls dd div {
color: #FFFFFF;
}
.rtl .pollbar1, .rtl .pollbar2, .rtl .pollbar3, .rtl .pollbar4, .rtl .pollbar5 {
border-right-color: transparent;
}
.pollbar1 {
background-color: #AA2346;
border-bottom-color: #74162C;
border-right-color: #74162C;
}
.rtl .pollbar1 {
border-left-color: #74162C;
}
.pollbar2 {
background-color: #BE1E4A;
border-bottom-color: #8C1C38;
border-right-color: #8C1C38;
}
.rtl .pollbar2 {
border-left-color: #8C1C38;
}
.pollbar3 {
background-color: #D11A4E;
border-bottom-color: #AA2346;
border-right-color: #AA2346;
}
.rtl .pollbar3 {
border-left-color: #AA2346;
}
.pollbar4 {
background-color: #E41653;
border-bottom-color: #BE1E4A;
border-right-color: #BE1E4A;
}
.rtl .pollbar4 {
border-left-color: #BE1E4A;
}
.pollbar5 {
background-color: #F81157;
border-bottom-color: #D11A4E;
border-right-color: #D11A4E;
}
.rtl .pollbar5 {
border-left-color: #D11A4E;
}
/* Poster profile block
----------------------------------------*/
.postprofile {
color: #666666;
border-left-color: #FFFFFF;
}
.rtl .postprofile {
border-right-color: #FFFFFF;
border-left-color: transparent;
}
.pm .postprofile {
border-left-color: #DDDDDD;
}
.rtl .pm .postprofile {
border-right-color: #DDDDDD;
border-left-color: transparent;
}
.postprofile strong {
color: #000000;
}
.online {
background-image: url("./styles/prosilver/imageset/en/icon_user_online.gif");
}
/*
--------------------------------------------------------------
Colours and backgrounds for buttons.css
-------------------------------------------------------------- */
/* Big button images */
.reply-icon span { background-image: url("./styles/prosilver/imageset/en/button_topic_reply.gif"); }
.post-icon span { background-image: url("./styles/prosilver/imageset/en/button_topic_new.gif"); }
.locked-icon span { background-image: url("./styles/prosilver/imageset/en/button_topic_locked.gif"); }
.pmreply-icon span { background-image: url("./styles/prosilver/imageset/en/button_pm_reply.gif") ;}
.newpm-icon span { background-image: url("./styles/prosilver/imageset/en/button_pm_new.gif") ;}
.forwardpm-icon span { background-image: url("./styles/prosilver/imageset/en/button_pm_forward.gif") ;}
a.print {
background-image: url("./styles/prosilver/theme/images/icon_print.gif");
}
a.sendemail {
background-image: url("./styles/prosilver/theme/images/icon_sendemail.gif");
}
a.fontsize {
background-image: url("./styles/prosilver/theme/images/icon_fontsize.gif");
}
/* Icon images
---------------------------------------- */
.sitehome { background-image: url("./styles/prosilver/theme/images/icon_home.gif"); }
.icon-faq { background-image: url("./styles/prosilver/theme/images/icon_faq.gif"); }
.icon-members { background-image: url("./styles/prosilver/theme/images/icon_members.gif"); }
.icon-home { background-image: url("./styles/prosilver/theme/images/icon_home.gif"); }
.icon-ucp { background-image: url("./styles/prosilver/theme/images/icon_ucp.gif"); }
.icon-register { background-image: url("./styles/prosilver/theme/images/icon_register.gif"); }
.icon-logout { background-image: url("./styles/prosilver/theme/images/icon_logout.gif"); }
.icon-bookmark { background-image: url("./styles/prosilver/theme/images/icon_bookmark.gif"); }
.icon-bump { background-image: url("./styles/prosilver/theme/images/icon_bump.gif"); }
.icon-subscribe { background-image: url("./styles/prosilver/theme/images/icon_subscribe.gif"); }
.icon-unsubscribe { background-image: url("./styles/prosilver/theme/images/icon_unsubscribe.gif"); }
.icon-pages { background-image: url("./styles/prosilver/theme/images/icon_pages.gif"); }
.icon-search { background-image: url("./styles/prosilver/theme/images/icon_search.gif"); }
/* Profile & navigation icons */
.email-icon, .email-icon a { background-image: url("./styles/prosilver/imageset/icon_contact_email.gif"); }
.aim-icon, .aim-icon a { background-image: url("./styles/prosilver/imageset/icon_contact_aim.gif"); }
.yahoo-icon, .yahoo-icon a { background-image: url("./styles/prosilver/imageset/icon_contact_yahoo.gif"); }
.web-icon, .web-icon a { background-image: url("./styles/prosilver/imageset/icon_contact_www.gif"); }
.msnm-icon, .msnm-icon a { background-image: url("./styles/prosilver/imageset/icon_contact_msnm.gif"); }
.icq-icon, .icq-icon a { background-image: url("./styles/prosilver/imageset/icon_contact_icq.gif"); }
.jabber-icon, .jabber-icon a { background-image: url("./styles/prosilver/imageset/icon_contact_jabber.gif"); }
.pm-icon, .pm-icon a { background-image: url("./styles/prosilver/imageset/en/icon_contact_pm.gif"); }
.quote-icon, .quote-icon a { background-image: url("./styles/prosilver/imageset/en/icon_post_quote.gif"); }
/* Moderator icons */
.report-icon, .report-icon a { background-image: url("./styles/prosilver/imageset/icon_post_report.gif"); }
.edit-icon, .edit-icon a { background-image: url("./styles/prosilver/imageset/en/icon_post_edit.gif"); }
.delete-icon, .delete-icon a { background-image: url("./styles/prosilver/imageset/icon_post_delete.gif"); }
.info-icon, .info-icon a { background-image: url("./styles/prosilver/imageset/icon_post_info.gif"); }
.warn-icon, .warn-icon a { background-image: url("./styles/prosilver/imageset/icon_user_warn.gif"); } /* Need updated warn icon */
/*
--------------------------------------------------------------
Colours and backgrounds for cp.css
-------------------------------------------------------------- */
/* Main CP box
----------------------------------------*/
#cp-main h3, #cp-main hr, #cp-menu hr {
border-color: #A4B3BF;
}
#cp-main .panel li.row {
border-bottom-color: #B5C1CB;
border-top-color: #F9F9F9;
}
ul.cplist {
border-top-color: #B5C1CB;
}
#cp-main .panel li.header dd, #cp-main .panel li.header dt {
color: #000000;
}
#cp-main table.table1 thead th {
color: #333333;
border-bottom-color: #333333;
}
#cp-main .pm-message {
border-color: #DBDEE2;
background-color: #FFFFFF;
}
/* CP tabbed menu
----------------------------------------*/
#tabs a {
background-image: url("./styles/prosilver/theme/images/bg_tabs1.gif");
}
#tabs a span {
background-image: url("./styles/prosilver/theme/images/bg_tabs2.gif");
color: #536482;
}
#tabs a:hover span {
color: #BC2A4D;
}
#tabs .activetab a {
border-bottom-color: #CADCEB;
}
#tabs .activetab a span {
color: #333333;
}
#tabs .activetab a:hover span {
color: #000000;
}
/* Mini tabbed menu used in MCP
----------------------------------------*/
#minitabs li {
background-color: #E1EBF2;
}
#minitabs li.activetab {
background-color: #F9F9F9;
}
#minitabs li.activetab a, #minitabs li.activetab a:hover {
color: #333333;
}
/* UCP navigation menu
----------------------------------------*/
/* Link styles for the sub-section links */
#navigation a {
color: #333;
background-color: #B2C2CF;
background-image: url("./styles/prosilver/theme/images/bg_menu.gif");
}
.rtl #navigation a {
background-image: url("./styles/prosilver/theme/images/bg_menu_rtl.gif");
background-position: 0 100%;
}
#navigation a:hover {
background-image: none;
background-color: #aabac6;
color: #BC2A4D;
}
#navigation #active-subsection a {
color: #D31141;
background-color: #F9F9F9;
background-image: none;
}
#navigation #active-subsection a:hover {
color: #D31141;
}
/* Preferences pane layout
----------------------------------------*/
#cp-main h2 {
color: #333333;
}
#cp-main .panel {
background-color: #F9F9F9;
}
#cp-main .pm {
background-color: #FFFFFF;
}
#cp-main span.corners-top, #cp-menu span.corners-top {
background-image: url("./styles/prosilver/theme/images/corners_left2.gif");
}
#cp-main span.corners-top span, #cp-menu span.corners-top span {
background-image: url("./styles/prosilver/theme/images/corners_right2.gif");
}
#cp-main span.corners-bottom, #cp-menu span.corners-bottom {
background-image: url("./styles/prosilver/theme/images/corners_left2.gif");
}
#cp-main span.corners-bottom span, #cp-menu span.corners-bottom span {
background-image: url("./styles/prosilver/theme/images/corners_right2.gif");
}
/* Topicreview */
#cp-main .panel #topicreview span.corners-top, #cp-menu .panel #topicreview span.corners-top {
background-image: url("./styles/prosilver/theme/images/corners_left.gif");
}
#cp-main .panel #topicreview span.corners-top span, #cp-menu .panel #topicreview span.corners-top span {
background-image: url("./styles/prosilver/theme/images/corners_right.gif");
}
#cp-main .panel #topicreview span.corners-bottom, #cp-menu .panel #topicreview span.corners-bottom {
background-image: url("./styles/prosilver/theme/images/corners_left.gif");
}
#cp-main .panel #topicreview span.corners-bottom span, #cp-menu .panel #topicreview span.corners-bottom span {
background-image: url("./styles/prosilver/theme/images/corners_right.gif");
}
/* Friends list */
.cp-mini {
background-color: #eef5f9;
}
dl.mini dt {
color: #425067;
}
/* PM Styles
----------------------------------------*/
/* PM Message history */
.current {
color: #000000 !important;
}
/* PM panel adjustments */
.pm-panel-header,
#cp-main .pm-message-nav {
border-bottom-color: #A4B3BF;
}
/* PM marking colours */
.pmlist li.pm_message_reported_colour, .pm_message_reported_colour {
border-left-color: #BC2A4D;
border-right-color: #BC2A4D;
}
.pmlist li.pm_marked_colour, .pm_marked_colour {
border-color: #FF6600;
}
.pmlist li.pm_replied_colour, .pm_replied_colour {
border-color: #A9B8C2;
}
.pmlist li.pm_friend_colour, .pm_friend_colour {
border-color: #5D8FBD;
}
.pmlist li.pm_foe_colour, .pm_foe_colour {
border-color: #000000;
}
/* Avatar gallery */
#gallery label {
background-color: #FFFFFF;
border-color: #CCC;
}
#gallery label:hover {
background-color: #EEE;
}
/*
--------------------------------------------------------------
Colours and backgrounds for forms.css
-------------------------------------------------------------- */
/* General form styles
----------------------------------------*/
select {
border-color: #666666;
background-color: #FAFAFA;
color: #000;
}
label {
color: #425067;
}
option.disabled-option {
color: graytext;
}
/* Definition list layout for forms
---------------------------------------- */
dd label {
color: #333;
}
/* Hover effects */
fieldset dl:hover dt label {
color: #000000;
}
fieldset.fields2 dl:hover dt label {
color: inherit;
}
/* Quick-login on index page */
fieldset.quick-login input.inputbox {
background-color: #F2F3F3;
}
/* Posting page styles
----------------------------------------*/
#message-box textarea {
color: #333333;
}
/* Input field styles
---------------------------------------- */
.inputbox {
background-color: #FFFFFF;
border-color: #B4BAC0;
color: #333333;
}
.inputbox:hover {
border-color: #11A3EA;
}
.inputbox:focus {
border-color: #11A3EA;
color: #0F4987;
}
/* Form button styles
---------------------------------------- */
a.button1, input.button1, input.button3, a.button2, input.button2 {
color: #000;
background-color: #FAFAFA;
background-image: url("./styles/prosilver/theme/images/bg_button.gif");
}
a.button1, input.button1 {
border-color: #666666;
}
input.button3 {
background-image: none;
}
/* Alternative button */
a.button2, input.button2, input.button3 {
border-color: #666666;
}
/* <a> button in the style of the form buttons */
a.button1, a.button1:link, a.button1:visited, a.button1:active, a.button2, a.button2:link, a.button2:visited, a.button2:active {
color: #000000;
}
/* Hover states */
a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover {
border-color: #BC2A4D;
color: #BC2A4D;
}
input.search {
background-image: url("./styles/prosilver/theme/images/icon_textbox_search.gif");
}
input.disabled {
color: #666666;
}
.reputation.positive a, .reputation.negative a {
color: white;
text-decoration: none;
cursor: pointer;
}
.reputation.positive {
background: #6F8F52;
color: white;
text-align: center;
}
.reputation.negative {
background: #B82929;
color: white;
text-align: center;
}
.reputation.zero {
background: #FFF;
color: #6E6E6E;
text-align: center;
}
.reputation.span {
color: #FFF;
}
.reputation {
font-weight: bold;
padding: 3px 8px;
display: inline-block;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
font-size: 10px;
/*height: 14px;*/
/*padding: 2px 10px !important;*/
}
.positive {
color: #6F8F52;
}
.negative {
color: #B82929;
}
ul.profile-icons li.rate-good-icon { width: 20px; height: 20px; }
ul.profile-icons li.rate-bad-icon { width: 20px; height: 20px; }
ul.profile-icons li.rate-good-icon a { background-image: url("./styles/prosilver/imageset/icon_rate_good.gif"); }
ul.profile-icons li.rate-bad-icon a { background-image: url("./styles/prosilver/imageset/icon_rate_bad.gif"); }
ul.profile-icons li.rate-good-icon a:hover,
ul.profile-icons li.rate-bad-icon a:hover {background-position: center bottom}
#repo-popup {
width: 300px;
font-size: 80%;
position: absolute;
z-index: 500;
display: none;
background: white;
box-shadow: 2px 2px 4px #555555;
border-radius: 11px;
padding: 5px;
}
#repo-popup .panel {margin-bottom: 0px}
#repo-popup .error {text-align: center; font-size:140%}
.vote_status_positive, .vote_status_negative {text-align: center; font-size: 120%;}
.vote_status_positive {background: #d4f0cc}
.vote_status_negative {background: #ffe6e6}
.rs_more_details {background: #FFFFFF; padding: 3px;font-size:110%;border-radius: 0 0 3px 3px ;border:1px solid #0F9BE1;margin: -5px auto 5px;width:100px;text-align: center;}
/**
*
* @package mChat ProSilver Style
* @version 1.3.5 2010-12-02
* @copyright (c) RMcGirr83 ( http://www.rmcgirr83.org/ )
* @copyright (c) By Shapoval Andrey Vladimirovich (AllCity) ~ http://allcity.net.ru/
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
**/
/* mChat
------------ */
div.mChatBG1 {
background-color: #FBFBFB;
padding: 5px 5px 5px 5px;
border-bottom: 1px dotted #DDDDDD;
overflow: hidden;
}
div.mChatBG2 {
background-color: #FFFFFF;
padding: 5px 5px 5px 5px;
border-bottom: 1px dotted #DDDDDD;
overflow: hidden;
}
div.mChatRowLimit {
overflow: auto;
width: 100%;
}
div.mChatRowLimitCustom {
overflow: auto;
width: 100%;
}
div.mChatPanel {
text-align: center;
padding: 3px;
clear: both;
}
input.mChatText {
cursor: text;
width: 50%;
background-color: #FFFFFF;
border: 1px solid #B4BAC0;
color: #333333;
padding: 5px 5px 3px 5px;
margin: 3px 0px 3px 5px;
}
input.mChatText:hover {
border-color: #11A3EA;
}
div.mChatHover:hover {
background-color: #F6F4D0;
}
div.mChatBodyFix {
width: 100% !important;
background-color: #E9F0F5 !important;
}
div.mChatStatic {
padding-left: 5px;
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
text-align: left;
font-size: 1.1em;
}
div.mChatStats {
padding-left: 5px;
margin-top: 2px;
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
text-align: left;
min-height: 1.3em;
font-size: 1.1em;
height: auto !important;
}
div.mChatRefresh {
padding-left: 5px;
font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;
text-align: left;
font-size: 1.1em;
margin-top: 1.5em;
clear: both;
}
input.mChatColor {
width: 100%;
text-align: center;
background-color: #DEE3E7;
border-style: none;
}
div.mChatMessage {
padding: 3px;
font-size: 1.1em;
width: 98%;
}
a.mChatScriptLink {
text-decoration:none;
}
img.mChatImage{
vertical-align: middle;
}
img.mChatImageLoad {
vertical-align: middle;
cursor: wait;
display: none;
}
img.mChatImageOk {
vertical-align: middle;
cursor: help;
}
img.mChatImageHideImg {
vertical-align: middle;
cursor: help;
display: none;
}
div.mChatSound {
position: absolute;
left: -1000px;
top: -1000px;
}
.mchat_alert {
color: #7E2217;
padding: 10px;
}
#mChatUserList {
display: none;
float: left;
}
.mChatAvatars {
float: left;
padding-right: 5px;
}
div.avatarMessage {
margin-left: 50px;
width: 90%;
margin-right: 5px;
}
|
Rocky5/Xbox-Softmodding-Tool
|
Documents/Installation Guide/files/style.php
|
PHP
|
gpl-3.0
| 79,096 |
using System;
using System.Collections.ObjectModel;
using System.Net.Http;
using System.Threading.Tasks;
using System.Windows.Input;
using GithubXamarin.Core.Contracts.Service;
using GithubXamarin.Core.Contracts.ViewModel;
using GithubXamarin.Core.Messages;
using MvvmCross.Core.ViewModels;
using MvvmCross.Plugins.Messenger;
using Octokit;
namespace GithubXamarin.Core.ViewModels
{
public class NotificationsViewModel : BaseViewModel, INotificationsViewModel
{
#region Properties and Commands
private readonly INotificationDataService _notificationDataService;
private ObservableCollection<Notification> _notifications;
public ObservableCollection<Notification> Notifications
{
get => _notifications;
set
{
_notifications = value;
RaisePropertyChanged(() => Notifications);
}
}
private Notification _markedNotification;
public Notification MarkedNotification
{
get => _markedNotification;
set
{
_markedNotification = value;
RaisePropertyChanged(() => MarkedNotification);
}
}
private ICommand _markNotificationAsReadCommand;
public ICommand MarkNotificationAsReadCommand
{
get
{
_markNotificationAsReadCommand = _markNotificationAsReadCommand ?? new MvxCommand<Notification>(notification => MarkNotificationAsRead(notification));
return _markNotificationAsReadCommand;
}
}
private ICommand _markAllNotificationsAsReadCommand;
public ICommand MarkAllNotificationsAsReadCommand
{
get
{
_markAllNotificationsAsReadCommand = _markAllNotificationsAsReadCommand ??
new MvxAsyncCommand(async () => await MarkAllNotificationsAsRead());
return _markAllNotificationsAsReadCommand;
}
}
private ICommand _refreshCommand;
public ICommand RefreshCommand
{
get
{
_refreshCommand = _refreshCommand ?? new MvxAsyncCommand(async () => await Refresh());
return _refreshCommand;
}
}
private long? _repositoryId;
#endregion
public NotificationsViewModel(IGithubClientService githubClientService, INotificationDataService notificationDataService, IMvxMessenger messenger, IDialogService dialogService) : base(githubClientService, messenger, dialogService)
{
_notificationDataService = notificationDataService;
}
public async void Init(long? repositoryId = null)
{
_repositoryId = repositoryId;
await Refresh();
}
public async Task MarkNotificationAsRead(Notification notification)
{
Messenger.Publish(new LoadingStatusMessage(this) { IsLoadingIndicatorActive = true });
await _notificationDataService.MarkNotificationAsRead(Convert.ToInt32(notification.Id),
GithubClientService.GetAuthorizedGithubClient());
Messenger.Publish(new LoadingStatusMessage(this) { IsLoadingIndicatorActive = false });
}
public async Task MarkAllNotificationsAsRead()
{
Messenger.Publish(new LoadingStatusMessage(this) { IsLoadingIndicatorActive = true });
try
{
await _notificationDataService.MarkAllNotificationsAsRead(
GithubClientService.GetAuthorizedGithubClient());
}
catch (ApiException)
{
foreach (var notification in Notifications)
{
await _notificationDataService.MarkNotificationAsRead(Convert.ToInt32(notification.Id),
GithubClientService.GetAuthorizedGithubClient());
}
}
await Refresh();
Messenger.Publish(new LoadingStatusMessage(this) { IsLoadingIndicatorActive = false });
}
public async Task Refresh()
{
if (!(await IsInternetAvailable()))
{
await DialogService.ShowSimpleDialogAsync("What is better ? To be born good or to overcome your evil nature through great effort ?", "No Internet Connection!");
return;
}
Messenger.Publish(new LoadingStatusMessage(this) { IsLoadingIndicatorActive = true });
try
{
if (_repositoryId.HasValue)
{
Messenger.Publish(new AppBarHeaderChangeMessage(this) { HeaderTitle = "Notifications" });
Notifications = await _notificationDataService.GetAllNotificationsForRepository(_repositoryId.Value,
GithubClientService.GetAuthorizedGithubClient());
}
else
{
Messenger.Publish(new AppBarHeaderChangeMessage(this) { HeaderTitle = "Your Notifications" });
Notifications =
await _notificationDataService.GetAllNotificationsForCurrentUser(
GithubClientService.GetAuthorizedGithubClient());
}
}
catch (HttpRequestException)
{
await DialogService.ShowSimpleDialogAsync("The internet seems to be working but the code threw an HttpRequestException. Try again.", "Hmm, this is weird!");
}
Messenger.Publish(new LoadingStatusMessage(this) { IsLoadingIndicatorActive = false });
}
}
}
|
prajjwaldimri/GithubXamarin
|
GithubXamarin.Core/ViewModels/NotificationsViewModel.cs
|
C#
|
gpl-3.0
| 5,785 |
/*
* Broadcom Proprietary and Confidential. Copyright 2016 Broadcom
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
* the contents of this file may not be disclosed to third parties, copied
* or duplicated in any form, in whole or in part, without the prior
* written permission of Broadcom Corporation.
*/
#ifdef __cplusplus
extern "C"
{
#endif
static const ge25519 ge25519_basepoint = {
{0x00062d608f25d51a,0x000412a4b4f6592a,0x00075b7171a4b31d,0x0001ff60527118fe,0x000216936d3cd6e5},
{0x0006666666666658,0x0004cccccccccccc,0x0001999999999999,0x0003333333333333,0x0006666666666666},
{0x0000000000000001,0x0000000000000000,0x0000000000000000,0x0000000000000000,0x0000000000000000},
{0x00068ab3a5b7dda3,0x00000eea2a5eadbb,0x0002af8df483c27e,0x000332b375274732,0x00067875f0fd78b7}
};
static const bignum25519 ge25519_ecd = {
0x00034dca135978a3,0x0001a8283b156ebd,0x0005e7a26001c029,0x000739c663a03cbb,0x00052036cee2b6ff
};
static const bignum25519 ge25519_ec2d = {
0x00069b9426b2f159,0x00035050762add7a,0x0003cf44c0038052,0x0006738cc7407977,0x0002406d9dc56dff
};
static const bignum25519 ge25519_sqrtneg1 = {
0x00061b274a0ea0b0,0x0000d5a5fc8f189d,0x0007ef5e9cbd0c60,0x00078595a6804c9e,0x0002b8324804fc1d
};
static const ge25519_niels ge25519_niels_sliding_multiples[32] = {
{{0x00003905d740913e,0x0000ba2817d673a2,0x00023e2827f4e67c,0x000133d2e0c21a34,0x00044fd2f9298f81},{0x000493c6f58c3b85,0x0000df7181c325f7,0x0000f50b0b3e4cb7,0x0005329385a44c32,0x00007cf9d3a33d4b},{0x00011205877aaa68,0x000479955893d579,0x00050d66309b67a0,0x0002d42d0dbee5ee,0x0006f117b689f0c6}},
{{0x00011fe8a4fcd265,0x0007bcb8374faacc,0x00052f5af4ef4d4f,0x0005314098f98d10,0x0002ab91587555bd},{0x0005b0a84cee9730,0x00061d10c97155e4,0x0004059cc8096a10,0x00047a608da8014f,0x0007a164e1b9a80f},{0x0006933f0dd0d889,0x00044386bb4c4295,0x0003cb6d3162508c,0x00026368b872a2c6,0x0005a2826af12b9b}},
{{0x000182c3a447d6ba,0x00022964e536eff2,0x000192821f540053,0x0002f9f19e788e5c,0x000154a7e73eb1b5},{0x0002bc4408a5bb33,0x000078ebdda05442,0x0002ffb112354123,0x000375ee8df5862d,0x0002945ccf146e20},{0x0003dbf1812a8285,0x0000fa17ba3f9797,0x0006f69cb49c3820,0x00034d5a0db3858d,0x00043aabe696b3bb}},
{{0x00072c9aaa3221b1,0x000267774474f74d,0x000064b0e9b28085,0x0003f04ef53b27c9,0x0001d6edd5d2e531},{0x00025cd0944ea3bf,0x00075673b81a4d63,0x000150b925d1c0d4,0x00013f38d9294114,0x000461bea69283c9},{0x00036dc801b8b3a2,0x0000e0a7d4935e30,0x0001deb7cecc0d7d,0x000053a94e20dd2c,0x0007a9fbb1c6a0f9}},
{{0x0006217e039d8064,0x0006dea408337e6d,0x00057ac112628206,0x000647cb65e30473,0x00049c05a51fadc9},{0x0006678aa6a8632f,0x0005ea3788d8b365,0x00021bd6d6994279,0x0007ace75919e4e3,0x00034b9ed338add7},{0x0004e8bf9045af1b,0x000514e33a45e0d6,0x0007533c5b8bfe0f,0x000583557b7e14c9,0x00073c172021b008}},
{{0x00075b0249864348,0x00052ee11070262b,0x000237ae54fb5acd,0x0003bfd1d03aaab5,0x00018ab598029d5c},{0x000700848a802ade,0x0001e04605c4e5f7,0x0005c0d01b9767fb,0x0007d7889f42388b,0x0004275aae2546d8},{0x00032cc5fd6089e9,0x000426505c949b05,0x00046a18880c7ad2,0x0004a4221888ccda,0x0003dc65522b53df}},
{{0x0007013b327fbf93,0x0001336eeded6a0d,0x0002b565a2bbf3af,0x000253ce89591955,0x0000267882d17602},{0x0000c222a2007f6d,0x000356b79bdb77ee,0x00041ee81efe12ce,0x000120a9bd07097d,0x000234fd7eec346f},{0x0000a119732ea378,0x00063bf1ba8e2a6c,0x00069f94cc90df9a,0x000431d1779bfc48,0x000497ba6fdaa097}},
{{0x0003cd86468ccf0b,0x00048553221ac081,0x0006c9464b4e0a6e,0x00075fba84180403,0x00043b5cd4218d05},{0x0006cc0313cfeaa0,0x0001a313848da499,0x0007cb534219230a,0x00039596dedefd60,0x00061e22917f12de},{0x0002762f9bd0b516,0x0001c6e7fbddcbb3,0x00075909c3ace2bd,0x00042101972d3ec9,0x000511d61210ae4d}},
{{0x000386484420de87,0x0002d6b25db68102,0x000650b4962873c0,0x0004081cfd271394,0x00071a7fe6fe2482},{0x000676ef950e9d81,0x0001b81ae089f258,0x00063c4922951883,0x0002f1d54d9b3237,0x0006d325924ddb85},{0x000182b8a5c8c854,0x00073fcbe5406d8e,0x0005de3430cff451,0x000554b967ac8c41,0x0004746c4b6559ee}},
{{0x000546c864741147,0x0003a1df99092690,0x0001ca8cc9f4d6bb,0x00036b7fc9cd3b03,0x000219663497db5e},{0x00077b3c6dc69a2b,0x0004edf13ec2fa6e,0x0004e85ad77beac8,0x0007dba2b28e7bda,0x0005c9a51de34fe9},{0x0000f1cf79f10e67,0x00043ccb0a2b7ea2,0x00005089dfff776a,0x0001dd84e1d38b88,0x0004804503c60822}},
{{0x000021d23a36d175,0x0004fd3373c6476d,0x00020e291eeed02a,0x00062f2ecf2e7210,0x000771e098858de4},{0x00049ed02ca37fc7,0x000474c2b5957884,0x0005b8388e816683,0x0004b6c454b76be4,0x000553398a516506},{0x0002f5d278451edf,0x000730b133997342,0x0006965420eb6975,0x000308a3bfa516cf,0x0005a5ed1d68ff5a}},
{{0x0005e0c558527359,0x0003395b73afd75c,0x000072afa4e4b970,0x00062214329e0f6d,0x000019b60135fefd},{0x0005122afe150e83,0x0004afc966bb0232,0x0001c478833c8268,0x00017839c3fc148f,0x00044acb897d8bf9},{0x000068145e134b83,0x0001e4860982c3cc,0x000068fb5f13d799,0x0007c9283744547e,0x000150c49fde6ad2}},
{{0x0001863c9cdca868,0x0003770e295a1709,0x0000d85a3720fd13,0x0005e0ff1f71ab06,0x00078a6d7791e05f},{0x0003f29509471138,0x000729eeb4ca31cf,0x00069c22b575bfbc,0x0004910857bce212,0x0006b2b5a075bb99},{0x0007704b47a0b976,0x0002ae82e91aab17,0x00050bd6429806cd,0x00068055158fd8ea,0x000725c7ffc4ad55}},
{{0x00002bf71cd098c0,0x00049dabcc6cd230,0x00040a6533f905b2,0x000573efac2eb8a4,0x0004cd54625f855f},{0x00026715d1cf99b2,0x0002205441a69c88,0x000448427dcd4b54,0x0001d191e88abdc5,0x000794cc9277cb1f},{0x0006c426c2ac5053,0x0005a65ece4b095e,0x0000c44086f26bb6,0x0007429568197885,0x0007008357b6fcc8}},
{{0x00039fbb82584a34,0x00047a568f257a03,0x00014d88091ead91,0x0002145b18b1ce24,0x00013a92a3669d6d},{0x0000672738773f01,0x000752bf799f6171,0x0006b4a6dae33323,0x0007b54696ead1dc,0x00006ef7e9851ad0},{0x0003771cc0577de5,0x0003ca06bb8b9952,0x00000b81c5d50390,0x00043512340780ec,0x0003c296ddf8a2af}},
{{0x00034d2ebb1f2541,0x0000e815b723ff9d,0x000286b416e25443,0x0000bdfe38d1bee8,0x0000a892c7007477},{0x000515f9d914a713,0x00073191ff2255d5,0x00054f5cc2a4bdef,0x0003dd57fc118bcf,0x0007a99d393490c7},{0x0002ed2436bda3e8,0x00002afd00f291ea,0x0000be7381dea321,0x0003e952d4b2b193,0x000286762d28302f}},
{{0x00058e2bce2ef5bd,0x00068ce8f78c6f8a,0x0006ee26e39261b2,0x00033d0aa50bcf9d,0x0007686f2a3d6f17},{0x000036093ce35b25,0x0003b64d7552e9cf,0x00071ee0fe0b8460,0x00069d0660c969e5,0x00032f1da046a9d9},{0x000512a66d597c6a,0x0000609a70a57551,0x000026c08a3c464c,0x0004531fc8ee39e1,0x000561305f8a9ad2}},
{{0x0002cc28e7b0c0d5,0x00077b60eb8a6ce4,0x0004042985c277a6,0x000636657b46d3eb,0x000030a1aef2c57c},{0x0004978dec92aed1,0x000069adae7ca201,0x00011ee923290f55,0x00069641898d916c,0x00000aaec53e35d4},{0x0001f773003ad2aa,0x000005642cc10f76,0x00003b48f82cfca6,0x0002403c10ee4329,0x00020be9c1c24065}},
{{0x0000e44ae2025e60,0x0005f97b9727041c,0x0005683472c0ecec,0x000188882eb1ce7c,0x00069764c545067e},{0x000387d8249673a6,0x0005bea8dc927c2a,0x0005bd8ed5650ef0,0x0000ef0e3fcd40e1,0x000750ab3361f0ac},{0x00023283a2f81037,0x000477aff97e23d1,0x0000b8958dbcbb68,0x0000205b97e8add6,0x00054f96b3fb7075}},
{{0x0005afc616b11ecd,0x00039f4aec8f22ef,0x0003b39e1625d92e,0x0005f85bd4508873,0x00078e6839fbe85d},{0x0005f20429669279,0x00008fafae4941f5,0x00015d83c4eb7688,0x0001cf379eca4146,0x0003d7fe9c52bb75},{0x00032df737b8856b,0x0000608342f14e06,0x0003967889d74175,0x0001211907fba550,0x00070f268f350088}},
{{0x0004112070dcf355,0x0007dcff9c22e464,0x00054ada60e03325,0x00025cd98eef769a,0x000404e56c039b8c},{0x00064583b1805f47,0x00022c1baf832cd0,0x000132c01bd4d717,0x0004ecf4c3a75b8f,0x0007c0d345cfad88},{0x00071f4b8c78338a,0x00062cfc16bc2b23,0x00017cf51280d9aa,0x0003bbae5e20a95a,0x00020d754762aaec}},
{{0x0004feb135b9f543,0x00063bd192ad93ae,0x00044e2ea612cdf7,0x000670f4991583ab,0x00038b8ada8790b4},{0x0007c36fc73bb758,0x0004a6c797734bd1,0x0000ef248ab3950e,0x00063154c9a53ec8,0x0002b8f1e46f3cee},{0x00004a9cdf51f95d,0x0005d963fbd596b8,0x00022d9b68ace54a,0x0004a98e8836c599,0x000049aeb32ceba1}},
{{0x00067d3c63dcfe7e,0x000112f0adc81aee,0x00053df04c827165,0x0002fe5b33b430f0,0x00051c665e0c8d62},{0x00007d0b75fc7931,0x00016f4ce4ba754a,0x0005ace4c03fbe49,0x00027e0ec12a159c,0x000795ee17530f67},{0x00025b0a52ecbd81,0x0005dc0695fce4a9,0x0003b928c575047d,0x00023bf3512686e5,0x0006cd19bf49dc54}},
{{0x0007619052179ca3,0x0000c16593f0afd0,0x000265c4795c7428,0x00031c40515d5442,0x0007520f3db40b2e},{0x0006612165afc386,0x0001171aa36203ff,0x0002642ea820a8aa,0x0001f3bb7b313f10,0x0005e01b3a7429e4},{0x00050be3d39357a1,0x0003ab33d294a7b6,0x0004c479ba59edb3,0x0004c30d184d326f,0x00071092c9ccef3c}},
{{0x0000523f0364918c,0x000687f56d638a7b,0x00020796928ad013,0x0005d38405a54f33,0x0000ea15b03d0257},{0x0003d8ac74051dcf,0x00010ab6f543d0ad,0x0005d0f3ac0fda90,0x0005ef1d2573e5e4,0x0004173a5bb7137a},{0x00056e31f0f9218a,0x0005635f88e102f8,0x0002cbc5d969a5b8,0x000533fbc98b347a,0x0005fc565614a4e3}},
{{0x0006570dc46d7ae5,0x00018a9f1b91e26d,0x000436b6183f42ab,0x000550acaa4f8198,0x00062711c414c454},{0x0002e1e67790988e,0x0001e38b9ae44912,0x000648fbb4075654,0x00028df1d840cd72,0x0003214c7409d466},{0x0001827406651770,0x0004d144f286c265,0x00017488f0ee9281,0x00019e6cdb5c760c,0x0005bea94073ecb8}},
{{0x0005bf0912c89be4,0x00062fadcaf38c83,0x00025ec196b3ce2c,0x00077655ff4f017b,0x0003aacd5c148f61},{0x0000ce63f343d2f8,0x0001e0a87d1e368e,0x000045edbc019eea,0x0006979aed28d0d1,0x0004ad0785944f1b},{0x00063b34c3318301,0x0000e0e62d04d0b1,0x000676a233726701,0x00029e9a042d9769,0x0003aff0cb1d9028}},
{{0x0005c7eb3a20405e,0x0005fdb5aad930f8,0x0004a757e63b8c47,0x00028e9492972456,0x000110e7e86f4cd2},{0x0006430bf4c53505,0x000264c3e4507244,0x00074c9f19a39270,0x00073f84f799bc47,0x0002ccf9f732bd99},{0x0000d89ed603f5e4,0x00051e1604018af8,0x0000b8eedc4a2218,0x00051ba98b9384d0,0x00005c557e0b9693}},
{{0x0001ce311fc97e6f,0x0006023f3fb5db1f,0x0007b49775e8fc98,0x0003ad70adbf5045,0x0006e154c178fe98},{0x0006bbb089c20eb0,0x0006df41fb0b9eee,0x00051087ed87e16f,0x000102db5c9fa731,0x000289fef0841861},{0x00016336fed69abf,0x0004f066b929f9ec,0x0004e9ff9e6c5b93,0x00018c89bc4bb2ba,0x0006afbf642a95ca}},
{{0x0000de0c62f5d2c1,0x00049601cf734fb5,0x0006b5c38263f0f6,0x0004623ef5b56d06,0x0000db4b851b9503},{0x00055070f913a8cc,0x000765619eac2bbc,0x0003ab5225f47459,0x00076ced14ab5b48,0x00012c093cedb801},{0x00047f9308b8190f,0x000414235c621f82,0x00031f5ff41a5a76,0x0006736773aab96d,0x00033aa8799c6635}},
{{0x0007f51ebd085cf2,0x00012cfa67e3f5e1,0x0001800cf1e3d46a,0x00054337615ff0a8,0x000233c6f29e8e21},{0x0000f588fc156cb1,0x000363414da4f069,0x0007296ad9b68aea,0x0004d3711316ae43,0x000212cd0c1c8d58},{0x0004d5107f18c781,0x00064a4fd3a51a5e,0x0004f4cd0448bb37,0x000671d38543151e,0x0001db7778911914}},
{{0x000352397c6bc26f,0x00018a7aa0227bbe,0x0005e68cc1ea5f8b,0x0006fe3e3a7a1d5f,0x00031ad97ad26e2a},{0x00014769dd701ab6,0x00028339f1b4b667,0x0004ab214b8ae37b,0x00025f0aefa0b0fe,0x0007ae2ca8a017d2},{0x000017ed0920b962,0x000187e33b53b6fd,0x00055829907a1463,0x000641f248e0a792,0x0001ed1fc53a6622}}
};
#ifdef __cplusplus
} /*extern "C" */
#endif
|
XuGuohui/firmware
|
hal/src/duo/wiced/security/BESL/crypto_open/ed25519/ed25519-donna-64bit-tables.h
|
C
|
gpl-3.0
| 10,947 |
require("scripts/globals/settings");
require("scripts/globals/status");
require("scripts/globals/magic");
function OnAbilityCheck(player,target,ability)
if (player:hasStatusEffect(EFFECT_TRANCE)) then
return 0,0;
elseif (player:getTP() < 10) then
return MSGBASIC_NOT_ENOUGH_TP,0;
else
player:delTP(10);
return 0,0;
end;
end;
function OnUseAbility(player, target, ability)
player:delStatusEffect(EFFECT_HASTE_SAMBA);
player:delStatusEffect(EFFECT_DRAIN_SAMBA);
player:addStatusEffect(EFFECT_ASPIR_SAMBA,1,0,120);
end;
-----------------------------------
-- onEffectGain Action
-----------------------------------
function onEffectGain(target,effect)
target:addMod(MOD_ENSPELL, 20);
target:addMod(MOD_ENSPELL_DMG, 1);
end;
-----------------------------------
-- onEffectTick Action
-----------------------------------
function onEffectTick(target,effect)
end;
-----------------------------------
-- onEffectLose Action
-----------------------------------
function onEffectLose(target,effect)
target:setMod(MOD_ENSPELL,0);
target:setMod(MOD_ENSPELL_DMG,0);
end;
|
Fatalerror66/ffxi-a
|
scripts/globals/abilities/aspir_samba.lua
|
Lua
|
gpl-3.0
| 1,131 |
#ifndef CONFIG_DEFAULTS_H_INCLUDED
#define CONFIG_DEFAULTS_H_INCLUDED
// 64mm in meters
#define IPD_DEFAULT 0.064f
#define DEFAULT_YAW_MULTIPLIER 25.0f
#define DEFAULT_PITCH_MULTIPLIER 25.0f
#define DEFAULT_POS_TRACKING_X_MULT 2.0f
#define DEFAULT_POS_TRACKING_Y_MULT 2.5f
#define DEFAULT_POS_TRACKING_Z_MULT 0.5f
#define DEFAULT_GUI_SIZE_1 0.6f
#define DEFAULT_GUI_SIZE_2 0.5f
#define DEFAULT_GUI_SIZE_3 0.9f
#define DEFAULT_GUI_SIZE_4 1.0f
#define DEFAULT_HUD_DISTANCE_1 0.5f
#define DEFAULT_HUD_DISTANCE_2 0.9f
#define DEFAULT_HUD_DISTANCE_3 0.3f
#define DEFAULT_HUD_DISTANCE_4 0.0f
#define COMFORT_MODE_STICK_THRESHOLD 0.5f
#define MENU_ADJUSTMENT_STICK_DEADZONE 0.25f
#define MENU_SELECTION_STICK_DEADZONE 0.25f
#define BOUND_STICK_DEADZONE 0.5f
#endif
|
jimrandomh/Perception
|
Shared/ConfigDefaults.h
|
C
|
gpl-3.0
| 765 |
@echo off
color 5
mode 1000
title We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us
echo `.-:/+osssyyyyyyyhhhhhddddmmmmmmmmmmmmmmmmmddhyyyo+/.
echo `+yddddmmmmmmmmNNNNNNNmmmmmmmmmmmmmmmmmNNNNNNNNNmmmmmmddh/`
echo :hddddddmmmmmmmmmNNNNmmmmmmmmmmmmmmmmmmmmNNNNNNNNmmmmmmdddds
echo -ddddddddddmmmmmNNNNNNmmmmmmmmmmmmmmmmmmmmNNNNNNNNmmmmmmddddd
echo hdddddddddddddmmmmmNNNNmmmmmmmmmmmmmmmmmmmmNNNmmmmmdddddddddd.
echo :dhhddhhhhhhhhdddmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmddddhhhhhddd-
echo ohhhhyyssooooosyyhdddmmddddmmmmmmmmmmmmddddmmmddhhyyyyyyssshhd:
echo yhhyyso+++++ooosssoosyhddddddmmmmmmddddddddhyyysssssssssssoshd/
echo hhhsoo/....--:/++osyssooshhddddmmmmddhhhhyyss+/::://::---:ooyh/
echo hhhs+/oyyhhhhs+/:::://+soosyhhdddmdddhyso+/-..--:/+syhhys/:oyh/
echo yyyyshddmmmmmmmmhs/-..``-/sssyhhddddhy+:.```.:+yhmmNNNNmmmdohh+
echo yhoyhdddmmmmmmmmmddyo:.`` :hhhhhddddh:`` `-+shdddmmmmmmmmmdhyho
echo `yhsyhddddddmmmmdddddhyso++yyhhdddddddo--+oyyhhddddddmmmmdddhhhy
echo `yhhshhdddddhhhhhhhhhhhyyssyhddddmdddhyyssyyhhhddddddddddddhhyhh`
echo ` `yhdhyhhhyo++oooo+oooosssssyhdmmmmmmddyssyyyssooooooosyhhhhhhhdh. `
echo .yhhhs+o+/oyy/-.` ``.--/oydddmNNNNNdddys+oo++///:/+yyo+syyshhdd-
echo .sssyysssssyy+-`````.:+oosmmdddNNNNmmmmdo/o:.`` ``+dh/+ooosyd/
echo .syyhdmmmmmdyyysooosyyyydmmmmmmmNNNmmmmmdhosyso+++osyhyyhdmmmyyh+
echo .ohddddmmmmmmNNmmmmmmmmmmmmmmmmmNNNmmmmmmmmmddhhyhhdmmNNmmmmmdhho
echo `ohhhhdddmmmmNNmmmmmmmmmNmmmmmmmNNNmmmmmNNmmmmmmmNNNNNNNmmmdddhys
echo `+yyyhhhddmmmmmmmmmmmmmmNmmmmmmmNNNmmmmmNNNmmmmmmmmmNNNmmmddhhhyo
echo /yssyyhhhdddmmmmdmmmmmmmmmmmmmmNNNmmmmmmNNmmmmmmmmmmmmmdddhhhyy/
echo .ssossyyhhddddddddddddddmmmmmmmNNNmmmmmmmmmmmmddmmmmmdddhhhyyyy-
echo +yooossyyyhhhhyyyyyyydmmmmmmmNNNNNmmmmmmdyyhhhhdddddddhhyysyyy`
echo -+yso++++++++++ossydddmmmdddmNNmmNmmmmmmddhysoosssyyyyssosyyso
echo `/+soos-.-:ssyhddmmmdhhdddddmmmmmmmddddddmmmmdhso++:::/+shhsy:
echo :++oooy..:/hdddmmmmmdyoo+yhdhhhhhhdyyoydmmmmmddhh/../sshhssy`
echo `+++sosh-`-+dddmmmmmmddd:-+++oooo+/yddmmmmmmmmmh/-.+sshhysy+
echo -+++sssd:`-/yyhddmmmmdo--.``````.::ymmmmmmmmds:-.ssyhhysyy.
echo :+++sssh/```.--::://:-..` `/: .-::/ossss+//-`:ysyhdysyy/
echo :+++sysyyo/:-..````.````/yyyo.`.---..------:shsyhdysyy/
echo -+++oyssyhdddhyyso++/--::::::`.//++oosyyhdhysyhdysys:
echo ./++oysossyhdmmmmmddhyooooooshdmmmmmmmdhyssyhhssyo.
echo `:+/+sysssssssyyhhhddhhhhdddddddhhyysyssyyhhsss/`
echo .///sysyyyyysssss/:::::::/+osssyyyyssyhhysys-
echo `:/:oyssyhhhhhyyy: +yyhhhhhysyhhhysy+`
echo ./:/sysyhhhhhhhy`` .-mdddddhhyydhyyys-
echo `-:/shyyhhddddo.. --dmmmmddhhdysys/`
echo `-+yhyhhdddmo.. ..dmmmmdhhhssyo.
echo `:syyhhhddd`` `.mmmmddhysss-
echo .+syyhhhd: omdddhhyss:`
echo -+syyyys hhhhhyyo:`
echo -+ooso -sssss+-
echo
echo
echo We are Anonymous. We are Legion. We do not forgive. We do not forget. Expect us!!
pause >nul
|
exploi8/AA
|
LOGOS/LOGO3.bat
|
Batchfile
|
gpl-3.0
| 4,598 |
url: http://sanskrit.jnu.ac.in/sandhi/viccheda.jsp?itext=पदार्थाऽन्वय<html>
<title>Sanskrit Sandhi Splitter at J.N.U. New Delhi</title>
<META CONTENT='text/hetml CHARSET=UTF-8' HTTP-EQUIV='Content-Type'/>
<META NAME="Author" CONTENT="Dr. Girish Nath Jha">
<META NAME="Keywords" CONTENT="Dr. Girish Nath Jha, Sachin, Diwakar Mishra, Sanskrit Computational Linguistics, Sanskrit informatics, Sanskrit computing, Sanskrit language processing, Sanskrit and computer, computer processing of sanskrit, subanta, tinanta, POS tagger, tagset, Indian languages, linguistics, amarakosha, amarakosa, Indian tradition, Indian heritage, Machine translation, AI, MT divergence, Sandhi, kridanta, taddhita, e-learning, corpus, etext, e-text, Sanskrit blog, Panini, Bhartrhari, Bhartrihari, Patanjali, karaka, mahabharata, ashtadhyayi, astadhyayi, indexer, indexing, lexical resources, Sanskrit, thesaurus, samasa, gender analysis in Sanskrit, Hindi, saHiT, language technology, NLP">
<META NAME="Description" CONTENT="Dr. Girish Nath Jha, Sachin, Diwakar Mishra, Sanskrit Computational Linguistics, Sanskrit informatics, Sanskrit computing, Sanskrit language processing, Sanskrit and computer, computer processing of sanskrit, subanta, tinanta, POS tagger, tagset, Indian languages, linguistics, amarakosha, amarakosa, Indian tradition, Indian heritage, Machine translation, AI, MT divergence, Sandhi, kridanta, taddhita, e-learning, corpus, etext, e-text, Sanskrit blog, Panini, Bhartrhari, Bhartrihari, Patanjali, karaka, mahabharata, ashtadhyayi, astadhyayi, indexer, indexing, lexical resources, Sanskrit, thesaurus, samasa, gender analysis in Sanskrit, Hindi, saHiT, language technology, NLP">
<head>
<head>
<style>
<!--
div.Section1
{page:Section1;}
-->
</style>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<script language="JavaScript" src=../js/menuitems.js></script>
<script language="JavaScript" src="../js/mm_menu.js"></script>
<meta name=Author content="Dr. Girish Nath Jha, JNU, New Delhi">
</head>
<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>
<div class=Section1>
<div align=center>
<table border=1 cellspacing=0 cellpadding=0 width=802 style='width:601.5pt;
border-collapse:collapse;border:none;mso-border-alt:outset navy .75pt'>
<tr>
<td width=800 style='width:600.0pt;border:inset navy .75pt;padding:.75pt .75pt .75pt .75pt'>
<script language="JavaScript1.2">mmLoadMenus();</script>
<img width=800 height=130 id="_x0000_i1028" src="../images/header1.jpg"
border=0>
</td>
</tr>
<tr>
<td width=818 style='width:613.5pt;border:inset navy .75pt;border-top:none;
mso-border-top-alt:inset navy .75pt;padding:.75pt .75pt .75pt .75pt'>
<p align="center"><a href="../"><span style='text-decoration:none;text-underline:
none'><img border=1 width=49 height=26 id="_x0000_i1037"
src="../images/backtohome.jpg"></span></a><span style='text-underline:
none'> </span><a href="javascript:;"
onmouseover="MM_showMenu(window.mm_menu_0821171051_0,6,29,null,'image2')"
onmouseout="MM_startTimeout();"><span style='text-decoration:none;text-underline:
none'><img border=1 id=image2 src="../images/lang_tool.jpg"
name=image2 width="192" height="25"></span></a><span style='text-underline:
none'> </span><a href="javascript:;"
onmouseover="MM_showMenu(window.mm_menu_0821171909_0,6,29,null,'image3')"
onmouseout="MM_startTimeout();"><span style='text-decoration:none;text-underline:
none'><img border=1 id=image3 src="../images/lexical.jpg"
name=image3 width="137" height="25"></span></a><span style='text-underline:
none'> </span><a href="javascript:;"
onmouseover="MM_showMenu(window.mm_menu_0821171609_0,6,29,null,'image1')"
onmouseout="MM_startTimeout();"><span style='text-decoration:none;text-underline:
none'><img border=1 id=image1 src="../images/elearning.jpg"
name=image1 width="77" height="25"></span></a><span style='text-underline:
none'> </span><a href="javascript:;"
onmouseover="MM_showMenu(window.mm_menu_0821171809_0,6,29,null,'image4')"
onmouseout="MM_startTimeout();"><span style='text-decoration:none;text-underline:
none'><img border=1 id=image4 src="../images/corpora.jpg"
name=image4 width="105" height="26"></span></a><span style='text-underline:
none'> </span><a href="javascript:;"
onmouseover="MM_showMenu(window.mm_menu_0821171709_0,6,29,null,'image5')"
onmouseout="MM_startTimeout();"><span style='text-decoration:none;text-underline:
none'><img border=1 id=image5 src="../images/rstudents.jpg"
name=image5 width="125" height="26"></span></a><span style='text-underline:
none'> </span>
<a href="javascript:;"
onmouseover="MM_showMenu(window.mm_menu_0821171409_0,6,29,null,'image6')"
onmouseout="MM_startTimeout();"><span style='text-decoration:none;text-underline:
none'><img border=1 id=image6 src="../images/feedback.jpg"
name=image6 width="80" height="25"></span></a><span style='text-underline:
none'> </span>
<!---
<a href="../user/feedback.jsp"><img border="1" src="../images/feedback.jpg" width="80" height="25"></a>
--->
</td>
</tr>
<tr>
<td width="800">
<p align="center"><font color="#FF9933"><span style='font-size:18.0pt;
'><b>Sanskrit Sandhi Recognizer and Analyzer</b></span></font></p>
The Sanskrit sandhi splitter (VOWEL SANDHI) was developed as part of M.Phil. research by <a href="mailto:[email protected]">Sachin Kumar</a> (M.Phil. 2005-2007), and <a href=mailto:[email protected]>Diwakar Mishra</a> (M.Phil. 2007-2009) under the supervision of <a href=http://www.jnu.ac.in/faculty/gnjha>Dr. Girish Nath Jha</a>. The coding for this application has been done by Dr. Girish Nath Jha and Diwakar Mishra. <!---Please send feedback to to <a href="mailto:[email protected]">Dr. Girish Nath Jha</A>--->The Devanagari input mechanism has been developed in Javascript by Satyendra Kumar Chaube, Dr. Girish Nath Jha and Dharm Singh Rathore.
</center>
<table border=0 width=100%>
<tr>
<td valign=top width=48%>
<table>
<tr>
<td>
<FORM METHOD=get ACTION=viccheda.jsp#results name="iform" accept-Charset="UTF-8">
<font size=2><b>Enter Sanskrit text for sandhi processing (संधि-विच्छेद हेतु पाठ्य दें)
using adjacent keyboard OR Use our inbuilt <a href=../js/itrans.html target=_blank>iTRANS</a>-Devanagari unicode converter for fast typing<br>
<a href=sandhitest.txt>examples</a>
<TEXTAREA name=itext COLS=40 ROWS=9 onkeypress=checkKeycode(event) onkeyup=iu()> पदार्थाऽन्वय</TEXTAREA>
</td>
</tr>
<tr>
<td>
<font color=red size=2>Run in debug mode</font>
<input type=checkbox name="debug" value="ON">
<br>
<input type=submit value="Click to sandhi-split (संधि-विच्छेद करें)"></span><br>
</td>
</tr>
</table>
</td>
<td valign=top width=52%>
<table>
<tr>
<td>
<head>
<SCRIPT language=JavaScript src="../js/devkb.js"></SCRIPT>
<head>
<TEXTAREA name=itrans rows=5 cols=10 style="display:none"></TEXTAREA>
<INPUT name=lastChar type=hidden>
<table border=2 style="background-color:#fff;">
<tbody>
<tr >
<td>
<input type=button name="btn" style="width: 24px" value="अ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="आ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="इ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ई" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="उ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ऊ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ए" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ऐ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ओ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="औ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="अं" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="अः" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ऍ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ऑ" onClick="keyboard(this.value)">
</td>
</tr>
<tr>
<td>
<input type=button name="btn" style="width: 24px" value="्" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ा" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ि" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ी" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ु" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ू" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="े" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ै" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ो" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ौ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ं" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ः" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ॅ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ॉ" onClick="keyboard(this.value)">
</td>
</tr>
<tr>
<td>
<input type=button name="btn" style="width: 24px" value="क" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ख" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ग" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="घ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ङ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="च" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="छ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ज" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="झ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ञ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 100px" value="Backspace" onClick="BackSpace()">
</td>
</tr>
<tr>
<td>
<input type=button name="btn" style="width: 24px" value="+" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ट" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ठ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ड" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ढ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ण" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="त" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="थ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="द" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ध" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="न" onClick="keyboard(this.value)">
</td>
</tr>
<tr>
<td>
<input type=button name="btn" style="width: 24px" value="/" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="प" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="फ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ब" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="भ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="म" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="य" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="र" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ल" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="व" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="।" onClick="keyboard(this.value)">
</td>
</tr>
<tr>
<td>
<input type=button name="btn" style="width: 24px" value="*" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="श" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ष" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="स" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="ऋ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ऌ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ृ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ॄ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="ह" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="">
<input type=button name="btn" style="width: 24px" value="॥" onClick="keyboard(this.value)">
</td>
</tr>
<tr>
<td>
<input type=button name="btn" style="width: 24px" value="त्र" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="ज्ञ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="क्ष" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="श्र" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 200px" value="Space Bar" onClick="Space()">
<input type=button name="btn" style="width: 24px" value="ँ" onClick="keyboard(this.value)">
<input type=button name="btn" style="width: 24px" value="़" onClick="keyboard(this.value)">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
</table>
</form>
<a name=results>
<font size=4><b><u>Results</u></b></font>
<br>
पदार्था अन्वय (पूर्वरूपसन्धि, एङःपदान्तादति)<br>
<br>
<font color=red>
<br>
<hr>
<br>
</body>
</html>
|
sanskritiitd/sanskrit
|
uohCorpus.fil/uoh/uoh.filteredcorpus.txt_output/vyutpattivada-ext.txt.out.dict_18565_jnu.html
|
HTML
|
gpl-3.0
| 16,678 |
package com.kabouzeid.gramophone.util;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;
import android.provider.BaseColumns;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.widget.Toast;
import com.kabouzeid.gramophone.R;
import com.kabouzeid.gramophone.helper.M3UWriter;
import com.kabouzeid.gramophone.model.Playlist;
import com.kabouzeid.gramophone.model.PlaylistSong;
import com.kabouzeid.gramophone.model.Song;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static android.provider.MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI;
/**
* @author Karim Abou Zeid (kabouzeid)
*/
public class PlaylistsUtil {
public static int createPlaylist(@NonNull final Context context, @Nullable final String name) {
int id = -1;
if (name != null && name.length() > 0) {
try {
Cursor cursor = context.getContentResolver().query(EXTERNAL_CONTENT_URI,
new String[]{MediaStore.Audio.Playlists._ID}, MediaStore.Audio.PlaylistsColumns.NAME + "=?", new String[]{name}, null);
if (cursor == null || cursor.getCount() < 1) {
final ContentValues values = new ContentValues(1);
values.put(MediaStore.Audio.PlaylistsColumns.NAME, name);
final Uri uri = context.getContentResolver().insert(
EXTERNAL_CONTENT_URI,
values);
if (uri != null) {
// necessary because somehow the MediaStoreObserver is not notified when adding a playlist
context.getContentResolver().notifyChange(Uri.parse("content://media"), null);
Toast.makeText(context, context.getResources().getString(
R.string.created_playlist_x, name), Toast.LENGTH_SHORT).show();
id = Integer.parseInt(uri.getLastPathSegment());
}
} else {
if (cursor.moveToFirst()) {
id = cursor.getInt(cursor.getColumnIndex(MediaStore.Audio.Playlists._ID));
}
}
if (cursor != null) {
cursor.close();
}
} catch (SecurityException ignored) {
}
}
if (id == -1) {
Toast.makeText(context, context.getResources().getString(
R.string.could_not_create_playlist), Toast.LENGTH_SHORT).show();
}
return id;
}
public static void deletePlaylists(@NonNull final Context context, @NonNull final ArrayList<Playlist> playlists) {
final StringBuilder selection = new StringBuilder();
selection.append(MediaStore.Audio.Playlists._ID + " IN (");
for (int i = 0; i < playlists.size(); i++) {
selection.append(playlists.get(i).id);
if (i < playlists.size() - 1) {
selection.append(",");
}
}
selection.append(")");
try {
context.getContentResolver().delete(EXTERNAL_CONTENT_URI, selection.toString(), null);
} catch (SecurityException ignored) {
}
}
public static void addToPlaylist(@NonNull final Context context, final Song song, final int playlistId, final boolean showToastOnFinish) {
List<Song> helperList = new ArrayList<>();
helperList.add(song);
addToPlaylist(context, helperList, playlistId, showToastOnFinish);
}
public static void addToPlaylist(@NonNull final Context context, @NonNull final List<Song> songs, final int playlistId, final boolean showToastOnFinish) {
final int size = songs.size();
final ContentResolver resolver = context.getContentResolver();
final String[] projection = new String[]{
"max(" + MediaStore.Audio.Playlists.Members.PLAY_ORDER + ")",
};
final Uri uri = MediaStore.Audio.Playlists.Members.getContentUri("external", playlistId);
Cursor cursor = null;
int base = 0;
try {
try {
cursor = resolver.query(uri, projection, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
base = cursor.getInt(0) + 1;
}
} finally {
if (cursor != null) {
cursor.close();
}
}
int numInserted = 0;
for (int offSet = 0; offSet < size; offSet += 1000)
numInserted += resolver.bulkInsert(uri, makeInsertItems(songs, offSet, 1000, base));
if (showToastOnFinish) {
Toast.makeText(context, context.getResources().getString(
R.string.inserted_x_songs_into_playlist_x, numInserted, getNameForPlaylist(context, playlistId)), Toast.LENGTH_SHORT).show();
}
} catch (SecurityException ignored) {
}
}
@NonNull
public static ContentValues[] makeInsertItems(@NonNull final List<Song> songs, final int offset, int len, final int base) {
if (offset + len > songs.size()) {
len = songs.size() - offset;
}
ContentValues[] contentValues = new ContentValues[len];
for (int i = 0; i < len; i++) {
contentValues[i] = new ContentValues();
contentValues[i].put(MediaStore.Audio.Playlists.Members.PLAY_ORDER, base + offset + i);
contentValues[i].put(MediaStore.Audio.Playlists.Members.AUDIO_ID, songs.get(offset + i).id);
}
return contentValues;
}
public static void removeFromPlaylist(@NonNull final Context context, @NonNull final Song song, int playlistId) {
Uri uri = MediaStore.Audio.Playlists.Members.getContentUri(
"external", playlistId);
String selection = MediaStore.Audio.Playlists.Members.AUDIO_ID + " =?";
String[] selectionArgs = new String[]{String.valueOf(song.id)};
try {
context.getContentResolver().delete(uri, selection, selectionArgs);
} catch (SecurityException ignored) {
}
}
public static void removeFromPlaylist(@NonNull final Context context, @NonNull final List<PlaylistSong> songs) {
final int playlistId = songs.get(0).playlistId;
Uri uri = MediaStore.Audio.Playlists.Members.getContentUri(
"external", playlistId);
String selectionArgs[] = new String[songs.size()];
for (int i = 0; i < selectionArgs.length; i++) {
selectionArgs[i] = String.valueOf(songs.get(i).idInPlayList);
}
String selection = MediaStore.Audio.Playlists.Members._ID + " in (";
//noinspection unused
for (String selectionArg : selectionArgs) selection += "?, ";
selection = selection.substring(0, selection.length() - 2) + ")";
try {
context.getContentResolver().delete(uri, selection, selectionArgs);
} catch (SecurityException ignored) {
}
}
public static boolean doPlaylistContains(@NonNull final Context context, final long playlistId, final int songId) {
if (playlistId != -1) {
try {
Cursor c = context.getContentResolver().query(
MediaStore.Audio.Playlists.Members.getContentUri("external", playlistId),
new String[]{MediaStore.Audio.Playlists.Members.AUDIO_ID}, MediaStore.Audio.Playlists.Members.AUDIO_ID + "=?", new String[]{String.valueOf(songId)}, null);
int count = 0;
if (c != null) {
count = c.getCount();
c.close();
}
return count > 0;
} catch (SecurityException ignored) {
}
}
return false;
}
public static boolean moveItem(@NonNull final Context context, int playlistId, int from, int to) {
return MediaStore.Audio.Playlists.Members.moveItem(context.getContentResolver(),
playlistId, from, to);
}
public static void renamePlaylist(@NonNull final Context context, final long id, final String newName) {
ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.Audio.PlaylistsColumns.NAME, newName);
try {
context.getContentResolver().update(EXTERNAL_CONTENT_URI,
contentValues,
MediaStore.Audio.Playlists._ID + "=?",
new String[]{String.valueOf(id)});
context.getContentResolver().notifyChange(Uri.parse("content://media"), null);
} catch (SecurityException ignored) {
}
}
public static String getNameForPlaylist(@NonNull final Context context, final long id) {
try {
Cursor cursor = context.getContentResolver().query(
EXTERNAL_CONTENT_URI,
new String[]{MediaStore.Audio.PlaylistsColumns.NAME},
BaseColumns._ID + "=?",
new String[]{String.valueOf(id)},
null);
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
return cursor.getString(0);
}
} finally {
cursor.close();
}
}
} catch (SecurityException ignored) {
}
return "";
}
public static File savePlaylist(Context context, Playlist playlist) throws IOException {
return M3UWriter.write(context, new File(Environment.getExternalStorageDirectory(), "Playlists"), playlist);
}
}
|
Xorok/Phonograph
|
app/src/main/java/com/kabouzeid/gramophone/util/PlaylistsUtil.java
|
Java
|
gpl-3.0
| 9,999 |
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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 3 of the License, or
(at your option) any later version.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "MatrixBlock.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Form, class Type>
inline Foam::Matrix<Form, Type>::Matrix()
:
mRows_(0),
nCols_(0),
v_(nullptr)
{}
template<class Form, class Type>
inline Foam::autoPtr<Foam::Matrix<Form, Type>> Foam::Matrix<Form, Type>::
clone() const
{
return autoPtr<Matrix<Form, Type>>(new Matrix<Form, Type>(*this));
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Form, class Type>
inline const Foam::Matrix<Form, Type>& Foam::Matrix<Form, Type>::null()
{
return NullObjectRef<Matrix<Form, Type>>();
}
template<class Form, class Type>
inline Foam::label Foam::Matrix<Form, Type>::m() const
{
return mRows_;
}
template<class Form, class Type>
inline Foam::label Foam::Matrix<Form, Type>::n() const
{
return nCols_;
}
template<class Form, class Type>
inline Foam::label Foam::Matrix<Form, Type>::size() const
{
return mRows_*nCols_;
}
template<class Form, class Type>
inline void Foam::Matrix<Form, Type>::checki(const label i) const
{
#ifdef FULLDEBUG
if (!mRows_ || !nCols_)
{
FatalErrorInFunction
<< "Attempt to access element from empty matrix"
<< abort(FatalError);
}
else if (i<0 || i>=mRows_)
{
FatalErrorInFunction
<< "Index " << i << " out of range 0 ... " << mRows_-1
<< abort(FatalError);
}
#endif
}
template<class Form, class Type>
inline void Foam::Matrix<Form, Type>::checkj(const label j) const
{
#ifdef FULLDEBUG
if (!mRows_ || !nCols_)
{
FatalErrorInFunction
<< "Attempt to access element from empty matrix"
<< abort(FatalError);
}
else if (j<0 || j>=nCols_)
{
FatalErrorInFunction
<< "index " << j << " out of range 0 ... " << nCols_-1
<< abort(FatalError);
}
#endif
}
template<class Form, class Type>
inline const Type* Foam::Matrix<Form, Type>::v() const
{
return v_;
}
template<class Form, class Type>
inline Type* Foam::Matrix<Form, Type>::v()
{
return v_;
}
template<class Form, class Type>
inline Foam::ConstMatrixBlock<Foam::Matrix<Form, Type>>
Foam::Matrix<Form, Type>::block
(
const label m,
const label n,
const label mStart,
const label nStart
) const
{
return ConstMatrixBlock<mType>
(
*this,
m,
n,
mStart,
nStart
);
}
template<class Form, class Type>
template<class VectorSpace>
inline Foam::ConstMatrixBlock<Foam::Matrix<Form, Type>>
Foam::Matrix<Form, Type>::block
(
const label mStart,
const label nStart
) const
{
return ConstMatrixBlock<mType>
(
*this,
VectorSpace::mRows,
VectorSpace::nCols,
mStart,
nStart
);
}
template<class Form, class Type>
inline Foam::ConstMatrixBlock<Foam::Matrix<Form, Type>>
Foam::Matrix<Form, Type>::col
(
const label m,
const label mStart
) const
{
return ConstMatrixBlock<mType>
(
*this,
m,
1,
mStart,
0
);
}
template<class Form, class Type>
inline Foam::ConstMatrixBlock<Foam::Matrix<Form, Type>>
Foam::Matrix<Form, Type>::col
(
const label m,
const label mStart,
const label nStart
) const
{
return ConstMatrixBlock<mType>
(
*this,
m,
1,
mStart,
nStart
);
}
template<class Form, class Type>
inline Foam::MatrixBlock<Foam::Matrix<Form, Type>>
Foam::Matrix<Form, Type>::block
(
const label m,
const label n,
const label mStart,
const label nStart
)
{
return MatrixBlock<mType>
(
*this,
m,
n,
mStart,
nStart
);
}
template<class Form, class Type>
template<class VectorSpace>
inline Foam::MatrixBlock<Foam::Matrix<Form, Type>>
Foam::Matrix<Form, Type>::block(const label mStart, const label nStart)
{
return MatrixBlock<mType>
(
*this,
VectorSpace::mRows,
VectorSpace::nCols,
mStart,
nStart
);
}
template<class Form, class Type>
inline Foam::MatrixBlock<Foam::Matrix<Form, Type>>
Foam::Matrix<Form, Type>::col(const label m, const label mStart)
{
return MatrixBlock<mType>
(
*this,
m,
1,
mStart,
0
);
}
template<class Form, class Type>
inline Foam::MatrixBlock<Foam::Matrix<Form, Type>>
Foam::Matrix<Form, Type>::col
(
const label m,
const label mStart,
const label nStart
)
{
return MatrixBlock<mType>
(
*this,
m,
1,
mStart,
nStart
);
}
template<class Form, class Type>
void Foam::Matrix<Form, Type>::shallowResize(const label m, const label n)
{
mRows_ = m;
nCols_ = n;
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class Form, class Type>
inline const Type& Foam::Matrix<Form, Type>::operator()
(
const label i,
const label j
) const
{
checki(i);
checkj(j);
return v_[i*nCols_ + j];
}
template<class Form, class Type>
inline Type& Foam::Matrix<Form, Type>::operator()
(
const label i,
const label j
)
{
checki(i);
checkj(j);
return v_[i*nCols_ + j];
}
template<class Form, class Type>
inline const Type* Foam::Matrix<Form, Type>::operator[](const label i) const
{
checki(i);
return v_ + i*nCols_;
}
template<class Form, class Type>
inline Type* Foam::Matrix<Form, Type>::operator[](const label i)
{
checki(i);
return v_ + i*nCols_;
}
// ************************************************************************* //
|
CONSELF/conselfcae-dev
|
src/OpenFOAM/matrices/Matrix/MatrixI.H
|
C++
|
gpl-3.0
| 6,857 |
#region Copyright & License Information
/*
* Copyright 2007-2019 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using OpenRA.Graphics;
using OpenRA.Primitives;
namespace OpenRA.Traits
{
[Desc("Add this to the World actor definition.")]
public class FixedColorPaletteInfo : ITraitInfo
{
[Desc("The name of the palette to base off.")]
[PaletteReference] public readonly string Base = TileSet.TerrainPaletteInternalName;
[Desc("The name of the resulting palette")]
[PaletteDefinition] public readonly string Name = "resources";
[Desc("Remap these indices to pre-defined colors.")]
public readonly int[] RemapIndex = { };
[Desc("The fixed color to remap.")]
public readonly Color Color;
[Desc("Luminosity range to span.")]
public readonly float Ramp = 0.05f;
[Desc("Allow palette modifiers to change the palette.")]
public readonly bool AllowModifiers = true;
public object Create(ActorInitializer init) { return new FixedColorPalette(this); }
}
public class FixedColorPalette : ILoadsPalettes
{
readonly FixedColorPaletteInfo info;
public FixedColorPalette(FixedColorPaletteInfo info)
{
this.info = info;
}
public void LoadPalettes(WorldRenderer wr)
{
var remap = new PlayerColorRemap(info.RemapIndex, info.Color, info.Ramp);
wr.AddPalette(info.Name, new ImmutablePalette(wr.Palette(info.Base).Palette, remap), info.AllowModifiers);
}
}
}
|
WolfGaming/OpenRA
|
OpenRA.Game/Traits/Player/FixedColorPalette.cs
|
C#
|
gpl-3.0
| 1,707 |
/*
* Name: MG 2a
* Termcap keyboard driver using key files
* Created: 22-Nov-1987 Mic Kaczmarczik ([email protected])
*/
#include "def.h"
#ifdef XKEYS
/*
* Get keyboard character. Very simple if you use keymaps and keys files.
* Bob was right -- the old XKEYS code is not the right solution.
* FKEYS code is not usefull other than to help debug FKEYS code in
* extend.c.
*/
#ifdef FKEYS
char *keystrings[] = { NULL } ;
#endif
/*
* Turn on function keys using KS, then load a keys file, if available.
* The keys file is located in the same manner as the startup file is,
* depending on what startupfile() does on your system.
*/
extern int ttputc();
ttykeymapinit()
{
extern char *KS;
#ifndef NO_STARTUP
char *cp, *startupfile();
if (cp = gettermtype()) {
if (((cp = startupfile(cp)) != NULL)
&& (load(cp) != TRUE))
ewprintf("Error reading key initialization file");
}
#endif
if (KS && *KS) /* turn on keypad */
putpad(KS, 1);
}
/*
* Clean up the keyboard -- called by tttidy()
*/
ttykeymaptidy()
{
extern char *KE;
if (KE && *KE)
putpad(KE, 1); /* turn off keypad */
}
#endif
|
axelmuhr/Helios-NG
|
cmds/public/misc/MG/ttykbd.c
|
C
|
gpl-3.0
| 1,128 |
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-cen-xr-w32-bld/build/js/jetpack/nsIJetpack.idl
*/
#ifndef __gen_nsIJetpack_h__
#define __gen_nsIJetpack_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIVariant; /* forward declaration */
/* starting interface: nsIJetpack */
#define NS_IJETPACK_IID_STR "61a5be65-faf2-4fd1-96df-b13a7ad7d88d"
#define NS_IJETPACK_IID \
{0x61a5be65, 0xfaf2, 0x4fd1, \
{ 0x96, 0xdf, 0xb1, 0x3a, 0x7a, 0xd7, 0xd8, 0x8d }}
class NS_NO_VTABLE NS_SCRIPTABLE nsIJetpack : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IJETPACK_IID)
/* void sendMessage (in AString aMessageName); */
NS_SCRIPTABLE NS_IMETHOD SendMessage(const nsAString & aMessageName) = 0;
/* void registerReceiver (in AString aMessageName, in jsval aReceiver); */
NS_SCRIPTABLE NS_IMETHOD RegisterReceiver(const nsAString & aMessageName, const jsval & aReceiver) = 0;
/* void unregisterReceiver (in AString aMessageName, in jsval aReceiver); */
NS_SCRIPTABLE NS_IMETHOD UnregisterReceiver(const nsAString & aMessageName, const jsval & aReceiver) = 0;
/* void unregisterReceivers (in AString aMessageName); */
NS_SCRIPTABLE NS_IMETHOD UnregisterReceivers(const nsAString & aMessageName) = 0;
/* void evalScript (in AString aScript); */
NS_SCRIPTABLE NS_IMETHOD EvalScript(const nsAString & aScript) = 0;
/* nsIVariant createHandle (); */
NS_SCRIPTABLE NS_IMETHOD CreateHandle(nsIVariant **_retval NS_OUTPARAM) = 0;
/* void destroy (); */
NS_SCRIPTABLE NS_IMETHOD Destroy(void) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIJetpack, NS_IJETPACK_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIJETPACK \
NS_SCRIPTABLE NS_IMETHOD SendMessage(const nsAString & aMessageName); \
NS_SCRIPTABLE NS_IMETHOD RegisterReceiver(const nsAString & aMessageName, const jsval & aReceiver); \
NS_SCRIPTABLE NS_IMETHOD UnregisterReceiver(const nsAString & aMessageName, const jsval & aReceiver); \
NS_SCRIPTABLE NS_IMETHOD UnregisterReceivers(const nsAString & aMessageName); \
NS_SCRIPTABLE NS_IMETHOD EvalScript(const nsAString & aScript); \
NS_SCRIPTABLE NS_IMETHOD CreateHandle(nsIVariant **_retval NS_OUTPARAM); \
NS_SCRIPTABLE NS_IMETHOD Destroy(void);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIJETPACK(_to) \
NS_SCRIPTABLE NS_IMETHOD SendMessage(const nsAString & aMessageName) { return _to SendMessage(aMessageName); } \
NS_SCRIPTABLE NS_IMETHOD RegisterReceiver(const nsAString & aMessageName, const jsval & aReceiver) { return _to RegisterReceiver(aMessageName, aReceiver); } \
NS_SCRIPTABLE NS_IMETHOD UnregisterReceiver(const nsAString & aMessageName, const jsval & aReceiver) { return _to UnregisterReceiver(aMessageName, aReceiver); } \
NS_SCRIPTABLE NS_IMETHOD UnregisterReceivers(const nsAString & aMessageName) { return _to UnregisterReceivers(aMessageName); } \
NS_SCRIPTABLE NS_IMETHOD EvalScript(const nsAString & aScript) { return _to EvalScript(aScript); } \
NS_SCRIPTABLE NS_IMETHOD CreateHandle(nsIVariant **_retval NS_OUTPARAM) { return _to CreateHandle(_retval); } \
NS_SCRIPTABLE NS_IMETHOD Destroy(void) { return _to Destroy(); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIJETPACK(_to) \
NS_SCRIPTABLE NS_IMETHOD SendMessage(const nsAString & aMessageName) { return !_to ? NS_ERROR_NULL_POINTER : _to->SendMessage(aMessageName); } \
NS_SCRIPTABLE NS_IMETHOD RegisterReceiver(const nsAString & aMessageName, const jsval & aReceiver) { return !_to ? NS_ERROR_NULL_POINTER : _to->RegisterReceiver(aMessageName, aReceiver); } \
NS_SCRIPTABLE NS_IMETHOD UnregisterReceiver(const nsAString & aMessageName, const jsval & aReceiver) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterReceiver(aMessageName, aReceiver); } \
NS_SCRIPTABLE NS_IMETHOD UnregisterReceivers(const nsAString & aMessageName) { return !_to ? NS_ERROR_NULL_POINTER : _to->UnregisterReceivers(aMessageName); } \
NS_SCRIPTABLE NS_IMETHOD EvalScript(const nsAString & aScript) { return !_to ? NS_ERROR_NULL_POINTER : _to->EvalScript(aScript); } \
NS_SCRIPTABLE NS_IMETHOD CreateHandle(nsIVariant **_retval NS_OUTPARAM) { return !_to ? NS_ERROR_NULL_POINTER : _to->CreateHandle(_retval); } \
NS_SCRIPTABLE NS_IMETHOD Destroy(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Destroy(); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsJetpack : public nsIJetpack
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIJETPACK
nsJetpack();
private:
~nsJetpack();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsJetpack, nsIJetpack)
nsJetpack::nsJetpack()
{
/* member initializers and constructor code */
}
nsJetpack::~nsJetpack()
{
/* destructor code */
}
/* void sendMessage (in AString aMessageName); */
NS_IMETHODIMP nsJetpack::SendMessage(const nsAString & aMessageName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void registerReceiver (in AString aMessageName, in jsval aReceiver); */
NS_IMETHODIMP nsJetpack::RegisterReceiver(const nsAString & aMessageName, const jsval & aReceiver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void unregisterReceiver (in AString aMessageName, in jsval aReceiver); */
NS_IMETHODIMP nsJetpack::UnregisterReceiver(const nsAString & aMessageName, const jsval & aReceiver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void unregisterReceivers (in AString aMessageName); */
NS_IMETHODIMP nsJetpack::UnregisterReceivers(const nsAString & aMessageName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void evalScript (in AString aScript); */
NS_IMETHODIMP nsJetpack::EvalScript(const nsAString & aScript)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIVariant createHandle (); */
NS_IMETHODIMP nsJetpack::CreateHandle(nsIVariant **_retval NS_OUTPARAM)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void destroy (); */
NS_IMETHODIMP nsJetpack::Destroy()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIJetpack_h__ */
|
DragonZX/fdm
|
Gecko.SDK/2.0/include/nsIJetpack.h
|
C
|
gpl-3.0
| 6,585 |
#include "KinematicTools.h"
#include "../Globals.h"
#include <iostream>
Matrix RotX(double angle){
Matrix result = Matrix(4,4,false);
double sinA = sin(angle);
double cosA = cos(angle);
result[0][0] = 1.0;
result[0][1] = 0;
result[0][2] = 0;
result[0][3] = 0;
result[1][0] = 0;
result[1][1] = cosA;
result[1][2] = -sinA;
result[1][3] = 0;
result[2][0] = 0;
result[2][1] = sinA;
result[2][2] = cosA;
result[2][3] = 0;
result[3][0] = 0;
result[3][1] = 0;
result[3][2] = 0;
result[3][3] = 1;
return result;
}
Matrix RotY(double angle){
Matrix result = Matrix(4,4,false);
double sinA = sin(angle);
double cosA = cos(angle);
result[0][0] = cosA;
result[0][1] = 0;
result[0][2] = sinA;
result[0][3] = 0;
result[1][0] = 0.0;
result[1][1] = 1.0;
result[1][2] = 0.0;
result[1][3] = 0.0;
result[2][0] = -sinA;
result[2][1] = 0.0;
result[2][2] = cosA;
result[2][3] = 0.0;
result[3][0] = 0.0;
result[3][1] = 0.0;
result[3][2] = 0.0;
result[3][3] = 1.0;
return result;
}
Matrix RotZ(double angle){
Matrix result = Matrix(4,4,false);
double sinA = sin(angle);
double cosA = cos(angle);
result[0][0] = cosA;
result[0][1] = -sinA;
result[0][2] = 0.0;
result[0][3] = 0.0;
result[1][0] = sinA;
result[1][1] = cosA;
result[1][2] = 0.0;
result[1][3] = 0.0;
result[2][0] = 0.0;
result[2][1] = 0.0;
result[2][2] = 1.0;
result[2][3] = 0.0;
result[3][0] = 0.0;
result[3][1] = 0.0;
result[3][2] = 0.0;
result[3][3] = 1.0;
return result;
}
Matrix Translation(double dx, double dy, double dz){
Matrix result = Matrix(4,4);
result[0][0] = 1.0;
result[0][1] = 0.0;
result[0][2] = 0.0;
result[0][3] = dx;
result[1][0] = 0.0;
result[1][1] = 1.0;
result[1][2] = 0.0;
result[1][3] = dy;
result[2][0] = 0.0;
result[2][1] = 0.0;
result[2][2] = 1.0;
result[2][3] = dz;
result[3][0] = 0.0;
result[3][1] = 0.0;
result[3][2] = 0.0;
result[3][3] = 1.0;
return result;
}
Matrix ModifiedDH(double alpha, double a, double theta, double d){
Matrix result = Matrix(4,4);
//[ cos(theta), -sin(theta), 0, a]
//[ cos(alpha)*sin(theta), cos(alpha)*cos(theta), -sin(alpha), -d*sin(alpha)]
//[ sin(alpha)*sin(theta), sin(alpha)*cos(theta), cos(alpha), d*cos(alpha)]
//[ 0, 0, 0, 1]
using namespace std;
double st = sin(theta);
double ct = cos(theta);
double sa = sin(alpha);
double ca = cos(alpha);
// Row 0
result[0][0] = ct;
result[0][1] = -st;
result[0][2] = 0.0;
result[0][3] = a;
// Row 1
result[1][0] = ca*st;
result[1][1] = ca*ct;
result[1][2] = -sa;
result[1][3] = -d*sa;
// Row 2
result[2][0] = sa*st;
result[2][1] = sa*ct;
result[2][2] = ca;
result[2][3] = d*ca;
// Row 3
result[3][0] = 0.0;
result[3][1] = 0.0;
result[3][2] = 0.0;
result[3][3] = 1.0;
return result;
}
|
nianxing/naowalkoptimiser
|
src/Kinematics/KinematicTools.cpp
|
C++
|
gpl-3.0
| 2,965 |
/*
* Copyright (C) 2005-2011 MaNGOS <http://www.getmangos.com/>
*
* Copyright (C) 2008-2011 Trinity <http://www.trinitycore.org/>
*
* Copyright (C) 2010-2011 Project SkyFire <http://www.projectskyfire.org/>
*
* 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
*/
#include "gamePCH.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Creature.h"
#include "GameObject.h"
#include "DynamicObject.h"
#include "Vehicle.h"
#include "WorldPacket.h"
#include "Item.h"
#include "Corpse.h"
#include "GridNotifiers.h"
#include "MapManager.h"
#include "Map.h"
#include "CellImpl.h"
#include "GridNotifiersImpl.h"
#include "Opcodes.h"
#include "ObjectDefines.h"
#include "MapInstanced.h"
#include "World.h"
#include <cmath>
ObjectAccessor::ObjectAccessor()
{
}
ObjectAccessor::~ObjectAccessor()
{
for (Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
{
itr->second->RemoveFromWorld();
delete itr->second;
}
}
WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, uint64 guid)
{
switch (GUID_HIPART(guid))
{
case HIGHGUID_PLAYER: return GetPlayer(p, guid);
case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_GAMEOBJECT: return GetGameObject(p, guid);
case HIGHGUID_VEHICLE:
case HIGHGUID_UNIT: return GetCreature(p, guid);
case HIGHGUID_PET: return GetPet(p, guid);
case HIGHGUID_DYNAMICOBJECT: return GetDynamicObject(p, guid);
case HIGHGUID_CORPSE: return GetCorpse(p,guid);
default: return NULL;
}
}
Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, uint64 guid, uint32 typemask)
{
switch (GUID_HIPART(guid))
{
case HIGHGUID_ITEM:
if (typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER)
return ((Player const&)p).GetItemByGuid(guid);
break;
case HIGHGUID_PLAYER:
if (typemask & TYPEMASK_PLAYER)
return GetPlayer(p, guid);
break;
case HIGHGUID_TRANSPORT:
case HIGHGUID_MO_TRANSPORT:
case HIGHGUID_GAMEOBJECT:
if (typemask & TYPEMASK_GAMEOBJECT)
return GetGameObject(p, guid);
break;
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
if (typemask & TYPEMASK_UNIT)
return GetCreature(p, guid);
break;
case HIGHGUID_PET:
if (typemask & TYPEMASK_UNIT)
return GetPet(p, guid);
break;
case HIGHGUID_DYNAMICOBJECT:
if (typemask & TYPEMASK_DYNAMICOBJECT)
return GetDynamicObject(p, guid);
break;
case HIGHGUID_CORPSE:
break;
}
return NULL;
}
Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, uint64 guid)
{
return GetObjectInMap(guid, u.GetMap(), (Corpse*)NULL);
}
GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, uint64 guid)
{
return GetObjectInMap(guid, u.GetMap(), (GameObject*)NULL);
}
DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, uint64 guid)
{
return GetObjectInMap(guid, u.GetMap(), (DynamicObject*)NULL);
}
Unit* ObjectAccessor::GetUnit(WorldObject const& u, uint64 guid)
{
return GetObjectInMap(guid, u.GetMap(), (Unit*)NULL);
}
Creature* ObjectAccessor::GetCreature(WorldObject const& u, uint64 guid)
{
return GetObjectInMap(guid, u.GetMap(), (Creature*)NULL);
}
Pet* ObjectAccessor::GetPet(WorldObject const& u, uint64 guid)
{
return GetObjectInMap(guid, u.GetMap(), (Pet*)NULL);
}
Player* ObjectAccessor::GetPlayer(WorldObject const& u, uint64 guid)
{
return GetObjectInMap(guid, u.GetMap(), (Player*)NULL);
}
Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, uint64 guid)
{
if (IS_PET_GUID(guid))
return GetPet(u, guid);
if (IS_CRE_OR_VEH_GUID(guid))
return GetCreature(u, guid);
return NULL;
}
Pet* ObjectAccessor::FindPet(uint64 guid)
{
return GetObjectInWorld(guid, (Pet*)NULL);
}
Player* ObjectAccessor::FindPlayer(uint64 guid)
{
return GetObjectInWorld(guid, (Player*)NULL);
}
Unit* ObjectAccessor::FindUnit(uint64 guid)
{
return GetObjectInWorld(guid, (Unit*)NULL);
}
Player* ObjectAccessor::FindPlayerByName(const char* name)
{
ACE_GUARD_RETURN(LockType, g, *HashMapHolder<Player>::GetLock(), NULL);
HashMapHolder<Player>::MapType& m = HashMapHolder<Player>::GetContainer();
for (HashMapHolder<Player>::MapType::iterator iter = m.begin(); iter != m.end(); ++iter)
if (iter->second->IsInWorld() && strcmp(name, iter->second->GetName()) == 0)
return iter->second;
return NULL;
}
void ObjectAccessor::SaveAllPlayers()
{
ACE_GUARD(LockType, g, *HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType& m = HashMapHolder<Player>::GetContainer();
for (HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
itr->second->SaveToDB();
}
Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid)
{
ACE_GUARD_RETURN(LockType, guard, i_corpseGuard, NULL);
Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid);
if (iter == i_player2corpse.end())
return NULL;
ASSERT(iter->second->GetType() != CORPSE_BONES);
return iter->second;
}
void ObjectAccessor::RemoveCorpse(Corpse* corpse)
{
ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
if (corpse->FindMap())
corpse->FindMap()->Remove(corpse, false);
else
corpse->RemoveFromWorld();
// Critical section
{
ACE_GUARD(LockType, g, i_corpseGuard);
Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID());
if (iter == i_player2corpse.end()) // TODO: Fix this
return;
// build mapid*cellid -> guid_set map
CellPair cell_pair = Trinity::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY());
uint32 cell_id = (cell_pair.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
sObjectMgr.DeleteCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID()));
i_player2corpse.erase(iter);
}
}
void ObjectAccessor::AddCorpse(Corpse* corpse)
{
ASSERT(corpse && corpse->GetType() != CORPSE_BONES);
// Critical section
{
ACE_GUARD(LockType, g, i_corpseGuard);
ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end());
i_player2corpse[corpse->GetOwnerGUID()] = corpse;
// build mapid*cellid -> guid_set map
CellPair cell_pair = Trinity::ComputeCellPair(corpse->GetPositionX(), corpse->GetPositionY());
uint32 cell_id = (cell_pair.y_coord * TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
sObjectMgr.AddCorpseCellData(corpse->GetMapId(), cell_id, GUID_LOPART(corpse->GetOwnerGUID()), corpse->GetInstanceId());
}
}
void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid, Map* map)
{
ACE_GUARD(LockType, g, i_corpseGuard);
for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter)
{
if (iter->second->GetGrid() == gridpair)
{
// verify, if the corpse in our instance (add only corpses which are)
if (map->Instanceable())
{
if (iter->second->GetInstanceId() == map->GetInstanceId())
grid.AddWorldObject(iter->second);
}
else
grid.AddWorldObject(iter->second);
}
}
}
Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool /*insignia*/)
{
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
if (!corpse)
{
//in fact this function is called from several places
//even when player doesn't have a corpse, not an error
// TODO: really, now...
//sLog.outError("Try remove corpse that not in map for GUID %ul", player_guid);
return NULL;
}
sLog.outStaticDebug("Deleting Corpse and spawned bones.");
//Map* map = corpse->FindMap();
// remove corpse from player_guid -> corpse map
RemoveCorpse(corpse);
// done in removecorpse
// remove resurrectable corpse from grid object registry (loaded state checked into call)
// do not load the map if it's not loaded
//Map *map = sMapMgr.FindMap(corpse->GetMapId(), corpse->GetInstanceId());
//if (map)
// map->Remove(corpse, false);
// remove corpse from DB
SQLTransaction trans = CharacterDatabase.BeginTransaction();
corpse->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
// we don't want bones to save some cpu.. :)
delete corpse;
return NULL;
/*
Corpse* bones = NULL;
// create the bones only if the map and the grid is loaded at the corpse's location
// ignore bones creating option in case insignia
if (map && (insignia ||
(map->IsBattlegroundOrArena() ? sWorld.getIntConfig(CONFIG_DEATH_BONES_BG_OR_ARENA) : sWorld.getIntConfig(CONFIG_DEATH_BONES_WORLD))) &&
!map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY()))
{
// Create bones, don't change Corpse
bones = new Corpse;
bones->Create(corpse->GetGUIDLow(), map);
for (int i = 3; i < CORPSE_END; ++i) // don't overwrite guid and object type
bones->SetUInt32Value(i, corpse->GetUInt32Value(i));
bones->SetGrid(corpse->GetGrid());
// bones->m_time = m_time; // don't overwrite time
// bones->m_inWorld = m_inWorld; // don't overwrite in-world state
// bones->m_type = m_type; // don't overwrite type
bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
bones->SetPhaseMask(corpse->GetPhaseMask(), false);
bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES);
bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0);
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
}
// add bones in grid store if grid loaded where corpse placed
map->Add(bones);
}
// all references to the corpse should be removed at this point
delete corpse;
return bones;
*/
}
void ObjectAccessor::RemoveOldCorpses()
{
time_t now = time(NULL);
Player2CorpsesMapType::iterator next;
for (Player2CorpsesMapType::iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); itr = next)
{
next = itr;
++next;
if (!itr->second->IsExpired(now))
continue;
ConvertCorpseForPlayer(itr->first);
}
}
void ObjectAccessor::Update(uint32 /*diff*/)
{
UpdateDataMapType update_players;
// Critical section
{
ACE_GUARD(LockType, g, i_updateGuard);
while (!i_objects.empty())
{
Object* obj = *i_objects.begin();
ASSERT(obj && obj->IsInWorld());
i_objects.erase(i_objects.begin());
obj->BuildUpdate(update_players);
}
}
WorldPacket packet; // here we allocate a std::vector with a size of 0x10000
for (UpdateDataMapType::iterator iter = update_players.begin(); iter != update_players.end(); ++iter)
{
iter->second.BuildPacket(&packet);
iter->first->GetSession()->SendPacket(&packet);
packet.clear(); // clean the string
}
}
/// Define the static members of HashMapHolder
template <class T> UNORDERED_MAP< uint64, T* > HashMapHolder<T>::m_objectMap;
template <class T> ACE_Thread_Mutex HashMapHolder<T>::i_lock;
/// Global definitions for the hashmap storage
template class HashMapHolder<Player>;
template class HashMapHolder<Pet>;
template class HashMapHolder<GameObject>;
template class HashMapHolder<DynamicObject>;
template class HashMapHolder<Creature>;
template class HashMapHolder<Corpse>;
template Player* ObjectAccessor::GetObjectInWorld<Player>(uint32 mapid, float x, float y, uint64 guid, Player* /*fake*/);
template Pet* ObjectAccessor::GetObjectInWorld<Pet>(uint32 mapid, float x, float y, uint64 guid, Pet* /*fake*/);
template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, float x, float y, uint64 guid, Creature* /*fake*/);
template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, uint64 guid, Corpse* /*fake*/);
template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, uint64 guid, GameObject* /*fake*/);
template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/);
|
BuloZB/SkyFireEMU
|
src/server/game/Globals/ObjectAccessor.cpp
|
C++
|
gpl-3.0
| 13,854 |
/*
Hotel Receptionist - Sleepywood Hotel(105040400)
*/
var status = 0;
var regcost = 499;
var vipcost = 999;
var tempvar;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1)
status++; if (mode == 0 && status == 1) {
cm.dispose();
return;
} if (mode == 0 && status == 2) {
cm.sendNext("We offer other kinds of services, too, so please think carefully and then make your decision.");
cm.dispose();
return;
}
if (status == 0) {
cm.sendNext("Welcome. We're the Sleepywood Hotel. Our hotel works hard to serve you the best at all times. If you are tired and worn out from hunting, how about a relaxing stay at our hotel?");
}
if (status == 1) {
cm.sendSimple("We offer two kinds of rooms for our service. Please choose the one of your liking.\r\n#b#L0#Regular sauna (" + regcost + " mesos per use)#l\r\n#L1#VIP sauna (" + vipcost + "mesos per use)#l");
}
if (status == 2) {
tempvar = selection;
if (tempvar == 0) {
cm.sendYesNo("You have chosen the regular sauna. Your HP and MP will recover fast and you can even purchase some items there. Are you sure you want to go in?");
}
if (tempvar == 1) {
cm.sendYesNo("You've chosen the VIP sauna. Your HP and MP will recover even faster than that of the regular sauna and you can even find a special item in there. Are you sure you want to go in?");
}
}
if (status == 3) {
if (tempvar == 0) {
if (cm.getMeso() >= regcost) {
cm.warp(105000011);
cm.gainMeso(-regcost);
} else {
cm.sendNext("I'm sorry. It looks like you don't have enough mesos. It will cost you at least " + regcost + "mesos to stay at our hotel.");
}
} if (tempvar == 1) {
if (cm.getMeso() >= vipcost) {
cm.warp(105000012);
cm.gainMeso(-vipcost);
} else {
cm.sendNext("I'm sorry. It looks like you don't have enough mesos. It will cost you at least " + regcost + "mesos to stay at our hotel.");
}
}
cm.dispose();
}
}
|
Maxcloud/Mushy
|
scripts/npc/1061100.js
|
JavaScript
|
gpl-3.0
| 2,002 |
<?php
$extras = '';
if (!empty($css_class)) $extras = ' class="' . $css_class . '"';
if (!empty($css_id)) $extras = ' id="' . $css_id . '"';
?>
<<?php echo $tag;?><?php echo $extras;?>><?php echo do_shortcode($content); ?></<?php echo $tag;?>>
|
Cohaerentis/cohaerentis_web
|
wp-content/mu-plugins/base/templates/shortcode-featured.php
|
PHP
|
gpl-3.0
| 259 |
<?php
/**
* Pedro Teixeira
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL).
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @category PedroTeixeira
* @package PedroTeixeira_Correios
* @copyright Copyright (c) 2010 Pedro Teixeira (http://www.pteixeira.com.br)
* @author Pedro Teixeira <[email protected]>
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class PedroTeixeira_Correios_Model_Source_UrlMethods
{
public function toOptionArray()
{
return array(
array('value'=>1, 'label'=>Mage::helper('adminhtml')->__('Locaweb')),
array('value'=>0, 'label'=>Mage::helper('adminhtml')->__('Correios')),
);
}
}
|
bergerrc/magento-mods
|
app/code/local/PedroTeixeira/Correios/Model/Source/UrlMethods.php
|
PHP
|
gpl-3.0
| 864 |
/***************************************************************************
texture.c - description
-------------------
begin : Sun Mar 08 2009
copyright : (C) 1999-2009 by Pete Bernert
web : www.pbernert.com
***************************************************************************/
/***************************************************************************
* *
* 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. See also the license.txt file for *
* additional informations. *
* *
***************************************************************************/
#include "stdafx.h"
////////////////////////////////////////////////////////////////////////////////////
// Texture related functions are here !
//
// The texture handling is heart and soul of this gpu. The plugin was developed
// 1999, by this time no shaders were available. Since the psx gpu is making
// heavy use of CLUT (="color lookup tables", aka palettized textures), it was
// an interesting task to get those emulated at good speed on NV TNT cards
// (which was my major goal when I created the first "gpuPeteTNT"). Later cards
// (Geforce256) supported texture palettes by an OGL extension, but at some point
// this support was dropped again by gfx card vendors.
// Well, at least there is a certain advatage, if no texture palettes extension can
// be used: it is possible to modify the textures in any way, allowing "hi-res"
// textures and other tweaks.
//
// My main texture caching is kinda complex: the plugin is allocating "n" 256x256 textures,
// and it places small psx texture parts inside them. The plugin keeps track what
// part (with what palette) it had placed in which texture, so it can re-use this
// part again. The more ogl textures it can use, the better (of course the managing/
// searching will be slower, but everything is faster than uploading textures again
// and again to a gfx card). My first card (TNT1) had 16 MB Vram, and it worked
// well with many games, but I recommend nowadays 64 MB Vram to get a good speed.
//
// Sadly, there is also a second kind of texture cache needed, for "psx texture windows".
// Those are "repeated" textures, so a psx "texture window" needs to be put in
// a whole texture to use the GL_TEXTURE_WRAP_ features. This cache can get full very
// fast in games which are having an heavy "texture window" usage, like RRT4. As an
// alternative, this plugin can use the OGL "palette" extension on texture windows,
// if available. Nowadays also a fragment shader can easily be used to emulate
// texture wrapping in a texture atlas, so the main cache could hold the texture
// windows as well (that's what I am doing in the OGL2 plugin). But currently the
// OGL1 plugin is a "shader-free" zone, so heavy "texture window" games will cause
// much texture uploads.
//
// Some final advice: take care if you change things in here. I've removed my ASM
// handlers (they didn't cause much speed gain anyway) for readability/portability,
// but still the functions/data structures used here are easy to mess up. I guess it
// can be a pain in the ass to port the plugin to another byte order :)
//
////////////////////////////////////////////////////////////////////////////////////
#define _IN_TEXTURE
#include "externals.h"
#include "texture.h"
#include "gpu.h"
#include "prim.h"
#define CLUTCHK 0x00060000
#define CLUTSHIFT 17
////////////////////////////////////////////////////////////////////////
// texture conversion buffer ..
////////////////////////////////////////////////////////////////////////
int iHiResTextures=0;
GLubyte ubPaletteBuffer[256][4];
GLuint gTexMovieName=0;
GLuint gTexBlurName=0;
GLuint gTexFrameName=0;
int iTexGarbageCollection=1;
uint32_t dwTexPageComp=0;
int iVRamSize=0;
int iClampType=GL_CLAMP;
void (*LoadSubTexFn) (int,int,short,short);
uint32_t (*PalTexturedColourFn) (uint32_t);
////////////////////////////////////////////////////////////////////////
// defines
////////////////////////////////////////////////////////////////////////
#define PALCOL(x) PalTexturedColourFn (x)
#define CSUBSIZE 2048
#define CSUBSIZEA 8192
#define CSUBSIZES 4096
#define OFFA 0
#define OFFB 2048
#define OFFC 4096
#define OFFD 6144
#define XOFFA 0
#define XOFFB 512
#define XOFFC 1024
#define XOFFD 1536
#define SOFFA 0
#define SOFFB 1024
#define SOFFC 2048
#define SOFFD 3072
#define MAXWNDTEXCACHE 128
#define XCHECK(pos1,pos2) ((pos1.c[0]>=pos2.c[1])&&(pos1.c[1]<=pos2.c[0])&&(pos1.c[2]>=pos2.c[3])&&(pos1.c[3]<=pos2.c[2]))
#define INCHECK(pos2,pos1) ((pos1.c[0]<=pos2.c[0]) && (pos1.c[1]>=pos2.c[1]) && (pos1.c[2]<=pos2.c[2]) && (pos1.c[3]>=pos2.c[3]))
////////////////////////////////////////////////////////////////////////
unsigned char * CheckTextureInSubSCache(int TextureMode, uint32_t GivenClutId, unsigned short *pCache);
void LoadSubTexturePageSort(int pageid, int mode, short cx, short cy);
void LoadPackedSubTexturePageSort(int pageid, int mode, short cx, short cy);
void DefineSubTextureSort(void);
////////////////////////////////////////////////////////////////////////
// some globals
////////////////////////////////////////////////////////////////////////
GLint giWantedRGBA=4;
GLint giWantedFMT=GL_RGBA;
GLint giWantedTYPE=GL_UNSIGNED_BYTE;
int GlobalTexturePage;
GLint XTexS;
GLint YTexS;
GLint DXTexS;
GLint DYTexS;
int iSortTexCnt=32;
BOOL bUseFastMdec=FALSE;
BOOL bUse15bitMdec=FALSE;
int iFrameTexType=0;
int iFrameReadType=0;
int iLineHackMode=0;
uint32_t (*TCF[2]) (uint32_t);
unsigned short (*PTCF[2]) (unsigned short);
////////////////////////////////////////////////////////////////////////
// texture cache implementation
////////////////////////////////////////////////////////////////////////
#ifdef _WINDOWS
#pragma pack(1)
#endif
// "texture window" cache entry
typedef struct textureWndCacheEntryTag
{
uint32_t ClutID;
short pageid;
short textureMode;
short Opaque;
short used;
EXLong pos;
GLuint texname;
} textureWndCacheEntry;
// "standard texture" cache entry (12 byte per entry, as small as possible... we need lots of them)
typedef struct textureSubCacheEntryTagS
{
uint32_t ClutID;
EXLong pos;
unsigned char posTX;
unsigned char posTY;
unsigned char cTexID;
unsigned char Opaque;
} textureSubCacheEntryS;
#ifdef _WINDOWS
#pragma pack()
#endif
//---------------------------------------------
#define MAXTPAGES_MAX 64
#define MAXSORTTEX_MAX 196
//---------------------------------------------
textureWndCacheEntry wcWndtexStore[MAXWNDTEXCACHE];
textureSubCacheEntryS * pscSubtexStore[3][MAXTPAGES_MAX];
EXLong * pxSsubtexLeft [MAXSORTTEX_MAX];
GLuint uiStexturePage[MAXSORTTEX_MAX];
unsigned short usLRUTexPage = 0;
int iMaxTexWnds = 0;
int iTexWndTurn = 0;
int iTexWndLimit = MAXWNDTEXCACHE/2;
GLubyte * texturepart = NULL;
GLubyte * texturebuffer = NULL;
uint32_t g_x1,g_y1,g_x2,g_y2;
unsigned char ubOpaqueDraw = 0;
unsigned short MAXTPAGES = 32;
unsigned short CLUTMASK = 0x7fff;
unsigned short CLUTYMASK = 0x1ff;
unsigned short MAXSORTTEX = 196;
////////////////////////////////////////////////////////////////////////
// Texture color conversions... all my ASM funcs are removed for easier
// porting... and honestly: nowadays the speed gain would be pointless
////////////////////////////////////////////////////////////////////////
uint32_t XP8RGBA(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x50000000;
if(DrawSemiTrans && !(BGR&0x8000))
{ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);}
return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t XP8RGBAEx(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x03000000;
if(DrawSemiTrans && !(BGR&0x8000))
{ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);}
return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t CP8RGBA(uint32_t BGR)
{
uint32_t l;
if(!(BGR&0xffff)) return 0x50000000;
if(DrawSemiTrans && !(BGR&0x8000))
{ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);}
l=((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
if(l==0xffffff00) l=0xff000000;
return l;
}
uint32_t CP8RGBAEx(uint32_t BGR)
{
uint32_t l;
if(!(BGR&0xffff)) return 0x03000000;
if(DrawSemiTrans && !(BGR&0x8000))
{ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);}
l=((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
if(l==0xffffff00) l=0xff000000;
return l;
}
uint32_t XP8RGBA_0(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x50000000;
return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t XP8RGBAEx_0(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x03000000;
return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t XP8BGRA_0(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x50000000;
return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t XP8BGRAEx_0(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x03000000;
return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t CP8RGBA_0(uint32_t BGR)
{
uint32_t l;
if(!(BGR&0xffff)) return 0x50000000;
l=((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
if(l==0xfff8f800) l=0xff000000;
return l;
}
uint32_t CP8RGBAEx_0(uint32_t BGR)
{
uint32_t l;
if(!(BGR&0xffff)) return 0x03000000;
l=((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
if(l==0xfff8f800) l=0xff000000;
return l;
}
uint32_t CP8BGRA_0(uint32_t BGR)
{
uint32_t l;
if(!(BGR&0xffff)) return 0x50000000;
l=((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000;
if(l==0xff00f8f8) l=0xff000000;
return l;
}
uint32_t CP8BGRAEx_0(uint32_t BGR)
{
uint32_t l;
if(!(BGR&0xffff)) return 0x03000000;
l=((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000;
if(l==0xff00f8f8) l=0xff000000;
return l;
}
uint32_t XP8RGBA_1(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x50000000;
if(!(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);}
return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t XP8RGBAEx_1(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x03000000;
if(!(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff);}
return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t XP8BGRA_1(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x50000000;
if(!(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff);}
return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t XP8BGRAEx_1(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0x03000000;
if(!(BGR&0x8000)) {ubOpaqueDraw=1;return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff);}
return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t P8RGBA(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0;
return ((((BGR<<3)&0xf8)|((BGR<<6)&0xf800)|((BGR<<9)&0xf80000))&0xffffff)|0xff000000;
}
uint32_t P8BGRA(uint32_t BGR)
{
if(!(BGR&0xffff)) return 0;
return ((((BGR>>7)&0xf8)|((BGR<<6)&0xf800)|((BGR<<19)&0xf80000))&0xffffff)|0xff000000;
}
unsigned short XP5RGBA(unsigned short BGR)
{
if(!BGR) return 0;
if(DrawSemiTrans && !(BGR&0x8000))
{ubOpaqueDraw=1;return ((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)));}
return ((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)))|1;
}
unsigned short XP5RGBA_0 (unsigned short BGR)
{
if(!BGR) return 0;
return ((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)))|1;
}
unsigned short CP5RGBA_0 (unsigned short BGR)
{
unsigned short s;
if(!BGR) return 0;
s=((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)))|1;
if(s==0x07ff) s=1;
return s;
}
unsigned short XP5RGBA_1(unsigned short BGR)
{
if(!BGR) return 0;
if(!(BGR&0x8000))
{ubOpaqueDraw=1;return ((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)));}
return ((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)))|1;
}
unsigned short P5RGBA(unsigned short BGR)
{
if(!BGR) return 0;
return ((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)))|1;
}
unsigned short XP4RGBA(unsigned short BGR)
{
if(!BGR) return 6;
if(DrawSemiTrans && !(BGR&0x8000))
{ubOpaqueDraw=1;return ((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)));}
return (((((BGR&0x1e)<<11))|((BGR&0x7800)>>7)|((BGR&0x3c0)<<2)))|0xf;
}
unsigned short XP4RGBA_0 (unsigned short BGR)
{
if(!BGR) return 6;
return (((((BGR&0x1e)<<11))|((BGR&0x7800)>>7)|((BGR&0x3c0)<<2)))|0xf;
}
unsigned short CP4RGBA_0 (unsigned short BGR)
{
unsigned short s;
if(!BGR) return 6;
s=(((((BGR&0x1e)<<11))|((BGR&0x7800)>>7)|((BGR&0x3c0)<<2)))|0xf;
if(s==0x0fff) s=0x000f;
return s;
}
unsigned short XP4RGBA_1(unsigned short BGR)
{
if(!BGR) return 6;
if(!(BGR&0x8000))
{ubOpaqueDraw=1;return ((((BGR<<11))|((BGR>>9)&0x3e)|((BGR<<1)&0x7c0)));}
return (((((BGR&0x1e)<<11))|((BGR&0x7800)>>7)|((BGR&0x3c0)<<2)))|0xf;
}
unsigned short P4RGBA(unsigned short BGR)
{
if(!BGR) return 0;
return (((((BGR&0x1e)<<11))|((BGR&0x7800)>>7)|((BGR&0x3c0)<<2)))|0xf;
}
////////////////////////////////////////////////////////////////////////
// CHECK TEXTURE MEM (on plugin startup)
////////////////////////////////////////////////////////////////////////
int iFTexA=512;
int iFTexB=512;
void CheckTextureMemory(void)
{
GLboolean b;GLboolean * bDetail;
int i,iCnt,iRam=iVRamSize*1024*1024;
int iTSize;char * p;
if(iBlurBuffer)
{
char * p;
if(iResX>1024) iFTexA=2048;
else
if(iResX>512) iFTexA=1024;
else iFTexA=512;
if(iResY>1024) iFTexB=2048;
else
if(iResY>512) iFTexB=1024;
else iFTexB=512;
glGenTextures(1, &gTexBlurName);
gTexName=gTexBlurName;
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
p=(char *)malloc(iFTexA*iFTexB*4);
memset(p,0,iFTexA*iFTexB*4);
glTexImage2D(GL_TEXTURE_2D, 0, 3, iFTexA, iFTexB, 0, GL_RGB, GL_UNSIGNED_BYTE, p);
free(p);
glGetError();
iRam-=iFTexA*iFTexB*3;
iFTexA=(iResX*256)/iFTexA;
iFTexB=(iResY*256)/iFTexB;
}
if(iVRamSize)
{
int ts;
iRam-=(iResX*iResY*8);
iRam-=(iResX*iResY*(iZBufferDepth/8));
if(iTexQuality==0 || iTexQuality==3) ts=4;
else ts=2;
if(iHiResTextures)
iSortTexCnt=iRam/(512*512*ts);
else iSortTexCnt=iRam/(256*256*ts);
if(iSortTexCnt>MAXSORTTEX)
{
iSortTexCnt=MAXSORTTEX-min(1,iHiResTextures);
}
else
{
iSortTexCnt-=3+min(1,iHiResTextures);
if(iSortTexCnt<8) iSortTexCnt=8;
}
for(i=0;i<MAXSORTTEX;i++)
uiStexturePage[i]=0;
return;
}
if(iHiResTextures) iTSize=512;
else iTSize=256;
p=(char *)malloc(iTSize*iTSize*4);
iCnt=0;
glGenTextures(MAXSORTTEX,uiStexturePage);
for(i=0;i<MAXSORTTEX;i++)
{
glBindTexture(GL_TEXTURE_2D,uiStexturePage[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, giWantedRGBA, iTSize, iTSize, 0,GL_RGBA, giWantedTYPE, p);
}
glBindTexture(GL_TEXTURE_2D,0);
free(p);
bDetail=malloc(MAXSORTTEX*sizeof(GLboolean));
memset(bDetail,0,MAXSORTTEX*sizeof(GLboolean));
b=glAreTexturesResident(MAXSORTTEX,uiStexturePage,bDetail);
glDeleteTextures(MAXSORTTEX,uiStexturePage);
for(i=0;i<MAXSORTTEX;i++)
{
if(bDetail[i]) iCnt++;
uiStexturePage[i]=0;
}
free(bDetail);
if(b) iSortTexCnt=MAXSORTTEX-min(1,iHiResTextures);
else iSortTexCnt=iCnt-3+min(1,iHiResTextures); // place for menu&texwnd
if(iSortTexCnt<8) iSortTexCnt=8;
}
////////////////////////////////////////////////////////////////////////
// Main init of textures
////////////////////////////////////////////////////////////////////////
void InitializeTextureStore()
{
int i,j;
if(iGPUHeight==1024)
{
MAXTPAGES = 64;
CLUTMASK = 0xffff;
CLUTYMASK = 0x3ff;
MAXSORTTEX = 128;
iTexGarbageCollection=0;
}
else
{
MAXTPAGES = 32;
CLUTMASK = 0x7fff;
CLUTYMASK = 0x1ff;
MAXSORTTEX = 196;
}
memset(vertex,0,4*sizeof(OGLVertex)); // init vertices
gTexName=0; // init main tex name
iTexWndLimit=MAXWNDTEXCACHE;
if(!iUsePalTextures) iTexWndLimit/=2;
memset(wcWndtexStore,0,sizeof(textureWndCacheEntry)*
MAXWNDTEXCACHE);
texturepart=(GLubyte *)malloc(256*256*4);
memset(texturepart,0,256*256*4);
if(iHiResTextures)
texturebuffer=(GLubyte *)malloc(512*512*4);
else texturebuffer=NULL;
for(i=0;i<3;i++) // -> info for 32*3
for(j=0;j<MAXTPAGES;j++)
{
pscSubtexStore[i][j]=(textureSubCacheEntryS *)malloc(CSUBSIZES*sizeof(textureSubCacheEntryS));
memset(pscSubtexStore[i][j],0,CSUBSIZES*sizeof(textureSubCacheEntryS));
}
for(i=0;i<MAXSORTTEX;i++) // -> info 0..511
{
pxSsubtexLeft[i]=(EXLong *)malloc(CSUBSIZE*sizeof(EXLong));
memset(pxSsubtexLeft[i],0,CSUBSIZE*sizeof(EXLong));
uiStexturePage[i]=0;
}
}
////////////////////////////////////////////////////////////////////////
// Clean up on exit
////////////////////////////////////////////////////////////////////////
void CleanupTextureStore()
{
int i,j;textureWndCacheEntry * tsx;
//----------------------------------------------------//
glBindTexture(GL_TEXTURE_2D,0);
//----------------------------------------------------//
free(texturepart); // free tex part
texturepart=0;
if(texturebuffer)
{
free(texturebuffer);
texturebuffer=0;
}
//----------------------------------------------------//
tsx=wcWndtexStore; // loop tex window cache
for(i=0;i<MAXWNDTEXCACHE;i++,tsx++)
{
if(tsx->texname) // -> some tex?
glDeleteTextures(1,&tsx->texname); // --> delete it
}
iMaxTexWnds=0; // no more tex wnds
//----------------------------------------------------//
if(gTexMovieName!=0) // some movie tex?
glDeleteTextures(1, &gTexMovieName); // -> delete it
gTexMovieName=0; // no more movie tex
//----------------------------------------------------//
if(gTexFrameName!=0) // some 15bit framebuffer tex?
glDeleteTextures(1, &gTexFrameName); // -> delete it
gTexFrameName=0; // no more movie tex
//----------------------------------------------------//
if(gTexBlurName!=0) // some 15bit framebuffer tex?
glDeleteTextures(1, &gTexBlurName); // -> delete it
gTexBlurName=0; // no more movie tex
//----------------------------------------------------//
for(i=0;i<3;i++) // -> loop
for(j=0;j<MAXTPAGES;j++) // loop tex pages
{
free(pscSubtexStore[i][j]); // -> clean mem
}
for(i=0;i<MAXSORTTEX;i++)
{
if(uiStexturePage[i]) // --> tex used ?
{
glDeleteTextures(1,&uiStexturePage[i]);
uiStexturePage[i]=0; // --> delete it
}
free(pxSsubtexLeft[i]); // -> clean mem
}
//----------------------------------------------------//
}
////////////////////////////////////////////////////////////////////////
// Reset textures in game...
////////////////////////////////////////////////////////////////////////
void ResetTextureArea(BOOL bDelTex)
{
int i,j;textureSubCacheEntryS * tss;EXLong * lu;
textureWndCacheEntry * tsx;
//----------------------------------------------------//
dwTexPageComp=0;
//----------------------------------------------------//
if(bDelTex) {glBindTexture(GL_TEXTURE_2D,0);gTexName=0;}
//----------------------------------------------------//
tsx=wcWndtexStore;
for(i=0;i<MAXWNDTEXCACHE;i++,tsx++)
{
tsx->used=0;
if(bDelTex && tsx->texname)
{
glDeleteTextures(1,&tsx->texname);
tsx->texname=0;
}
}
iMaxTexWnds=0;
//----------------------------------------------------//
for(i=0;i<3;i++)
for(j=0;j<MAXTPAGES;j++)
{
tss=pscSubtexStore[i][j];
(tss+SOFFA)->pos.l=0;
(tss+SOFFB)->pos.l=0;
(tss+SOFFC)->pos.l=0;
(tss+SOFFD)->pos.l=0;
}
for(i=0;i<iSortTexCnt;i++)
{
lu=pxSsubtexLeft[i];
lu->l=0;
if(bDelTex && uiStexturePage[i])
{glDeleteTextures(1,&uiStexturePage[i]);uiStexturePage[i]=0;}
}
}
////////////////////////////////////////////////////////////////////////
// Invalidate tex windows
////////////////////////////////////////////////////////////////////////
void InvalidateWndTextureArea(int X, int Y, int W, int H)
{
int i,px1,px2,py1,py2,iYM=1;
textureWndCacheEntry * tsw=wcWndtexStore;
W+=X-1;
H+=Y-1;
if(X<0) X=0;if(X>1023) X=1023;
if(W<0) W=0;if(W>1023) W=1023;
if(Y<0) Y=0;if(Y>iGPUHeightMask) Y=iGPUHeightMask;
if(H<0) H=0;if(H>iGPUHeightMask) H=iGPUHeightMask;
W++;H++;
if(iGPUHeight==1024) iYM=3;
py1=min(iYM,Y>>8);
py2=min(iYM,H>>8); // y: 0 or 1
px1=max(0,(X>>6));
px2=min(15,(W>>6));
if(py1==py2)
{
py1=py1<<4;px1+=py1;px2+=py1; // change to 0-31
for(i=0;i<iMaxTexWnds;i++,tsw++)
{
if(tsw->used)
{
if(tsw->pageid>=px1 && tsw->pageid<=px2)
{
tsw->used=0;
}
}
}
}
else
{
py1=px1+16;py2=px2+16;
for(i=0;i<iMaxTexWnds;i++,tsw++)
{
if(tsw->used)
{
if((tsw->pageid>=px1 && tsw->pageid<=px2) ||
(tsw->pageid>=py1 && tsw->pageid<=py2))
{
tsw->used=0;
}
}
}
}
// adjust tex window count
tsw=wcWndtexStore+iMaxTexWnds-1;
while(iMaxTexWnds && !tsw->used) {iMaxTexWnds--;tsw--;}
}
////////////////////////////////////////////////////////////////////////
// same for sort textures
////////////////////////////////////////////////////////////////////////
void MarkFree(textureSubCacheEntryS * tsx)
{
EXLong * ul, * uls;
int j,iMax;unsigned char x1,y1,dx,dy;
uls=pxSsubtexLeft[tsx->cTexID];
iMax=uls->l;ul=uls+1;
if(!iMax) return;
for(j=0;j<iMax;j++,ul++)
if(ul->l==0xffffffff) break;
if(j<CSUBSIZE-2)
{
if(j==iMax) uls->l=uls->l+1;
x1=tsx->posTX;dx=tsx->pos.c[2]-tsx->pos.c[3];
if(tsx->posTX) {x1--;dx+=3;}
y1=tsx->posTY;dy=tsx->pos.c[0]-tsx->pos.c[1];
if(tsx->posTY) {y1--;dy+=3;}
ul->c[3]=x1;
ul->c[2]=dx;
ul->c[1]=y1;
ul->c[0]=dy;
}
}
void InvalidateSubSTextureArea(int X, int Y, int W, int H)
{
int i,j,k,iMax,px,py,px1,px2,py1,py2,iYM = 1;
EXLong npos;
textureSubCacheEntryS *tsb;
int x1,x2,y1,y2,xa,sw;
W+=X-1;
H+=Y-1;
if(X<0) X=0;if(X>1023) X=1023;
if(W<0) W=0;if(W>1023) W=1023;
if(Y<0) Y=0;if(Y>iGPUHeightMask) Y=iGPUHeightMask;
if(H<0) H=0;if(H>iGPUHeightMask) H=iGPUHeightMask;
W++;H++;
if(iGPUHeight==1024) iYM=3;
py1=min(iYM,Y>>8);
py2=min(iYM,H>>8); // y: 0 or 1
px1=max(0,(X>>6)-3);
px2=min(15,(W>>6)+3); // x: 0-15
for(py=py1;py<=py2;py++)
{
j=(py<<4)+px1; // get page
y1=py*256;y2=y1+255;
if(H<y1) continue;
if(Y>y2) continue;
if(Y>y1) y1=Y;
if(H<y2) y2=H;
if(y2<y1) {sw=y1;y1=y2;y2=sw;}
y1=((y1%256)<<8);
y2=(y2%256);
for(px=px1;px<=px2;px++,j++)
{
for(k=0;k<3;k++)
{
xa=x1=px<<6;
if(W<x1) continue;
x2=x1+(64<<k)-1;
if(X>x2) continue;
if(X>x1) x1=X;
if(W<x2) x2=W;
if(x2<x1) {sw=x1;x1=x2;x2=sw;}
if (dwGPUVersion == 2)
npos.l=0x00ff00ff;
else
npos.l=((x1-xa)<<(26-k))|((x2-xa)<<(18-k))|y1|y2;
{
tsb=pscSubtexStore[k][j]+SOFFA;iMax=tsb->pos.l;tsb++;
for(i=0;i<iMax;i++,tsb++)
if(tsb->ClutID && XCHECK(tsb->pos,npos)) {tsb->ClutID=0;MarkFree(tsb);}
// if(npos.l & 0x00800000)
{
tsb=pscSubtexStore[k][j]+SOFFB;iMax=tsb->pos.l;tsb++;
for(i=0;i<iMax;i++,tsb++)
if(tsb->ClutID && XCHECK(tsb->pos,npos)) {tsb->ClutID=0;MarkFree(tsb);}
}
// if(npos.l & 0x00000080)
{
tsb=pscSubtexStore[k][j]+SOFFC;iMax=tsb->pos.l;tsb++;
for(i=0;i<iMax;i++,tsb++)
if(tsb->ClutID && XCHECK(tsb->pos,npos)) {tsb->ClutID=0;MarkFree(tsb);}
}
// if(npos.l & 0x00800080)
{
tsb=pscSubtexStore[k][j]+SOFFD;iMax=tsb->pos.l;tsb++;
for(i=0;i<iMax;i++,tsb++)
if(tsb->ClutID && XCHECK(tsb->pos,npos)) {tsb->ClutID=0;MarkFree(tsb);}
}
}
}
}
}
}
////////////////////////////////////////////////////////////////////////
// Invalidate some parts of cache: main routine
////////////////////////////////////////////////////////////////////////
void InvalidateTextureAreaEx(void)
{
short W=sxmax-sxmin;
short H=symax-symin;
if (W == 0 && H == 0) return;
if (iMaxTexWnds)
InvalidateWndTextureArea(sxmin,symin,W,H);
InvalidateSubSTextureArea(sxmin,symin,W,H);
}
////////////////////////////////////////////////////////////////////////
void InvalidateTextureArea(int X, int Y, int W, int H)
{
if (W == 0 && H == 0) return;
if (iMaxTexWnds) InvalidateWndTextureArea(X, Y, W, H);
InvalidateSubSTextureArea(X, Y, W, H);
}
////////////////////////////////////////////////////////////////////////
// tex window: define
////////////////////////////////////////////////////////////////////////
void DefineTextureWnd(void)
{
if (gTexName == 0)
glGenTextures(1, &gTexName);
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
if(iFilterType && iFilterType<3 && iHiResTextures!=2)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
glTexImage2D(GL_TEXTURE_2D, 0,giWantedRGBA,
TWin.Position.x1,
TWin.Position.y1,
0, giWantedFMT, giWantedTYPE, texturepart);
}
////////////////////////////////////////////////////////////////////////
// tex window: load packed stretch
////////////////////////////////////////////////////////////////////////
void LoadStretchPackedWndTexturePage(int pageid, int mode, short cx, short cy)
{
uint32_t start, row, column, j, sxh, sxm, ldx, ldy, ldxo;
unsigned int palstart;
unsigned short *px, *pa, *ta;
unsigned char *cSRCPtr,*cOSRCPtr;
unsigned short *wSRCPtr,*wOSRCPtr;
uint32_t LineOffset;
unsigned short s;
int pmult = pageid / 16;
unsigned short (*LPTCOL)(unsigned short);
LPTCOL = PTCF[DrawSemiTrans];
ldxo = TWin.Position.x1-TWin.OPosition.x1;
ldy = TWin.Position.y1-TWin.OPosition.y1;
pa = px = (unsigned short *)ubPaletteBuffer;
ta = (unsigned short *)texturepart;
palstart = cx + (cy * 1024);
ubOpaqueDraw = 0;
switch (mode)
{
//--------------------------------------------------//
// 4bit texture load ..
case 0:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
for(row=0;row<16;row++)
*px++=LPTCOL(*wSRCPtr++);
column=g_y2-ldy;
for(TXV=g_y1;TXV<=column;TXV++)
{
ldx=ldxo;
for(TXU=g_x1;TXU<=g_x2-ldxo;TXU++)
{
n_xi = ( ( TXU >> 2 ) & ~0x3c ) + ( ( TXV << 2 ) & 0x3c );
n_yi = ( TXV & ~0xf ) + ( ( TXU >> 4 ) & 0xf );
s=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x03 ) << 2 ) ) & 0x0f ));
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy)
{ldy--;
for(TXU=g_x1;TXU<=g_x2;TXU++)
*ta++=*(ta-(g_x2-g_x1));
}
}
DefineTextureWnd();
break;
}
start=((pageid-16*pmult)*128)+256*2048*pmult;
// convert CLUT to 32bits .. and then use THAT as a lookup table
wSRCPtr=psxVuw+palstart;
for(row=0;row<16;row++)
*px++=LPTCOL(*wSRCPtr++);
sxm=g_x1&1;sxh=g_x1>>1;
if(sxm) j=g_x1+1; else j=g_x1;
cSRCPtr = psxVub + start + (2048*g_y1) + sxh;
for(column=g_y1;column<=g_y2;column++)
{
cOSRCPtr=cSRCPtr;ldx=ldxo;
if(sxm) *ta++=*(pa+((*cSRCPtr++ >> 4) & 0xF));
for(row=j;row<=g_x2-ldxo;row++)
{
s=*(pa+(*cSRCPtr & 0xF));
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
row++;
if(row<=g_x2-ldxo)
{
s=*(pa+((*cSRCPtr >> 4) & 0xF));
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
cSRCPtr++;
}
if(ldy && column&1)
{ldy--;cSRCPtr = cOSRCPtr;}
else cSRCPtr = psxVub + start + (2048*(column+1)) + sxh;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// 8bit texture load ..
case 1:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
for(row=0;row<256;row++)
*px++=LPTCOL(*wSRCPtr++);
column=g_y2-ldy;
for(TXV=g_y1;TXV<=column;TXV++)
{
ldx=ldxo;
for(TXU=g_x1;TXU<=g_x2-ldxo;TXU++)
{
n_xi = ( ( TXU >> 1 ) & ~0x78 ) + ( ( TXU << 2 ) & 0x40 ) + ( ( TXV << 3 ) & 0x38 );
n_yi = ( TXV & ~0x7 ) + ( ( TXU >> 5 ) & 0x7 );
s=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x01 ) << 3 ) ) & 0xff));
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy)
{ldy--;
for(TXU=g_x1;TXU<=g_x2;TXU++)
*ta++=*(ta-(g_x2-g_x1));
}
}
DefineTextureWnd();
break;
}
start=((pageid-16*pmult)*128)+256*2048*pmult;
// not using a lookup table here... speeds up smaller texture areas
cSRCPtr = psxVub + start + (2048*g_y1) + g_x1;
LineOffset = 2048 - (g_x2-g_x1+1) +ldxo;
for(column=g_y1;column<=g_y2;column++)
{
cOSRCPtr=cSRCPtr;ldx=ldxo;
for(row=g_x1;row<=g_x2-ldxo;row++)
{
s=LPTCOL(psxVuw[palstart+ *cSRCPtr++]);
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy && column&1) {ldy--;cSRCPtr=cOSRCPtr;}
else cSRCPtr+=LineOffset;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// 16bit texture load ..
case 2:
start=((pageid-16*pmult)*64)+256*1024*pmult;
wSRCPtr = psxVuw + start + (1024*g_y1) + g_x1;
LineOffset = 1024 - (g_x2-g_x1+1) +ldxo;
for(column=g_y1;column<=g_y2;column++)
{
wOSRCPtr=wSRCPtr;ldx=ldxo;
for(row=g_x1;row<=g_x2-ldxo;row++)
{
s=LPTCOL(*wSRCPtr++);
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy && column&1) {ldy--;wSRCPtr=wOSRCPtr;}
else wSRCPtr+=LineOffset;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// others are not possible !
}
}
////////////////////////////////////////////////////////////////////////
// tex window: load stretched
////////////////////////////////////////////////////////////////////////
void LoadStretchWndTexturePage(int pageid, int mode, short cx, short cy)
{
uint32_t start,row,column,j,sxh,sxm,ldx,ldy,ldxo,s;
unsigned int palstart;
uint32_t *px,*pa,*ta;
unsigned char *cSRCPtr,*cOSRCPtr;
unsigned short *wSRCPtr,*wOSRCPtr;
uint32_t LineOffset;
int pmult = pageid / 16;
uint32_t (*LTCOL)(uint32_t);
LTCOL = TCF[DrawSemiTrans];
ldxo=TWin.Position.x1-TWin.OPosition.x1;
ldy =TWin.Position.y1-TWin.OPosition.y1;
pa = px = (uint32_t *)ubPaletteBuffer;
ta = (uint32_t *)texturepart;
palstart = cx + (cy * 1024);
ubOpaqueDraw = 0;
switch (mode)
{
//--------------------------------------------------//
// 4bit texture load ..
case 0:
//------------------- ZN STUFF
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
row=4;do
{
*px =LTCOL(*wSRCPtr);
*(px+1)=LTCOL(*(wSRCPtr+1));
*(px+2)=LTCOL(*(wSRCPtr+2));
*(px+3)=LTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
column=g_y2-ldy;
for(TXV=g_y1;TXV<=column;TXV++)
{
ldx=ldxo;
for(TXU=g_x1;TXU<=g_x2-ldxo;TXU++)
{
n_xi = ( ( TXU >> 2 ) & ~0x3c ) + ( ( TXV << 2 ) & 0x3c );
n_yi = ( TXV & ~0xf ) + ( ( TXU >> 4 ) & 0xf );
s=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x03 ) << 2 ) ) & 0x0f ));
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy)
{ldy--;
for(TXU=g_x1;TXU<=g_x2;TXU++)
*ta++=*(ta-(g_x2-g_x1));
}
}
DefineTextureWnd();
break;
}
//-------------------
start=((pageid-16*pmult)*128)+256*2048*pmult;
// convert CLUT to 32bits .. and then use THAT as a lookup table
wSRCPtr=psxVuw+palstart;
for(row=0;row<16;row++)
*px++=LTCOL(*wSRCPtr++);
sxm=g_x1&1;sxh=g_x1>>1;
if(sxm) j=g_x1+1; else j=g_x1;
cSRCPtr = psxVub + start + (2048*g_y1) + sxh;
for(column=g_y1;column<=g_y2;column++)
{
cOSRCPtr=cSRCPtr;ldx=ldxo;
if(sxm) *ta++=*(pa+((*cSRCPtr++ >> 4) & 0xF));
for(row=j;row<=g_x2-ldxo;row++)
{
s=*(pa+(*cSRCPtr & 0xF));
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
row++;
if(row<=g_x2-ldxo)
{
s=*(pa+((*cSRCPtr >> 4) & 0xF));
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
cSRCPtr++;
}
if(ldy && column&1)
{ldy--;cSRCPtr = cOSRCPtr;}
else cSRCPtr = psxVub + start + (2048*(column+1)) + sxh;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// 8bit texture load ..
case 1:
//------------ ZN STUFF
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
row=64;do
{
*px =LTCOL(*wSRCPtr);
*(px+1)=LTCOL(*(wSRCPtr+1));
*(px+2)=LTCOL(*(wSRCPtr+2));
*(px+3)=LTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
column=g_y2-ldy;
for(TXV=g_y1;TXV<=column;TXV++)
{
ldx=ldxo;
for(TXU=g_x1;TXU<=g_x2-ldxo;TXU++)
{
n_xi = ( ( TXU >> 1 ) & ~0x78 ) + ( ( TXU << 2 ) & 0x40 ) + ( ( TXV << 3 ) & 0x38 );
n_yi = ( TXV & ~0x7 ) + ( ( TXU >> 5 ) & 0x7 );
s=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x01 ) << 3 ) ) & 0xff));
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy)
{ldy--;
for(TXU=g_x1;TXU<=g_x2;TXU++)
*ta++=*(ta-(g_x2-g_x1));
}
}
DefineTextureWnd();
break;
}
//------------
start=((pageid-16*pmult)*128)+256*2048*pmult;
// not using a lookup table here... speeds up smaller texture areas
cSRCPtr = psxVub + start + (2048*g_y1) + g_x1;
LineOffset = 2048 - (g_x2-g_x1+1) +ldxo;
for(column=g_y1;column<=g_y2;column++)
{
cOSRCPtr=cSRCPtr;ldx=ldxo;
for(row=g_x1;row<=g_x2-ldxo;row++)
{
s=LTCOL(psxVuw[palstart+ *cSRCPtr++]);
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy && column&1) {ldy--;cSRCPtr=cOSRCPtr;}
else cSRCPtr+=LineOffset;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// 16bit texture load ..
case 2:
start=((pageid-16*pmult)*64)+256*1024*pmult;
wSRCPtr = psxVuw + start + (1024*g_y1) + g_x1;
LineOffset = 1024 - (g_x2-g_x1+1) +ldxo;
for(column=g_y1;column<=g_y2;column++)
{
wOSRCPtr=wSRCPtr;ldx=ldxo;
for(row=g_x1;row<=g_x2-ldxo;row++)
{
s=LTCOL(*wSRCPtr++);
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy && column&1) {ldy--;wSRCPtr=wOSRCPtr;}
else wSRCPtr+=LineOffset;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// others are not possible !
}
}
////////////////////////////////////////////////////////////////////////
// tex window: load packed simple
////////////////////////////////////////////////////////////////////////
void LoadPackedWndTexturePage(int pageid, int mode, short cx, short cy)
{
uint32_t start,row,column,j,sxh,sxm;
unsigned int palstart;
unsigned short *px,*pa,*ta;
unsigned char *cSRCPtr;
unsigned short *wSRCPtr;
uint32_t LineOffset;
int pmult=pageid/16;
unsigned short (*LPTCOL)(unsigned short);
LPTCOL=PTCF[DrawSemiTrans];
pa=px=(unsigned short *)ubPaletteBuffer;
ta=(unsigned short *)texturepart;
palstart=cx+(cy*1024);
ubOpaqueDraw=0;
switch(mode)
{
//--------------------------------------------------//
// 4bit texture load ..
case 0:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
for(row=0;row<16;row++)
*px++=LPTCOL(*wSRCPtr++);
for(TXV=g_y1;TXV<=g_y2;TXV++)
{
for(TXU=g_x1;TXU<=g_x2;TXU++)
{
n_xi = ( ( TXU >> 2 ) & ~0x3c ) + ( ( TXV << 2 ) & 0x3c );
n_yi = ( TXV & ~0xf ) + ( ( TXU >> 4 ) & 0xf );
*ta++=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x03 ) << 2 ) ) & 0x0f ));
}
}
DefineTextureWnd();
break;
}
start=((pageid-16*pmult)*128)+256*2048*pmult;
// convert CLUT to 32bits .. and then use THAT as a lookup table
wSRCPtr=psxVuw+palstart;
for(row=0;row<16;row++)
*px++=LPTCOL(*wSRCPtr++);
sxm=g_x1&1;sxh=g_x1>>1;
if(sxm) j=g_x1+1; else j=g_x1;
cSRCPtr = psxVub + start + (2048*g_y1) + sxh;
for(column=g_y1;column<=g_y2;column++)
{
cSRCPtr = psxVub + start + (2048*column) + sxh;
if(sxm) *ta++=*(pa+((*cSRCPtr++ >> 4) & 0xF));
for(row=j;row<=g_x2;row++)
{
*ta++=*(pa+(*cSRCPtr & 0xF)); row++;
if(row<=g_x2) *ta++=*(pa+((*cSRCPtr >> 4) & 0xF));
cSRCPtr++;
}
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// 8bit texture load ..
case 1:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
for(row=0;row<256;row++)
*px++=LPTCOL(*wSRCPtr++);
for(TXV=g_y1;TXV<=g_y2;TXV++)
{
for(TXU=g_x1;TXU<=g_x2;TXU++)
{
n_xi = ( ( TXU >> 1 ) & ~0x78 ) + ( ( TXU << 2 ) & 0x40 ) + ( ( TXV << 3 ) & 0x38 );
n_yi = ( TXV & ~0x7 ) + ( ( TXU >> 5 ) & 0x7 );
*ta++=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x01 ) << 3 ) ) & 0xff));
}
}
DefineTextureWnd();
break;
}
start=((pageid-16*pmult)*128)+256*2048*pmult;
// not using a lookup table here... speeds up smaller texture areas
cSRCPtr = psxVub + start + (2048*g_y1) + g_x1;
LineOffset = 2048 - (g_x2-g_x1+1);
for(column=g_y1;column<=g_y2;column++)
{
for(row=g_x1;row<=g_x2;row++)
*ta++=LPTCOL(psxVuw[palstart+ *cSRCPtr++]);
cSRCPtr+=LineOffset;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// 16bit texture load ..
case 2:
start=((pageid-16*pmult)*64)+256*1024*pmult;
wSRCPtr = psxVuw + start + (1024*g_y1) + g_x1;
LineOffset = 1024 - (g_x2-g_x1+1);
for(column=g_y1;column<=g_y2;column++)
{
for(row=g_x1;row<=g_x2;row++)
*ta++=LPTCOL(*wSRCPtr++);
wSRCPtr+=LineOffset;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// others are not possible !
}
}
////////////////////////////////////////////////////////////////////////
// tex window: load simple
////////////////////////////////////////////////////////////////////////
void LoadWndTexturePage(int pageid, int mode, short cx, short cy)
{
uint32_t start,row,column,j,sxh,sxm;
unsigned int palstart;
uint32_t *px,*pa,*ta;
unsigned char *cSRCPtr;
unsigned short *wSRCPtr;
uint32_t LineOffset;
int pmult = pageid / 16;
uint32_t (*LTCOL)(uint32_t);
LTCOL=TCF[DrawSemiTrans];
pa = px = (uint32_t *)ubPaletteBuffer;
ta = (uint32_t *)texturepart;
palstart = cx + (cy * 1024);
ubOpaqueDraw = 0;
switch (mode)
{
//--------------------------------------------------//
// 4bit texture load ..
case 0:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
row=4;do
{
*px =LTCOL(*wSRCPtr);
*(px+1)=LTCOL(*(wSRCPtr+1));
*(px+2)=LTCOL(*(wSRCPtr+2));
*(px+3)=LTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
for(TXV=g_y1;TXV<=g_y2;TXV++)
{
for(TXU=g_x1;TXU<=g_x2;TXU++)
{
n_xi = ( ( TXU >> 2 ) & ~0x3c ) + ( ( TXV << 2 ) & 0x3c );
n_yi = ( TXV & ~0xf ) + ( ( TXU >> 4 ) & 0xf );
*ta++=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x03 ) << 2 ) ) & 0x0f ));
}
}
DefineTextureWnd();
break;
}
start=((pageid-16*pmult)*128)+256*2048*pmult;
// convert CLUT to 32bits .. and then use THAT as a lookup table
wSRCPtr=psxVuw+palstart;
for(row=0;row<16;row++)
*px++=LTCOL(*wSRCPtr++);
sxm=g_x1&1;sxh=g_x1>>1;
if(sxm) j=g_x1+1; else j=g_x1;
cSRCPtr = psxVub + start + (2048*g_y1) + sxh;
for(column=g_y1;column<=g_y2;column++)
{
cSRCPtr = psxVub + start + (2048*column) + sxh;
if(sxm) *ta++=*(pa+((*cSRCPtr++ >> 4) & 0xF));
for(row=j;row<=g_x2;row++)
{
*ta++=*(pa+(*cSRCPtr & 0xF)); row++;
if(row<=g_x2) *ta++=*(pa+((*cSRCPtr >> 4) & 0xF));
cSRCPtr++;
}
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// 8bit texture load ..
case 1:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
row=64;do
{
*px =LTCOL(*wSRCPtr);
*(px+1)=LTCOL(*(wSRCPtr+1));
*(px+2)=LTCOL(*(wSRCPtr+2));
*(px+3)=LTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
for(TXV=g_y1;TXV<=g_y2;TXV++)
{
for(TXU=g_x1;TXU<=g_x2;TXU++)
{
n_xi = ( ( TXU >> 1 ) & ~0x78 ) + ( ( TXU << 2 ) & 0x40 ) + ( ( TXV << 3 ) & 0x38 );
n_yi = ( TXV & ~0x7 ) + ( ( TXU >> 5 ) & 0x7 );
*ta++=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x01 ) << 3 ) ) & 0xff));
}
}
DefineTextureWnd();
break;
}
start=((pageid-16*pmult)*128)+256*2048*pmult;
// not using a lookup table here... speeds up smaller texture areas
cSRCPtr = psxVub + start + (2048*g_y1) + g_x1;
LineOffset = 2048 - (g_x2-g_x1+1);
for(column=g_y1;column<=g_y2;column++)
{
for(row=g_x1;row<=g_x2;row++)
*ta++=LTCOL(psxVuw[palstart+ *cSRCPtr++]);
cSRCPtr+=LineOffset;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// 16bit texture load ..
case 2:
start=((pageid-16*pmult)*64)+256*1024*pmult;
wSRCPtr = psxVuw + start + (1024*g_y1) + g_x1;
LineOffset = 1024 - (g_x2-g_x1+1);
for(column=g_y1;column<=g_y2;column++)
{
for(row=g_x1;row<=g_x2;row++)
*ta++=LTCOL(*wSRCPtr++);
wSRCPtr+=LineOffset;
}
DefineTextureWnd();
break;
//--------------------------------------------------//
// others are not possible !
}
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
void UploadTexWndPal(int mode,short cx,short cy)
{
unsigned int i,iSize;
unsigned short *wSrcPtr;
uint32_t *ta = (uint32_t *)texturepart;
wSrcPtr = psxVuw + cx + (cy * 1024);
if (mode == 0) i = 4; else i = 64;
iSize = i << 2;
ubOpaqueDraw = 0;
do
{
*ta =PALCOL(*wSrcPtr);
*(ta+1)=PALCOL(*(wSrcPtr+1));
*(ta+2)=PALCOL(*(wSrcPtr+2));
*(ta+3)=PALCOL(*(wSrcPtr+3));
ta+=4;wSrcPtr+=4;i--;
}
while(i);
(*glColorTableEXTEx)(GL_TEXTURE_2D,GL_RGBA8,iSize,
GL_RGBA,GL_UNSIGNED_BYTE,texturepart);
}
////////////////////////////////////////////////////////////////////////
void DefinePalTextureWnd(void)
{
if(gTexName==0)
glGenTextures(1, &gTexName);
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
if(iFilterType && iFilterType<3 && iHiResTextures!=2)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
glTexImage2D(GL_TEXTURE_2D, 0,GL_COLOR_INDEX8_EXT,
TWin.Position.x1,
TWin.Position.y1,
0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE,texturepart);
}
///////////////////////////////////////////////////////
void LoadPalWndTexturePage(int pageid, int mode, short cx, short cy)
{
uint32_t start,row,column,j,sxh,sxm;
unsigned char *ta;
unsigned char *cSRCPtr;
uint32_t LineOffset;
int pmult = pageid / 16;
ta = (unsigned char *)texturepart;
switch (mode)
{
//--------------------------------------------------//
// 4bit texture load ..
case 0:
start=((pageid-16*pmult)*128)+256*2048*pmult;
sxm=g_x1&1;sxh=g_x1>>1;
if(sxm) j=g_x1+1; else j=g_x1;
cSRCPtr = psxVub + start + (2048*g_y1) + sxh;
for(column=g_y1;column<=g_y2;column++)
{
cSRCPtr = psxVub + start + (2048*column) + sxh;
if(sxm) *ta++=((*cSRCPtr++ >> 4) & 0xF);
for(row=j;row<=g_x2;row++)
{
*ta++=(*cSRCPtr & 0xF); row++;
if(row<=g_x2) *ta++=((*cSRCPtr >> 4) & 0xF);
cSRCPtr++;
}
}
DefinePalTextureWnd();
break;
//--------------------------------------------------//
// 8bit texture load ..
case 1:
start=((pageid-16*pmult)*128)+256*2048*pmult;
// not using a lookup table here... speeds up smaller texture areas
cSRCPtr = psxVub + start + (2048*g_y1) + g_x1;
LineOffset = 2048 - (g_x2-g_x1+1);
for(column=g_y1;column<=g_y2;column++)
{
for(row=g_x1;row<=g_x2;row++)
*ta++=*cSRCPtr++;
cSRCPtr+=LineOffset;
}
DefinePalTextureWnd();
break;
}
UploadTexWndPal(mode,cx,cy);
}
////////////////////////////////////////////////////////////////////////
void LoadStretchPalWndTexturePage(int pageid, int mode, short cx, short cy)
{
uint32_t start,row,column,j,sxh,sxm,ldx,ldy,ldxo;
unsigned char *ta,s;
unsigned char *cSRCPtr,*cOSRCPtr;
uint32_t LineOffset;
int pmult = pageid / 16;
ldxo = TWin.Position.x1-TWin.OPosition.x1;
ldy = TWin.Position.y1-TWin.OPosition.y1;
ta = (unsigned char *)texturepart;
switch (mode)
{
//--------------------------------------------------//
// 4bit texture load ..
case 0:
start=((pageid-16*pmult)*128)+256*2048*pmult;
sxm=g_x1&1;sxh=g_x1>>1;
if(sxm) j=g_x1+1; else j=g_x1;
cSRCPtr = psxVub + start + (2048*g_y1) + sxh;
for(column=g_y1;column<=g_y2;column++)
{
cOSRCPtr=cSRCPtr;ldx=ldxo;
if(sxm) *ta++=((*cSRCPtr++ >> 4) & 0xF);
for(row=j;row<=g_x2-ldxo;row++)
{
s=(*cSRCPtr & 0xF);
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
row++;
if(row<=g_x2-ldxo)
{
s=((*cSRCPtr >> 4) & 0xF);
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
cSRCPtr++;
}
if(ldy && column&1)
{ldy--;cSRCPtr = cOSRCPtr;}
else cSRCPtr = psxVub + start + (2048*(column+1)) + sxh;
}
DefinePalTextureWnd();
break;
//--------------------------------------------------//
// 8bit texture load ..
case 1:
start=((pageid-16*pmult)*128)+256*2048*pmult;
cSRCPtr = psxVub + start + (2048*g_y1) + g_x1;
LineOffset = 2048 - (g_x2-g_x1+1) +ldxo;
for(column=g_y1;column<=g_y2;column++)
{
cOSRCPtr=cSRCPtr;ldx=ldxo;
for(row=g_x1;row<=g_x2-ldxo;row++)
{
s=*cSRCPtr++;
*ta++=s;
if(ldx) {*ta++=s;ldx--;}
}
if(ldy && column&1) {ldy--;cSRCPtr=cOSRCPtr;}
else cSRCPtr+=LineOffset;
}
DefinePalTextureWnd();
break;
}
UploadTexWndPal(mode,cx,cy);
}
////////////////////////////////////////////////////////////////////////
// tex window: main selecting, cache handler included
////////////////////////////////////////////////////////////////////////
GLuint LoadTextureWnd(int pageid, int TextureMode, uint32_t GivenClutId)
{
textureWndCacheEntry *ts, *tsx = NULL;
int i;
short cx,cy;
EXLong npos;
npos.c[3] = TWin.Position.x0;
npos.c[2] = TWin.OPosition.x1;
npos.c[1] = TWin.Position.y0;
npos.c[0] = TWin.OPosition.y1;
g_x1 = TWin.Position.x0; g_x2 = g_x1 + TWin.Position.x1 - 1;
g_y1 = TWin.Position.y0; g_y2 = g_y1 + TWin.Position.y1 - 1;
if (TextureMode == 2) { GivenClutId = 0; cx = cy = 0; }
else
{
cx = ((GivenClutId << 4) & 0x3F0);
cy = ((GivenClutId >> 6) & CLUTYMASK);
GivenClutId = (GivenClutId & CLUTMASK) | (DrawSemiTrans << 30);
// palette check sum
{
uint32_t l = 0,row;
uint32_t *lSRCPtr = (uint32_t *)(psxVuw + cx + (cy * 1024));
if(TextureMode==1) for(row=1;row<129;row++) l+=((*lSRCPtr++)-1)*row;
else for(row=1;row<9;row++) l+=((*lSRCPtr++)-1)<<row;
l=(l+HIWORD(l))&0x3fffL;
GivenClutId|=(l<<16);
}
}
ts=wcWndtexStore;
for(i=0;i<iMaxTexWnds;i++,ts++)
{
if(ts->used)
{
if(ts->pos.l==npos.l &&
ts->pageid==pageid &&
ts->textureMode==TextureMode)
{
if(ts->ClutID==GivenClutId)
{
ubOpaqueDraw=ts->Opaque;
return ts->texname;
}
else if(glColorTableEXTEx && TextureMode!=2)
{
ts->ClutID=GivenClutId;
if(ts->texname!=gTexName)
{
gTexName=ts->texname;
glBindTexture(GL_TEXTURE_2D, gTexName);
}
UploadTexWndPal(TextureMode,cx,cy);
ts->Opaque=ubOpaqueDraw;
return gTexName;
}
}
}
else tsx=ts;
}
if(!tsx)
{
if(iMaxTexWnds==iTexWndLimit)
{
tsx=wcWndtexStore+iTexWndTurn;
iTexWndTurn++;
if(iTexWndTurn==iTexWndLimit) iTexWndTurn=0;
}
else
{
tsx=wcWndtexStore+iMaxTexWnds;
iMaxTexWnds++;
}
}
gTexName=tsx->texname;
if(TWin.OPosition.y1==TWin.Position.y1 &&
TWin.OPosition.x1==TWin.Position.x1)
{
if(glColorTableEXTEx && TextureMode!=2)
LoadPalWndTexturePage(pageid,TextureMode,cx,cy);
else
if(bGLExt)
LoadPackedWndTexturePage(pageid,TextureMode,cx,cy);
else
LoadWndTexturePage(pageid,TextureMode,cx,cy);
}
else
{
if(glColorTableEXTEx && TextureMode!=2)
LoadStretchPalWndTexturePage(pageid,TextureMode,cx,cy);
else
if(bGLExt)
LoadStretchPackedWndTexturePage(pageid,TextureMode,cx,cy);
else
LoadStretchWndTexturePage(pageid,TextureMode,cx,cy);
}
tsx->Opaque=ubOpaqueDraw;
tsx->pos.l=npos.l;
tsx->ClutID=GivenClutId;
tsx->pageid=pageid;
tsx->textureMode=TextureMode;
tsx->texname=gTexName;
tsx->used=1;
return gTexName;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// movie texture: define
////////////////////////////////////////////////////////////////////////
void DefinePackedTextureMovie(void)
{
if(gTexMovieName==0)
{
glGenTextures(1, &gTexMovieName);
gTexName=gTexMovieName;
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);
if(!bUseFastMdec)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
glTexImage2D(GL_TEXTURE_2D, 0, //giWantedRGBA,
GL_RGB5_A1,
256, 256, 0, GL_RGBA, giWantedTYPE, texturepart);
}
else
{
gTexName=gTexMovieName;glBindTexture(GL_TEXTURE_2D, gTexName);
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
(xrMovieArea.x1-xrMovieArea.x0),
(xrMovieArea.y1-xrMovieArea.y0),
GL_RGBA,
GL_UNSIGNED_SHORT_5_5_5_1_EXT,
texturepart);
}
////////////////////////////////////////////////////////////////////////
void DefineTextureMovie(void)
{
if(gTexMovieName==0)
{
glGenTextures(1, &gTexMovieName);
gTexName=gTexMovieName;
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);
if(!bUseFastMdec)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
glTexImage2D(GL_TEXTURE_2D, 0, giWantedRGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart);
}
else
{
gTexName=gTexMovieName;glBindTexture(GL_TEXTURE_2D, gTexName);
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
(xrMovieArea.x1-xrMovieArea.x0),
(xrMovieArea.y1-xrMovieArea.y0),
GL_RGBA, GL_UNSIGNED_BYTE, texturepart);
}
////////////////////////////////////////////////////////////////////////
// movie texture: load
////////////////////////////////////////////////////////////////////////
#define MRED(x) ((x>>3) & 0x1f)
#define MGREEN(x) ((x>>6) & 0x3e0)
#define MBLUE(x) ((x>>9) & 0x7c00)
#define XMGREEN(x) ((x>>5) & 0x07c0)
#define XMRED(x) ((x<<8) & 0xf800)
#define XMBLUE(x) ((x>>18) & 0x003e)
////////////////////////////////////////////////////////////////////////
// movie texture: load
////////////////////////////////////////////////////////////////////////
unsigned char * LoadDirectMovieFast(void)
{
int row,column;
unsigned int startxy;
uint32_t *ta=(uint32_t *)texturepart;
if(PSXDisplay.RGB24)
{
unsigned char * pD;
startxy=((1024)*xrMovieArea.y0)+xrMovieArea.x0;
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++,startxy+=1024)
{
pD=(unsigned char *)&psxVuw[startxy];
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
{
*ta++=*((uint32_t *)pD)|0xff000000;
pD+=3;
}
}
}
else
{
uint32_t (*LTCOL)(uint32_t);
LTCOL=XP8RGBA_0;//TCF[0];
ubOpaqueDraw=0;
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=LTCOL(psxVuw[startxy++]|0x8000);
}
}
return texturepart;
}
////////////////////////////////////////////////////////////////////////
GLuint LoadTextureMovieFast(void)
{
int row,column;
unsigned int start,startxy;
if(bGLFastMovie)
{
if(PSXDisplay.RGB24)
{
unsigned char * pD; uint32_t lu1,lu2;
unsigned short * ta=(unsigned short *)texturepart;
short sx0=xrMovieArea.x1-1;
start=0;
startxy=((1024)*xrMovieArea.y0)+xrMovieArea.x0;
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
pD=(unsigned char *)&psxVuw[startxy];
startxy+=1024;
for(row=xrMovieArea.x0;row<sx0;row+=2)
{
lu1=*((uint32_t *)pD);pD+=3;
lu2=*((uint32_t *)pD);pD+=3;
*((uint32_t *)ta)=
(XMBLUE(lu1)|XMGREEN(lu1)|XMRED(lu1)|1)|
((XMBLUE(lu2)|XMGREEN(lu2)|XMRED(lu2)|1)<<16);
ta+=2;
}
if(row==sx0)
{
lu1=*((uint32_t *)pD);
*ta++=XMBLUE(lu1)|XMGREEN(lu1)|XMRED(lu1)|1;
}
}
}
else
{
unsigned short *ta=(unsigned short *)texturepart;
uint32_t lc;
short sx0=xrMovieArea.x1-1;
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
for(row=xrMovieArea.x0;row<sx0;row+=2)
{
lc=*((uint32_t *)&psxVuw[startxy]);
*((uint32_t *)ta)=
((lc&0x001f001f)<<11)|((lc&0x03e003e0)<<1)|((lc&0x7c007c00)>>9)|0x00010001;
ta+=2;startxy+=2;
}
if(row==sx0) *ta++=(psxVuw[startxy]<<1)|1;
}
}
DefinePackedTextureMovie();
}
else
{
if(PSXDisplay.RGB24)
{
unsigned char *pD;
uint32_t *ta = (uint32_t *)texturepart;
startxy=((1024)*xrMovieArea.y0)+xrMovieArea.x0;
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++,startxy+=1024)
{
//startxy=((1024)*column)+xrMovieArea.x0;
pD = (unsigned char *)&psxVuw[startxy];
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
{
*ta++=*((uint32_t *)pD)|0xff000000;
pD+=3;
}
}
}
else
{
uint32_t (*LTCOL)(uint32_t);
uint32_t *ta;
LTCOL = XP8RGBA_0;//TCF[0];
ubOpaqueDraw = 0;
ta = (uint32_t *)texturepart;
for (column = xrMovieArea.y0; column < xrMovieArea.y1; column++)
{
startxy = (1024 * column) + xrMovieArea.x0;
for (row = xrMovieArea.x0; row < xrMovieArea.x1; row++)
*ta++=LTCOL(psxVuw[startxy++]|0x8000);
}
}
DefineTextureMovie();
}
return gTexName;
}
////////////////////////////////////////////////////////////////////////
GLuint LoadTextureMovie(void)
{
short row,column,dx;
unsigned int startxy;
BOOL b_X,b_Y;
if(bUseFastMdec) return LoadTextureMovieFast();
b_X=FALSE;b_Y=FALSE;
if((xrMovieArea.x1-xrMovieArea.x0)<255) b_X=TRUE;
if((xrMovieArea.y1-xrMovieArea.y0)<255) b_Y=TRUE;
if(bGLFastMovie)
{
unsigned short c;
if(PSXDisplay.RGB24)
{
unsigned char * pD;
uint32_t lu;
unsigned short * ta=(unsigned short *)texturepart;
if(b_X)
{
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
pD=(unsigned char *)&psxVuw[startxy];
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
{
lu=*((uint32_t *)pD);pD+=3;
*ta++=XMBLUE(lu)|XMGREEN(lu)|XMRED(lu)|1;
}
*ta++=*(ta-1);
}
if(b_Y)
{
dx=xrMovieArea.x1-xrMovieArea.x0+1;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=*(ta-dx);
*ta++=*(ta-1);
}
}
else
{
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
pD=(unsigned char *)&psxVuw[startxy];
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
{
lu=*((uint32_t *)pD);pD+=3;
*ta++=XMBLUE(lu)|XMGREEN(lu)|XMRED(lu)|1;
}
}
if(b_Y)
{
dx=xrMovieArea.x1-xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=*(ta-dx);
}
}
}
else
{
unsigned short *ta;
ubOpaqueDraw=0;
ta=(unsigned short *)texturepart;
if(b_X)
{
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
{
c=psxVuw[startxy++];
*ta++=((c&0x1f)<<11)|((c&0x3e0)<<1)|((c&0x7c00)>>9)|1;
}
*ta++=*(ta-1);
}
if(b_Y)
{
dx=xrMovieArea.x1-xrMovieArea.x0+1;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=*(ta-dx);
*ta++=*(ta-1);
}
}
else
{
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
{
c=psxVuw[startxy++];
*ta++=((c&0x1f)<<11)|((c&0x3e0)<<1)|((c&0x7c00)>>9)|1;
}
}
if(b_Y)
{
dx=xrMovieArea.x1-xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=*(ta-dx);
}
}
}
xrMovieArea.x1+=b_X;xrMovieArea.y1+=b_Y;
DefinePackedTextureMovie();
xrMovieArea.x1-=b_X;xrMovieArea.y1-=b_Y;
}
else
{
if(PSXDisplay.RGB24)
{
unsigned char * pD;
uint32_t * ta=(uint32_t *)texturepart;
if(b_X)
{
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
pD=(unsigned char *)&psxVuw[startxy];
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
{
*ta++=*((uint32_t *)pD)|0xff000000;
pD+=3;
}
*ta++=*(ta-1);
}
if(b_Y)
{
dx=xrMovieArea.x1-xrMovieArea.x0+1;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=*(ta-dx);
*ta++=*(ta-1);
}
}
else
{
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
pD=(unsigned char *)&psxVuw[startxy];
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
{
*ta++=*((uint32_t *)pD)|0xff000000;
pD+=3;
}
}
if(b_Y)
{
dx=xrMovieArea.x1-xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=*(ta-dx);
}
}
}
else
{
uint32_t (*LTCOL)(uint32_t);
uint32_t *ta;
LTCOL=XP8RGBA_0;//TCF[0];
ubOpaqueDraw=0;
ta=(uint32_t *)texturepart;
if(b_X)
{
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=LTCOL(psxVuw[startxy++]|0x8000);
*ta++=*(ta-1);
}
if(b_Y)
{
dx=xrMovieArea.x1-xrMovieArea.x0+1;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=*(ta-dx);
*ta++=*(ta-1);
}
}
else
{
for(column=xrMovieArea.y0;column<xrMovieArea.y1;column++)
{
startxy=((1024)*column)+xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=LTCOL(psxVuw[startxy++]|0x8000);
}
if(b_Y)
{
dx=xrMovieArea.x1-xrMovieArea.x0;
for(row=xrMovieArea.x0;row<xrMovieArea.x1;row++)
*ta++=*(ta-dx);
}
}
}
xrMovieArea.x1+=b_X;xrMovieArea.y1+=b_Y;
DefineTextureMovie();
xrMovieArea.x1-=b_X;xrMovieArea.y1-=b_Y;
}
return gTexName;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
GLuint BlackFake15BitTexture(void)
{
int pmult;short x1,x2,y1,y2;
if(PSXDisplay.InterlacedTest) return 0;
pmult=GlobalTexturePage/16;
x1=gl_ux[7];
x2=gl_ux[6]-gl_ux[7];
y1=gl_ux[5];
y2=gl_ux[4]-gl_ux[5];
if(iSpriteTex)
{
if(x2<255) x2++;
if(y2<255) y2++;
}
y1+=pmult*256;
x1+=((GlobalTexturePage-16*pmult)<<6);
if( FastCheckAgainstFrontScreen(x1,y1,x2,y2)
|| FastCheckAgainstScreen(x1,y1,x2,y2))
{
if(!gTexFrameName)
{
glGenTextures(1, &gTexFrameName);
gTexName=gTexFrameName;
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if(bGLExt)
{
unsigned short s;unsigned short * ta;
if(giWantedTYPE==GL_UNSIGNED_SHORT_4_4_4_4_EXT)
s=0x000f;
else s=0x0001;
ta=(unsigned short *)texturepart;
for(y1=0;y1<=4;y1++)
for(x1=0;x1<=4;x1++)
*ta++=s;
}
else
{
uint32_t *ta=(uint32_t *)texturepart;
for(y1=0;y1<=4;y1++)
for(x1=0;x1<=4;x1++)
*ta++=0xff000000;
}
glTexImage2D(GL_TEXTURE_2D, 0, giWantedRGBA, 4, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, texturepart);
}
else
{
gTexName=gTexFrameName;
glBindTexture(GL_TEXTURE_2D, gTexName);
}
ubOpaqueDraw=0;
return (GLuint)gTexName;
}
return 0;
}
/////////////////////////////////////////////////////////////////////////////
BOOL bFakeFrontBuffer=FALSE;
BOOL bIgnoreNextTile =FALSE;
int iFTex=512;
GLuint Fake15BitTexture(void)
{
int pmult;short x1,x2,y1,y2;int iYAdjust;
float ScaleX,ScaleY;RECT rSrc;
if(iFrameTexType==1) return BlackFake15BitTexture();
if(PSXDisplay.InterlacedTest) return 0;
pmult=GlobalTexturePage/16;
x1=gl_ux[7];
x2=gl_ux[6]-gl_ux[7];
y1=gl_ux[5];
y2=gl_ux[4]-gl_ux[5];
y1+=pmult*256;
x1+=((GlobalTexturePage-16*pmult)<<6);
if(iFrameTexType==3)
{
if(iFrameReadType==4) return 0;
if(!FastCheckAgainstFrontScreen(x1,y1,x2,y2) &&
!FastCheckAgainstScreen(x1,y1,x2,y2))
return 0;
if(bFakeFrontBuffer) bIgnoreNextTile=TRUE;
CheckVRamReadEx(x1,y1,x1+x2,y1+y2);
return 0;
}
/////////////////////////
if(FastCheckAgainstFrontScreen(x1,y1,x2,y2))
{
x1-=PSXDisplay.DisplayPosition.x;
y1-=PSXDisplay.DisplayPosition.y;
}
else
if(FastCheckAgainstScreen(x1,y1,x2,y2))
{
x1-=PreviousPSXDisplay.DisplayPosition.x;
y1-=PreviousPSXDisplay.DisplayPosition.y;
}
else return 0;
bDrawMultiPass = FALSE;
if(!gTexFrameName)
{
char * p;
if(iResX>1280 || iResY>1024) iFTex=2048;
else
if(iResX>640 || iResY>480) iFTex=1024;
else iFTex=512;
glGenTextures(1, &gTexFrameName);
gTexName=gTexFrameName;
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
p=(char *)malloc(iFTex*iFTex*4);
memset(p,0,iFTex*iFTex*4);
glTexImage2D(GL_TEXTURE_2D, 0, 3, iFTex, iFTex, 0, GL_RGB, GL_UNSIGNED_BYTE, p);
free(p);
glGetError();
}
else
{
gTexName=gTexFrameName;
glBindTexture(GL_TEXTURE_2D, gTexName);
}
x1+=PreviousPSXDisplay.Range.x0;
y1+=PreviousPSXDisplay.Range.y0;
if(PSXDisplay.DisplayMode.x)
ScaleX=(float)rRatioRect.right/(float)PSXDisplay.DisplayMode.x;
else ScaleX=1.0f;
if(PSXDisplay.DisplayMode.y)
ScaleY=(float)rRatioRect.bottom/(float)PSXDisplay.DisplayMode.y;
else ScaleY=1.0f;
rSrc.left =max(x1*ScaleX,0);
rSrc.right =min((x1+x2)*ScaleX+0.99f,iResX-1);
rSrc.top =max(y1*ScaleY,0);
rSrc.bottom=min((y1+y2)*ScaleY+0.99f,iResY-1);
iYAdjust=(y1+y2)-PSXDisplay.DisplayMode.y;
if(iYAdjust>0)
iYAdjust=(int)((float)iYAdjust*ScaleY)+1;
else iYAdjust=0;
gl_vy[0]=255-gl_vy[0];
gl_vy[1]=255-gl_vy[1];
gl_vy[2]=255-gl_vy[2];
gl_vy[3]=255-gl_vy[3];
y1=min(gl_vy[0],min(gl_vy[1],min(gl_vy[2],gl_vy[3])));
gl_vy[0]-=y1;
gl_vy[1]-=y1;
gl_vy[2]-=y1;
gl_vy[3]-=y1;
gl_ux[0]-=gl_ux[7];
gl_ux[1]-=gl_ux[7];
gl_ux[2]-=gl_ux[7];
gl_ux[3]-=gl_ux[7];
ScaleX*=256.0f/((float)(iFTex));
ScaleY*=256.0f/((float)(iFTex));
y1=((float)gl_vy[0]*ScaleY); if(y1>255) y1=255;
gl_vy[0]=y1;
y1=((float)gl_vy[1]*ScaleY); if(y1>255) y1=255;
gl_vy[1]=y1;
y1=((float)gl_vy[2]*ScaleY); if(y1>255) y1=255;
gl_vy[2]=y1;
y1=((float)gl_vy[3]*ScaleY); if(y1>255) y1=255;
gl_vy[3]=y1;
x1=((float)gl_ux[0]*ScaleX); if(x1>255) x1=255;
gl_ux[0]=x1;
x1=((float)gl_ux[1]*ScaleX); if(x1>255) x1=255;
gl_ux[1]=x1;
x1=((float)gl_ux[2]*ScaleX); if(x1>255) x1=255;
gl_ux[2]=x1;
x1=((float)gl_ux[3]*ScaleX); if(x1>255) x1=255;
gl_ux[3]=x1;
x1=rSrc.right-rSrc.left;
if(x1<=0) x1=1;
if(x1>iFTex) x1=iFTex;
y1=rSrc.bottom-rSrc.top;
if(y1<=0) y1=1;
if(y1+iYAdjust>iFTex) y1=iFTex-iYAdjust;
if(bFakeFrontBuffer) glReadBuffer(GL_FRONT);
glCopyTexSubImage2D( GL_TEXTURE_2D, 0,
0,
iYAdjust,
rSrc.left+rRatioRect.left,
iResY-rSrc.bottom-rRatioRect.top,
x1,y1);
if(glGetError())
{
char * p=(char *)malloc(iFTex*iFTex*4);
memset(p,0,iFTex*iFTex*4);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, iFTex, iFTex,
GL_RGB, GL_UNSIGNED_BYTE, p);
free(p);
}
if(bFakeFrontBuffer)
{glReadBuffer(GL_BACK);bIgnoreNextTile=TRUE;}
ubOpaqueDraw=0;
if(iSpriteTex)
{
sprtW=gl_ux[1]-gl_ux[0];
sprtH=-(gl_vy[0]-gl_vy[2]);
}
return (GLuint)gTexName;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// load texture part (unpacked)
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void LoadSubTexturePageSort(int pageid, int mode, short cx, short cy)
{
uint32_t start,row,column,j,sxh,sxm;
unsigned int palstart;
uint32_t *px,*pa,*ta;
unsigned char *cSRCPtr;
unsigned short *wSRCPtr;
uint32_t LineOffset;
uint32_t x2a,xalign=0;
uint32_t x1=gl_ux[7];
uint32_t x2=gl_ux[6];
uint32_t y1=gl_ux[5];
uint32_t y2=gl_ux[4];
uint32_t dx=x2-x1+1;
uint32_t dy=y2-y1+1;
int pmult=pageid/16;
uint32_t (*LTCOL)(uint32_t);
unsigned int a,r,g,b,cnt,h;
uint32_t scol[8];
LTCOL=TCF[DrawSemiTrans];
pa=px=(uint32_t *)ubPaletteBuffer;
ta=(uint32_t *)texturepart;
palstart=cx+(cy<<10);
ubOpaqueDraw=0;
if(YTexS) {ta+=dx;if(XTexS) ta+=2;}
if(XTexS) {ta+=1;xalign=2;}
switch(mode)
{
//--------------------------------------------------//
// 4bit texture load ..
case 0:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
row=4;do
{
*px =LTCOL(*wSRCPtr);
*(px+1)=LTCOL(*(wSRCPtr+1));
*(px+2)=LTCOL(*(wSRCPtr+2));
*(px+3)=LTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
for(TXV=y1;TXV<=y2;TXV++)
{
for(TXU=x1;TXU<=x2;TXU++)
{
n_xi = ( ( TXU >> 2 ) & ~0x3c ) + ( ( TXV << 2 ) & 0x3c );
n_yi = ( TXV & ~0xf ) + ( ( TXU >> 4 ) & 0xf );
*ta++=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x03 ) << 2 ) ) & 0x0f ));
}
ta+=xalign;
}
break;
}
start=((pageid-16*pmult)<<7)+524288*pmult;
// convert CLUT to 32bits .. and then use THAT as a lookup table
wSRCPtr=psxVuw+palstart;
row=4;do
{
*px =LTCOL(*wSRCPtr);
*(px+1)=LTCOL(*(wSRCPtr+1));
*(px+2)=LTCOL(*(wSRCPtr+2));
*(px+3)=LTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
x2a=x2?(x2-1):0;//if(x2) x2a=x2-1; else x2a=0;
sxm=x1&1;sxh=x1>>1;
j=sxm?(x1+1):x1;//if(sxm) j=x1+1; else j=x1;
for(column=y1;column<=y2;column++)
{
cSRCPtr = psxVub + start + (column<<11) + sxh;
if(sxm) *ta++=*(pa+((*cSRCPtr++ >> 4) & 0xF));
for(row=j;row<x2a;row+=2)
{
*ta =*(pa+(*cSRCPtr & 0xF));
*(ta+1)=*(pa+((*cSRCPtr >> 4) & 0xF));
cSRCPtr++;ta+=2;
}
if(row<=x2)
{
*ta++=*(pa+(*cSRCPtr & 0xF)); row++;
if(row<=x2) *ta++=*(pa+((*cSRCPtr >> 4) & 0xF));
}
ta+=xalign;
}
break;
//--------------------------------------------------//
// 8bit texture load ..
case 1:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
row=64;do
{
*px =LTCOL(*wSRCPtr);
*(px+1)=LTCOL(*(wSRCPtr+1));
*(px+2)=LTCOL(*(wSRCPtr+2));
*(px+3)=LTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
for(TXV=y1;TXV<=y2;TXV++)
{
for(TXU=x1;TXU<=x2;TXU++)
{
n_xi = ( ( TXU >> 1 ) & ~0x78 ) + ( ( TXU << 2 ) & 0x40 ) + ( ( TXV << 3 ) & 0x38 );
n_yi = ( TXV & ~0x7 ) + ( ( TXU >> 5 ) & 0x7 );
*ta++=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x01 ) << 3 ) ) & 0xff));
}
ta+=xalign;
}
break;
}
start=((pageid-16*pmult)<<7)+524288*pmult;
cSRCPtr = psxVub + start + (y1<<11) + x1;
LineOffset = 2048 - dx;
if(dy*dx>384)
{
wSRCPtr=psxVuw+palstart;
row=64;do
{
*px =LTCOL(*wSRCPtr);
*(px+1)=LTCOL(*(wSRCPtr+1));
*(px+2)=LTCOL(*(wSRCPtr+2));
*(px+3)=LTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
column=dy;do
{
row=dx;
do {*ta++=*(pa+(*cSRCPtr++));row--;} while(row);
ta+=xalign;
cSRCPtr+=LineOffset;column--;
}
while(column);
}
else
{
wSRCPtr=psxVuw+palstart;
column=dy;do
{
row=dx;
do {*ta++=LTCOL(*(wSRCPtr+*cSRCPtr++));row--;} while(row);
ta+=xalign;
cSRCPtr+=LineOffset;column--;
}
while(column);
}
break;
//--------------------------------------------------//
// 16bit texture load ..
case 2:
start=((pageid-16*pmult)<<6)+262144*pmult;
wSRCPtr = psxVuw + start + (y1<<10) + x1;
LineOffset = 1024 - dx;
column=dy;do
{
row=dx;
do {*ta++=LTCOL(*wSRCPtr++);row--;} while(row);
ta+=xalign;
wSRCPtr+=LineOffset;column--;
}
while(column);
break;
//--------------------------------------------------//
// others are not possible !
}
x2a=dx+xalign;
if(YTexS)
{
ta=(uint32_t *)texturepart;
pa=(uint32_t *)texturepart+x2a;
row=x2a;do {*ta++=*pa++;row--;} while(row);
pa=(uint32_t *)texturepart+dy*x2a;
ta=pa+x2a;
row=x2a;do {*ta++=*pa++;row--;} while(row);
YTexS--;
dy+=2;
}
if(XTexS)
{
ta=(uint32_t *)texturepart;
pa=ta+1;
row=dy;do {*ta=*pa;ta+=x2a;pa+=x2a;row--;} while(row);
pa=(uint32_t *)texturepart+dx;
ta=pa+1;
row=dy;do {*ta=*pa;ta+=x2a;pa+=x2a;row--;} while(row);
XTexS--;
dx+=2;
}
DXTexS=dx;DYTexS=dy;
if(!iFilterType) {DefineSubTextureSort();return;}
if(iFilterType!=2 && iFilterType!=4 && iFilterType!=6) {DefineSubTextureSort();return;}
if((iFilterType==4 || iFilterType==6) && ly0==ly1 && ly2==ly3 && lx0==lx3 && lx1==lx2)
{DefineSubTextureSort();return;}
ta=(uint32_t *)texturepart;
x1=dx-1;
y1=dy-1;
if(bOpaquePass)
{
if(bSmallAlpha)
{
for(column=0;column<dy;column++)
{
for(row=0;row<dx;row++)
{
if(*ta==0x03000000)
{
cnt=0;
if( column && *(ta-dx) >>24 !=0x03) scol[cnt++]=*(ta-dx);
if(row && *(ta-1) >>24 !=0x03) scol[cnt++]=*(ta-1);
if(row!=x1 && *(ta+1) >>24 !=0x03) scol[cnt++]=*(ta+1);
if( column!=y1 && *(ta+dx) >>24 !=0x03) scol[cnt++]=*(ta+dx);
if(row && column && *(ta-dx-1)>>24 !=0x03) scol[cnt++]=*(ta-dx-1);
if(row!=x1 && column && *(ta-dx+1)>>24 !=0x03) scol[cnt++]=*(ta-dx+1);
if(row && column!=y1 && *(ta+dx-1)>>24 !=0x03) scol[cnt++]=*(ta+dx-1);
if(row!=x1 && column!=y1 && *(ta+dx+1)>>24 !=0x03) scol[cnt++]=*(ta+dx+1);
if(cnt)
{
r=g=b=a=0;
for(h=0;h<cnt;h++)
{
r+=(scol[h]>>16)&0xff;
g+=(scol[h]>>8)&0xff;
b+=scol[h]&0xff;
}
r/=cnt;b/=cnt;g/=cnt;
*ta=(r<<16)|(g<<8)|b;
*ta|=0x03000000;
}
}
ta++;
}
}
}
else
{
for(column=0;column<dy;column++)
{
for(row=0;row<dx;row++)
{
if(*ta==0x50000000)
{
cnt=0;
if( column && *(ta-dx) !=0x50000000 && *(ta-dx)>>24!=1) scol[cnt++]=*(ta-dx);
if(row && *(ta-1) !=0x50000000 && *(ta-1)>>24!=1) scol[cnt++]=*(ta-1);
if(row!=x1 && *(ta+1) !=0x50000000 && *(ta+1)>>24!=1) scol[cnt++]=*(ta+1);
if( column!=y1 && *(ta+dx) !=0x50000000 && *(ta+dx)>>24!=1) scol[cnt++]=*(ta+dx);
if(row && column && *(ta-dx-1)!=0x50000000 && *(ta-dx-1)>>24!=1) scol[cnt++]=*(ta-dx-1);
if(row!=x1 && column && *(ta-dx+1)!=0x50000000 && *(ta-dx+1)>>24!=1) scol[cnt++]=*(ta-dx+1);
if(row && column!=y1 && *(ta+dx-1)!=0x50000000 && *(ta+dx-1)>>24!=1) scol[cnt++]=*(ta+dx-1);
if(row!=x1 && column!=y1 && *(ta+dx+1)!=0x50000000 && *(ta+dx+1)>>24!=1) scol[cnt++]=*(ta+dx+1);
if(cnt)
{
r=g=b=a=0;
for(h=0;h<cnt;h++)
{
a+=(scol[h]>>24);
r+=(scol[h]>>16)&0xff;
g+=(scol[h]>>8)&0xff;
b+=scol[h]&0xff;
}
r/=cnt;b/=cnt;g/=cnt;
*ta=(r<<16)|(g<<8)|b;
if(a) *ta|=0x50000000;
else *ta|=0x01000000;
}
}
ta++;
}
}
}
}
else
for(column=0;column<dy;column++)
{
for(row=0;row<dx;row++)
{
if(*ta==0x00000000)
{
cnt=0;
if(row!=x1 && *(ta+1) !=0x00000000) scol[cnt++]=*(ta+1);
if( column!=y1 && *(ta+dx) !=0x00000000) scol[cnt++]=*(ta+dx);
if(cnt)
{
r=g=b=0;
for(h=0;h<cnt;h++)
{
r+=(scol[h]>>16)&0xff;
g+=(scol[h]>>8)&0xff;
b+=scol[h]&0xff;
}
r/=cnt;b/=cnt;g/=cnt;
*ta=(r<<16)|(g<<8)|b;
}
}
ta++;
}
}
DefineSubTextureSort();
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// load texture part (packed)
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void LoadPackedSubTexturePageSort(int pageid, int mode, short cx, short cy)
{
uint32_t start,row,column,j,sxh,sxm;
unsigned int palstart;
unsigned short *px,*pa,*ta;
unsigned char *cSRCPtr;
unsigned short *wSRCPtr;
uint32_t LineOffset;
uint32_t x2a,xalign=0;
uint32_t x1=gl_ux[7];
uint32_t x2=gl_ux[6];
uint32_t y1=gl_ux[5];
uint32_t y2=gl_ux[4];
uint32_t dx=x2-x1+1;
uint32_t dy=y2-y1+1;
int pmult=pageid/16;
unsigned short (*LPTCOL)(unsigned short);
unsigned int a,r,g,b,cnt,h;
unsigned short scol[8];
LPTCOL=PTCF[DrawSemiTrans];
pa=px=(unsigned short *)ubPaletteBuffer;
ta=(unsigned short *)texturepart;
palstart=cx+(cy<<10);
ubOpaqueDraw=0;
if(YTexS) {ta+=dx;if(XTexS) ta+=2;}
if(XTexS) {ta+=1;xalign=2;}
switch(mode)
{
//--------------------------------------------------//
// 4bit texture load ..
case 0:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
row=4;do
{
*px =LPTCOL(*wSRCPtr);
*(px+1)=LPTCOL(*(wSRCPtr+1));
*(px+2)=LPTCOL(*(wSRCPtr+2));
*(px+3)=LPTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
for(TXV=y1;TXV<=y2;TXV++)
{
for(TXU=x1;TXU<=x2;TXU++)
{
n_xi = ( ( TXU >> 2 ) & ~0x3c ) + ( ( TXV << 2 ) & 0x3c );
n_yi = ( TXV & ~0xf ) + ( ( TXU >> 4 ) & 0xf );
*ta++=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x03 ) << 2 ) ) & 0x0f ));
}
ta+=xalign;
}
break;
}
start=((pageid-16*pmult)<<7)+524288*pmult;
wSRCPtr=psxVuw+palstart;
row=4;do
{
*px =LPTCOL(*wSRCPtr);
*(px+1)=LPTCOL(*(wSRCPtr+1));
*(px+2)=LPTCOL(*(wSRCPtr+2));
*(px+3)=LPTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
x2a=x2?(x2-1):0;//if(x2) x2a=x2-1; else x2a=0;
sxm=x1&1;sxh=x1>>1;
j=sxm?(x1+1):x1;//if(sxm) j=x1+1; else j=x1;
for(column=y1;column<=y2;column++)
{
cSRCPtr = psxVub + start + (column<<11) + sxh;
if(sxm) *ta++=*(pa+((*cSRCPtr++ >> 4) & 0xF));
for(row=j;row<x2a;row+=2)
{
*ta =*(pa+(*cSRCPtr & 0xF));
*(ta+1)=*(pa+((*cSRCPtr >> 4) & 0xF));
cSRCPtr++;ta+=2;
}
if(row<=x2)
{
*ta++=*(pa+(*cSRCPtr & 0xF));row++;
if(row<=x2) *ta++=*(pa+((*cSRCPtr >> 4) & 0xF));
}
ta+=xalign;
}
break;
//--------------------------------------------------//
// 8bit texture load ..
case 1:
if(GlobalTextIL)
{
unsigned int TXV,TXU,n_xi,n_yi;
wSRCPtr=psxVuw+palstart;
row=64;do
{
*px =LPTCOL(*wSRCPtr);
*(px+1)=LPTCOL(*(wSRCPtr+1));
*(px+2)=LPTCOL(*(wSRCPtr+2));
*(px+3)=LPTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
for(TXV=y1;TXV<=y2;TXV++)
{
for(TXU=x1;TXU<=x2;TXU++)
{
n_xi = ( ( TXU >> 1 ) & ~0x78 ) + ( ( TXU << 2 ) & 0x40 ) + ( ( TXV << 3 ) & 0x38 );
n_yi = ( TXV & ~0x7 ) + ( ( TXU >> 5 ) & 0x7 );
*ta++=*(pa+((*( psxVuw + ((GlobalTextAddrY + n_yi)*1024) + GlobalTextAddrX + n_xi ) >> ( ( TXU & 0x01 ) << 3 ) ) & 0xff));
}
ta+=xalign;
}
break;
}
start=((pageid-16*pmult)<<7)+524288*pmult;
cSRCPtr = psxVub + start + (y1<<11) + x1;
LineOffset = 2048 - dx;
if(dy*dx>384) // more pix? use lut
{
wSRCPtr=psxVuw+palstart;
row=64;do
{
*px =LPTCOL(*wSRCPtr);
*(px+1)=LPTCOL(*(wSRCPtr+1));
*(px+2)=LPTCOL(*(wSRCPtr+2));
*(px+3)=LPTCOL(*(wSRCPtr+3));
row--;px+=4;wSRCPtr+=4;
}
while (row);
column=dy;do
{
row=dx;
do {*ta++=*(pa+(*cSRCPtr++));row--;} while(row);
ta+=xalign;
cSRCPtr+=LineOffset;column--;
}
while(column);
}
else // small area? no lut
{
wSRCPtr=psxVuw+palstart;
column=dy;do
{
row=dx;
do {*ta++=LPTCOL(*(wSRCPtr+*cSRCPtr++));row--;} while(row);
ta+=xalign;
cSRCPtr+=LineOffset;column--;
}
while(column);
}
break;
//--------------------------------------------------//
// 16bit texture load ..
case 2:
start=((pageid-16*pmult)<<6)+262144*pmult;
wSRCPtr = psxVuw + start + (y1<<10) + x1;
LineOffset = 1024 - dx;
column=dy;do
{
row=dx;
do {*ta++=LPTCOL(*wSRCPtr++);row--;} while(row);
ta+=xalign;
wSRCPtr+=LineOffset;column--;
}
while(column);
break;
//--------------------------------------------------//
// others are not possible !
}
////////////////////////////////////////////////////////
x2a=dx+xalign;
if(YTexS)
{
ta=(unsigned short *)texturepart;
pa=(unsigned short *)texturepart+x2a;
row=x2a;do {*ta++=*pa++;row--;} while(row);
pa=(unsigned short *)texturepart+dy*x2a;
ta=pa+x2a;
row=x2a;do {*ta++=*pa++;row--;} while(row);
YTexS--;
dy+=2;
}
if(XTexS)
{
ta=(unsigned short *)texturepart;
pa=ta+1;
row=dy;do {*ta=*pa;ta+=x2a;pa+=x2a;row--;} while(row);
pa=(unsigned short *)texturepart+dx;
ta=pa+1;
row=dy;do {*ta=*pa;ta+=x2a;pa+=x2a;row--;} while(row);
XTexS--;
dx+=2;
}
DXTexS=dx;DYTexS=dy;
if(!iFilterType) {DefineSubTextureSort();return;}
if(iFilterType!=2 && iFilterType!=4 && iFilterType!=6) {DefineSubTextureSort();return;}
if((iFilterType==4 || iFilterType==6) && ly0==ly1 && ly2==ly3 && lx0==lx3 && lx1==lx2)
{DefineSubTextureSort();return;}
ta=(unsigned short *)texturepart;
x1=dx-1;
y1=dy-1;
if(iTexQuality==1)
{
if(bOpaquePass)
for(column=0;column<dy;column++)
{
for(row=0;row<dx;row++)
{
if(*ta==0x0006)
{
cnt=0;
if( column && *(ta-dx) != 0x0006 && *(ta-dx)!=0) scol[cnt++]=*(ta-dx);
if(row && *(ta-1) != 0x0006 && *(ta-1) !=0) scol[cnt++]=*(ta-1);
if(row!=x1 && *(ta+1) != 0x0006 && *(ta+1) !=0) scol[cnt++]=*(ta+1);
if( column!=y1 && *(ta+dx) != 0x0006 && *(ta+dx)!=0) scol[cnt++]=*(ta+dx);
if(row && column && *(ta-dx-1)!= 0x0006 && *(ta-dx-1)!=0) scol[cnt++]=*(ta-dx-1);
if(row!=x1 && column && *(ta-dx+1)!= 0x0006 && *(ta-dx+1)!=0) scol[cnt++]=*(ta-dx+1);
if(row && column!=y1 && *(ta+dx-1)!= 0x0006 && *(ta+dx-1)!=0) scol[cnt++]=*(ta+dx-1);
if(row!=x1 && column!=y1 && *(ta+dx+1)!= 0x0006 && *(ta+dx+1)!=0) scol[cnt++]=*(ta+dx+1);
if(cnt)
{
r=g=b=a=0;
for(h=0;h<cnt;h++)
{
a+=scol[h]&0xf;
r+=scol[h]>>12;
g+=(scol[h]>>8)&0xf;
b+=(scol[h]>>4)&0xf;
}
r/=cnt;b/=cnt;g/=cnt;
*ta=(r<<12)|(g<<8)|(b<<4);
if(a) *ta|=6;
else *ta=0;
}
}
ta++;
}
}
else
for(column=0;column<dy;column++)
{
for(row=0;row<dx;row++)
{
if(*ta==0x0000)
{
cnt=0;
if( column && *(ta-dx) != 0x0000) scol[cnt++]=*(ta-dx);
if(row && *(ta-1) != 0x0000) scol[cnt++]=*(ta-1);
if(row!=x1 && *(ta+1) != 0x0000) scol[cnt++]=*(ta+1);
if( column!=y1 && *(ta+dx) != 0x0000) scol[cnt++]=*(ta+dx);
if(row && column && *(ta-dx-1)!= 0x0000) scol[cnt++]=*(ta-dx-1);
if(row!=x1 && column && *(ta-dx+1)!= 0x0000) scol[cnt++]=*(ta-dx+1);
if(row && column!=y1 && *(ta+dx-1)!= 0x0000) scol[cnt++]=*(ta+dx-1);
if(row!=x1 && column!=y1 && *(ta+dx+1)!= 0x0000) scol[cnt++]=*(ta+dx+1);
if(cnt)
{
r=g=b=0;
for(h=0;h<cnt;h++)
{
r+=scol[h]>>12;
g+=(scol[h]>>8)&0xf;
b+=(scol[h]>>4)&0xf;
}
r/=cnt;b/=cnt;g/=cnt;
*ta=(r<<12)|(g<<8)|(b<<4);
}
}
ta++;
}
}
}
else
{
for(column=0;column<dy;column++)
{
for(row=0;row<dx;row++)
{
if(*ta==0)
{
cnt=0;
if( column && *(ta-dx) &1) scol[cnt++]=*(ta-dx);
if(row && *(ta-1) &1) scol[cnt++]=*(ta-1);
if(row!=x1 && *(ta+1) &1) scol[cnt++]=*(ta+1);
if( column!=y1 && *(ta+dx) &1) scol[cnt++]=*(ta+dx);
if(row && column && *(ta-dx-1)&1) scol[cnt++]=*(ta-dx-1);
if(row!=x1 && column && *(ta-dx+1)&1) scol[cnt++]=*(ta-dx+1);
if(row && column!=y1 && *(ta+dx-1)&1) scol[cnt++]=*(ta+dx-1);
if(row!=x1 && column!=y1 && *(ta+dx+1)&1) scol[cnt++]=*(ta+dx+1);
if(cnt)
{
r=g=b=0;
for(h=0;h<cnt;h++)
{
r+=scol[h]>>11;
g+=(scol[h]>>6)&0x1f;
b+=(scol[h]>>1)&0x1f;
}
r/=cnt;b/=cnt;g/=cnt;
*ta=(r<<11)|(g<<6)|(b<<1);
}
}
ta++;
}
}
}
DefineSubTextureSort();
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// hires texture funcs
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
#define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D))
////////////////////////////////////////////////////////////////////////
#define colorMask8 0x00FEFEFE
#define lowPixelMask8 0x00010101
#define qcolorMask8 0x00FCFCFC
#define qlowpixelMask8 0x00030303
#define INTERPOLATE8_02(A, B) (((((A & colorMask8) >> 1) + ((B & colorMask8) >> 1) + (A & B & lowPixelMask8))|((((A&0xFF000000)==0x03000000)?0x03000000:(((B&0xFF000000)==0x03000000)?0x03000000:(((A&0xFF000000)==0x00000000)?0x00000000:(((B&0xFF000000)==0x00000000)?0x00000000:0xFF000000)))))))
#define Q_INTERPOLATE8_02(A, B, C, D) (((((A & qcolorMask8) >> 2) + ((B & qcolorMask8) >> 2) + ((C & qcolorMask8) >> 2) + ((D & qcolorMask8) >> 2) + ((((A & qlowpixelMask8) + (B & qlowpixelMask8) + (C & qlowpixelMask8) + (D & qlowpixelMask8)) >> 2) & qlowpixelMask8))|((((A&0xFF000000)==0x03000000)?0x03000000:(((B&0xFF000000)==0x03000000)?0x03000000:(((C&0xFF000000)==0x03000000)?0x03000000:(((D&0xFF000000)==0x03000000)?0x03000000:(((A&0xFF000000)==0x00000000)?0x00000000:(((B&0xFF000000)==0x00000000)?0x00000000:(((C&0xFF000000)==0x00000000)?0x00000000:(((D&0xFF000000)==0x00000000)?0x00000000:0xFF000000)))))))))))
#define INTERPOLATE8(A, B) (((((A & colorMask8) >> 1) + ((B & colorMask8) >> 1) + (A & B & lowPixelMask8))|((((A&0xFF000000)==0x50000000)?0x50000000:(((B&0xFF000000)==0x50000000)?0x50000000:(((A&0xFF000000)==0x00000000)?0x00000000:(((B&0xFF000000)==0x00000000)?0x00000000:0xFF000000)))))))
#define Q_INTERPOLATE8(A, B, C, D) (((((A & qcolorMask8) >> 2) + ((B & qcolorMask8) >> 2) + ((C & qcolorMask8) >> 2) + ((D & qcolorMask8) >> 2) + ((((A & qlowpixelMask8) + (B & qlowpixelMask8) + (C & qlowpixelMask8) + (D & qlowpixelMask8)) >> 2) & qlowpixelMask8))|((((A&0xFF000000)==0x50000000)?0x50000000:(((B&0xFF000000)==0x50000000)?0x50000000:(((C&0xFF000000)==0x50000000)?0x50000000:(((D&0xFF000000)==0x50000000)?0x50000000:(((A&0xFF000000)==0x00000000)?0x00000000:(((B&0xFF000000)==0x00000000)?0x00000000:(((C&0xFF000000)==0x00000000)?0x00000000:(((D&0xFF000000)==0x00000000)?0x00000000:0xFF000000)))))))))))
void Super2xSaI_ex8_Ex(unsigned char *srcPtr, DWORD srcPitch,
unsigned char *dstBitmap, int width, int height)
{
DWORD dstPitch = srcPitch * 2;
DWORD line;
DWORD *dP;
DWORD *bP;
int width2 = width*2;
int iXA,iXB,iXC,iYA,iYB,iYC,finish;
DWORD color4, color5, color6;
DWORD color1, color2, color3;
DWORD colorA0, colorA1, colorA2, colorA3,
colorB0, colorB1, colorB2, colorB3,
colorS1, colorS2;
DWORD product1a, product1b,
product2a, product2b;
line = 0;
{
for (; height; height-=1)
{
bP = (DWORD *)srcPtr;
dP = (DWORD *)(dstBitmap + line*dstPitch);
for (finish = width; finish; finish -= 1 )
{
//--------------------------------------- B1 B2
// 4 5 6 S2
// 1 2 3 S1
// A1 A2
if(finish==width) iXA=0;
else iXA=1;
if(finish>4) {iXB=1;iXC=2;}
else
if(finish>3) {iXB=1;iXC=1;}
else {iXB=0;iXC=0;}
if(line==0) iYA=0;
else iYA=width;
if(height>4) {iYB=width;iYC=width2;}
else
if(height>3) {iYB=width;iYC=width;}
else {iYB=0;iYC=0;}
colorB0 = *(bP- iYA - iXA);
colorB1 = *(bP- iYA);
colorB2 = *(bP- iYA + iXB);
colorB3 = *(bP- iYA + iXC);
color4 = *(bP - iXA);
color5 = *(bP);
color6 = *(bP + iXB);
colorS2 = *(bP + iXC);
color1 = *(bP + iYB - iXA);
color2 = *(bP + iYB);
color3 = *(bP + iYB + iXB);
colorS1= *(bP + iYB + iXC);
colorA0 = *(bP + iYC - iXA);
colorA1 = *(bP + iYC);
colorA2 = *(bP + iYC + iXB);
colorA3 = *(bP + iYC + iXC);
//--------------------------------------
if (color2 == color6 && color5 != color3)
{
product2b = product1b = color2;
}
else
if (color5 == color3 && color2 != color6)
{
product2b = product1b = color5;
}
else
if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GET_RESULT ((color6&0x00ffffff), (color5&0x00ffffff), (color1&0x00ffffff), (colorA1&0x00ffffff));
r += GET_RESULT ((color6&0x00ffffff), (color5&0x00ffffff), (color4&0x00ffffff), (colorB1&0x00ffffff));
r += GET_RESULT ((color6&0x00ffffff), (color5&0x00ffffff), (colorA2&0x00ffffff), (colorS1&0x00ffffff));
r += GET_RESULT ((color6&0x00ffffff), (color5&0x00ffffff), (colorB2&0x00ffffff), (colorS2&0x00ffffff));
if (r > 0)
product2b = product1b = color6;
else
if (r < 0)
product2b = product1b = color5;
else
{
product2b = product1b = INTERPOLATE8_02(color5, color6);
}
}
else
{
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
product2b = Q_INTERPOLATE8_02 (color3, color3, color3, color2);
else
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
product2b = Q_INTERPOLATE8_02 (color2, color2, color2, color3);
else
product2b = INTERPOLATE8_02 (color2, color3);
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
product1b = Q_INTERPOLATE8_02 (color6, color6, color6, color5);
else
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
product1b = Q_INTERPOLATE8_02 (color6, color5, color5, color5);
else
product1b = INTERPOLATE8_02 (color5, color6);
}
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
product2a = INTERPOLATE8_02(color2, color5);
else
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
product2a = INTERPOLATE8_02(color2, color5);
else
product2a = color2;
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
product1a = INTERPOLATE8_02(color2, color5);
else
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
product1a = INTERPOLATE8_02(color2, color5);
else
product1a = color5;
*dP=product1a;
*(dP+1)=product1b;
*(dP+(width2))=product2a;
*(dP+1+(width2))=product2b;
bP += 1;
dP += 2;
}//end of for ( finish= width etc..)
line += 2;
srcPtr += srcPitch;
}; //endof: for (; height; height--)
}
}
void Super2xSaI_ex8(unsigned char *srcPtr, DWORD srcPitch,
unsigned char *dstBitmap, int width, int height)
{
DWORD dstPitch = srcPitch * 2;
DWORD line;
DWORD *dP;
DWORD *bP;
int width2 = width*2;
int iXA,iXB,iXC,iYA,iYB,iYC,finish;
DWORD color4, color5, color6;
DWORD color1, color2, color3;
DWORD colorA0, colorA1, colorA2, colorA3,
colorB0, colorB1, colorB2, colorB3,
colorS1, colorS2;
DWORD product1a, product1b,
product2a, product2b;
line = 0;
{
for (; height; height-=1)
{
bP = (DWORD *)srcPtr;
dP = (DWORD *)(dstBitmap + line*dstPitch);
for (finish = width; finish; finish -= 1 )
{
//--------------------------------------- B1 B2
// 4 5 6 S2
// 1 2 3 S1
// A1 A2
if(finish==width) iXA=0;
else iXA=1;
if(finish>4) {iXB=1;iXC=2;}
else
if(finish>3) {iXB=1;iXC=1;}
else {iXB=0;iXC=0;}
if(line==0) iYA=0;
else iYA=width;
if(height>4) {iYB=width;iYC=width2;}
else
if(height>3) {iYB=width;iYC=width;}
else {iYB=0;iYC=0;}
colorB0 = *(bP- iYA - iXA);
colorB1 = *(bP- iYA);
colorB2 = *(bP- iYA + iXB);
colorB3 = *(bP- iYA + iXC);
color4 = *(bP - iXA);
color5 = *(bP);
color6 = *(bP + iXB);
colorS2 = *(bP + iXC);
color1 = *(bP + iYB - iXA);
color2 = *(bP + iYB);
color3 = *(bP + iYB + iXB);
colorS1= *(bP + iYB + iXC);
colorA0 = *(bP + iYC - iXA);
colorA1 = *(bP + iYC);
colorA2 = *(bP + iYC + iXB);
colorA3 = *(bP + iYC + iXC);
//--------------------------------------
if (color2 == color6 && color5 != color3)
{
product2b = product1b = color2;
}
else
if (color5 == color3 && color2 != color6)
{
product2b = product1b = color5;
}
else
if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GET_RESULT ((color6&0x00ffffff), (color5&0x00ffffff), (color1&0x00ffffff), (colorA1&0x00ffffff));
r += GET_RESULT ((color6&0x00ffffff), (color5&0x00ffffff), (color4&0x00ffffff), (colorB1&0x00ffffff));
r += GET_RESULT ((color6&0x00ffffff), (color5&0x00ffffff), (colorA2&0x00ffffff), (colorS1&0x00ffffff));
r += GET_RESULT ((color6&0x00ffffff), (color5&0x00ffffff), (colorB2&0x00ffffff), (colorS2&0x00ffffff));
if (r > 0)
product2b = product1b = color6;
else
if (r < 0)
product2b = product1b = color5;
else
{
product2b = product1b = INTERPOLATE8(color5, color6);
}
}
else
{
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
product2b = Q_INTERPOLATE8 (color3, color3, color3, color2);
else
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
product2b = Q_INTERPOLATE8 (color2, color2, color2, color3);
else
product2b = INTERPOLATE8 (color2, color3);
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
product1b = Q_INTERPOLATE8 (color6, color6, color6, color5);
else
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
product1b = Q_INTERPOLATE8 (color6, color5, color5, color5);
else
product1b = INTERPOLATE8 (color5, color6);
}
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
product2a = INTERPOLATE8(color2, color5);
else
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
product2a = INTERPOLATE8(color2, color5);
else
product2a = color2;
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
product1a = INTERPOLATE8(color2, color5);
else
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
product1a = INTERPOLATE8(color2, color5);
else
product1a = color5;
*dP=product1a;
*(dP+1)=product1b;
*(dP+(width2))=product2a;
*(dP+1+(width2))=product2b;
bP += 1;
dP += 2;
}//end of for ( finish= width etc..)
line += 2;
srcPtr += srcPitch;
}; //endof: for (; height; height--)
}
}
/////////////////////////////////////////////////////////////////////////////
#define colorMask4 0x0000EEE0
#define lowPixelMask4 0x00001110
#define qcolorMask4 0x0000CCC0
#define qlowpixelMask4 0x00003330
#define INTERPOLATE4(A, B) ((((A & colorMask4) >> 1) + ((B & colorMask4) >> 1) + (A & B & lowPixelMask4))|((((A&0x0000000F)==0x00000006)?0x00000006:(((B&0x0000000F)==0x00000006)?0x00000006:(((A&0x0000000F)==0x00000000)?0x00000000:(((B&0x0000000F)==0x00000000)?0x00000000:0x0000000F))))))
#define Q_INTERPOLATE4(A, B, C, D) ((((A & qcolorMask4) >> 2) + ((B & qcolorMask4) >> 2) + ((C & qcolorMask4) >> 2) + ((D & qcolorMask4) >> 2) + ((((A & qlowpixelMask4) + (B & qlowpixelMask4) + (C & qlowpixelMask4) + (D & qlowpixelMask4)) >> 2) & qlowpixelMask4))| ((((A&0x0000000F)==0x00000006)?0x00000006:(((B&0x0000000F)==0x00000006)?0x00000006:(((C&0x0000000F)==0x00000006)?0x00000006:(((D&0x0000000F)==0x00000006)?0x00000006:(((A&0x0000000F)==0x00000000)?0x00000000:(((B&0x0000000F)==0x00000000)?0x00000000:(((C&0x0000000F)==0x00000000)?0x00000000:(((D&0x0000000F)==0x00000000)?0x00000000:0x0000000F))))))))))
void Super2xSaI_ex4(unsigned char *srcPtr, DWORD srcPitch,
unsigned char *dstBitmap, int width, int height)
{
DWORD dstPitch = srcPitch * 2;
DWORD line;
unsigned short *dP;
unsigned short *bP;
int width2 = width*2;
int iXA,iXB,iXC,iYA,iYB,iYC,finish;
DWORD color4, color5, color6;
DWORD color1, color2, color3;
DWORD colorA0, colorA1, colorA2, colorA3,
colorB0, colorB1, colorB2, colorB3,
colorS1, colorS2;
DWORD product1a, product1b,
product2a, product2b;
line = 0;
{
for (; height; height-=1)
{
bP = (unsigned short *)srcPtr;
dP = (unsigned short *)(dstBitmap + line*dstPitch);
for (finish = width; finish; finish -= 1 )
{
//--------------------------------------- B1 B2
// 4 5 6 S2
// 1 2 3 S1
// A1 A2
if(finish==width) iXA=0;
else iXA=1;
if(finish>4) {iXB=1;iXC=2;}
else
if(finish>3) {iXB=1;iXC=1;}
else {iXB=0;iXC=0;}
if(line==0) iYA=0;
else iYA=width;
if(height>4) {iYB=width;iYC=width2;}
else
if(height>3) {iYB=width;iYC=width;}
else {iYB=0;iYC=0;}
colorB0 = *(bP- iYA - iXA);
colorB1 = *(bP- iYA);
colorB2 = *(bP- iYA + iXB);
colorB3 = *(bP- iYA + iXC);
color4 = *(bP - iXA);
color5 = *(bP);
color6 = *(bP + iXB);
colorS2 = *(bP + iXC);
color1 = *(bP + iYB - iXA);
color2 = *(bP + iYB);
color3 = *(bP + iYB + iXB);
colorS1= *(bP + iYB + iXC);
colorA0 = *(bP + iYC - iXA);
colorA1 = *(bP + iYC);
colorA2 = *(bP + iYC + iXB);
colorA3 = *(bP + iYC + iXC);
//--------------------------------------
if (color2 == color6 && color5 != color3)
{
product2b = product1b = color2;
}
else
if (color5 == color3 && color2 != color6)
{
product2b = product1b = color5;
}
else
if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GET_RESULT ((color6&0xfffffff0), (color5&0xfffffff0), (color1&0xfffffff0), (colorA1&0xfffffff0));
r += GET_RESULT ((color6&0xfffffff0), (color5&0xfffffff0), (color4&0xfffffff0), (colorB1&0xfffffff0));
r += GET_RESULT ((color6&0xfffffff0), (color5&0xfffffff0), (colorA2&0xfffffff0), (colorS1&0xfffffff0));
r += GET_RESULT ((color6&0xfffffff0), (color5&0xfffffff0), (colorB2&0xfffffff0), (colorS2&0xfffffff0));
if (r > 0)
product2b = product1b = color6;
else
if (r < 0)
product2b = product1b = color5;
else
{
product2b = product1b = INTERPOLATE4 (color5, color6);
}
}
else
{
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
product2b = Q_INTERPOLATE4 (color3, color3, color3, color2);
else
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
product2b = Q_INTERPOLATE4 (color2, color2, color2, color3);
else
product2b = INTERPOLATE4 (color2, color3);
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
product1b = Q_INTERPOLATE4 (color6, color6, color6, color5);
else
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
product1b = Q_INTERPOLATE4 (color6, color5, color5, color5);
else
product1b = INTERPOLATE4 (color5, color6);
}
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
product2a = INTERPOLATE4 (color2, color5);
else
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
product2a = INTERPOLATE4(color2, color5);
else
product2a = color2;
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
product1a = INTERPOLATE4 (color2, color5);
else
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
product1a = INTERPOLATE4(color2, color5);
else
product1a = color5;
*dP=product1a;
*(dP+1)=product1b;
*(dP+(width2))=product2a;
*(dP+1+(width2))=product2b;
bP += 1;
dP += 2;
}//end of for ( finish= width etc..)
line += 2;
srcPtr += srcPitch;
}; //endof: for (; height; height--)
}
}
/////////////////////////////////////////////////////////////////////////////
#define colorMask5 0x0000F7BC
#define lowPixelMask5 0x00000842
#define qcolorMask5 0x0000E738
#define qlowpixelMask5 0x000018C6
#define INTERPOLATE5(A, B) ((((A & colorMask5) >> 1) + ((B & colorMask5) >> 1) + (A & B & lowPixelMask5))|((((A&0x00000001)==0x00000000)?0x00000000:(((B&0x00000001)==0x00000000)?0x00000000:0x00000001))))
#define Q_INTERPOLATE5(A, B, C, D) ((((A & qcolorMask5) >> 2) + ((B & qcolorMask5) >> 2) + ((C & qcolorMask5) >> 2) + ((D & qcolorMask5) >> 2) + ((((A & qlowpixelMask5) + (B & qlowpixelMask5) + (C & qlowpixelMask5) + (D & qlowpixelMask5)) >> 2) & qlowpixelMask5))| ((((A&0x00000001)==0x00000000)?0x00000000:(((B&0x00000001)==0x00000000)?0x00000000:(((C&0x00000001)==0x00000000)?0x00000000:(((D&0x00000001)==0x00000000)?0x00000000:0x00000001))))))
void Super2xSaI_ex5(unsigned char *srcPtr, DWORD srcPitch,
unsigned char *dstBitmap, int width, int height)
{
DWORD dstPitch = srcPitch * 2;
DWORD line;
unsigned short *dP;
unsigned short *bP;
int width2 = width*2;
int iXA,iXB,iXC,iYA,iYB,iYC,finish;
DWORD color4, color5, color6;
DWORD color1, color2, color3;
DWORD colorA0, colorA1, colorA2, colorA3,
colorB0, colorB1, colorB2, colorB3,
colorS1, colorS2;
DWORD product1a, product1b,
product2a, product2b;
line = 0;
{
for (; height; height-=1)
{
bP = (unsigned short *)srcPtr;
dP = (unsigned short *)(dstBitmap + line*dstPitch);
for (finish = width; finish; finish -= 1 )
{
//--------------------------------------- B1 B2
// 4 5 6 S2
// 1 2 3 S1
// A1 A2
if(finish==width) iXA=0;
else iXA=1;
if(finish>4) {iXB=1;iXC=2;}
else
if(finish>3) {iXB=1;iXC=1;}
else {iXB=0;iXC=0;}
if(line==0) iYA=0;
else iYA=width;
if(height>4) {iYB=width;iYC=width2;}
else
if(height>3) {iYB=width;iYC=width;}
else {iYB=0;iYC=0;}
colorB0 = *(bP- iYA - iXA);
colorB1 = *(bP- iYA);
colorB2 = *(bP- iYA + iXB);
colorB3 = *(bP- iYA + iXC);
color4 = *(bP - iXA);
color5 = *(bP);
color6 = *(bP + iXB);
colorS2 = *(bP + iXC);
color1 = *(bP + iYB - iXA);
color2 = *(bP + iYB);
color3 = *(bP + iYB + iXB);
colorS1= *(bP + iYB + iXC);
colorA0 = *(bP + iYC - iXA);
colorA1 = *(bP + iYC);
colorA2 = *(bP + iYC + iXB);
colorA3 = *(bP + iYC + iXC);
//--------------------------------------
if (color2 == color6 && color5 != color3)
{
product2b = product1b = color2;
}
else
if (color5 == color3 && color2 != color6)
{
product2b = product1b = color5;
}
else
if (color5 == color3 && color2 == color6)
{
register int r = 0;
r += GET_RESULT ((color6&0xfffffffe), (color5&0xfffffffe), (color1&0xfffffffe), (colorA1&0xfffffffe));
r += GET_RESULT ((color6&0xfffffffe), (color5&0xfffffffe), (color4&0xfffffffe), (colorB1&0xfffffffe));
r += GET_RESULT ((color6&0xfffffffe), (color5&0xfffffffe), (colorA2&0xfffffffe), (colorS1&0xfffffffe));
r += GET_RESULT ((color6&0xfffffffe), (color5&0xfffffffe), (colorB2&0xfffffffe), (colorS2&0xfffffffe));
if (r > 0)
product2b = product1b = color6;
else
if (r < 0)
product2b = product1b = color5;
else
{
product2b = product1b = INTERPOLATE5 (color5, color6);
}
}
else
{
if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
product2b = Q_INTERPOLATE5 (color3, color3, color3, color2);
else
if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
product2b = Q_INTERPOLATE5 (color2, color2, color2, color3);
else
product2b = INTERPOLATE5 (color2, color3);
if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
product1b = Q_INTERPOLATE5 (color6, color6, color6, color5);
else
if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
product1b = Q_INTERPOLATE5 (color6, color5, color5, color5);
else
product1b = INTERPOLATE5 (color5, color6);
}
if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
product2a = INTERPOLATE5 (color2, color5);
else
if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
product2a = INTERPOLATE5(color2, color5);
else
product2a = color2;
if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
product1a = INTERPOLATE5(color2, color5);
else
if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
product1a = INTERPOLATE5(color2, color5);
else
product1a = color5;
*dP=product1a;
*(dP+1)=product1b;
*(dP+(width2))=product2a;
*(dP+1+(width2))=product2b;
bP += 1;
dP += 2;
}//end of for ( finish= width etc..)
line += 2;
srcPtr += srcPitch;
}; //endof: for (; height; height--)
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// ogl texture defines
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void DefineSubTextureSortHiRes(void)
{
int x,y,dx2;
if(!gTexName)
{
glGenTextures(1, &gTexName);
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);
if(iFilterType)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
glTexImage2D(GL_TEXTURE_2D, 0, giWantedRGBA, 512, 512, 0, giWantedFMT, giWantedTYPE, texturebuffer);
}
else glBindTexture(GL_TEXTURE_2D, gTexName);
if(bGLExt && (iTexQuality==1 || iTexQuality==2))
{
if(DXTexS < 4 || DYTexS < 4 || iHiResTextures==2)
{
unsigned short * pS,*pD1,*pD2;
dx2=(DXTexS<<1);
pS=(unsigned short *)texturepart;
pD1=(unsigned short *)texturebuffer;
pD2=(unsigned short *)texturebuffer;
pD2+=dx2;
for(y=0;y<DYTexS;y++)
{
for(x=0;x<DXTexS;x++)
{
*(pD2+1)=*pD2=*(pD1+1)=*pD1=*pS;
pS++;
pD1+=2;
pD2+=2;
}
pD1+=dx2;
pD2+=dx2;
}
}
else
{
if(iTexQuality==1)
Super2xSaI_ex4(texturepart, DXTexS<<1, texturebuffer, DXTexS, DYTexS);
else
Super2xSaI_ex5(texturepart, DXTexS<<1, texturebuffer, DXTexS, DYTexS);
}
}
else
{
if(DXTexS < 4 || DYTexS < 4 || iHiResTextures==2)
{
uint32_t * pS,*pD1,*pD2;
dx2=(DXTexS<<1);
pS=(uint32_t *)texturepart;
pD1=(uint32_t *)texturebuffer;
pD2=(uint32_t *)texturebuffer;
pD2+=dx2;
for(y=0;y<DYTexS;y++)
{
for(x=0;x<DXTexS;x++)
{
*(pD2+1)=*pD2=*(pD1+1)=*pD1=*pS;
pS++;
pD1+=2;
pD2+=2;
}
pD1+=dx2;
pD2+=dx2;
}
}
else
if(bSmallAlpha)
Super2xSaI_ex8_Ex(texturepart, DXTexS*4, texturebuffer, DXTexS, DYTexS);
else
Super2xSaI_ex8(texturepart, DXTexS*4, texturebuffer, DXTexS, DYTexS);
}
glTexSubImage2D(GL_TEXTURE_2D, 0, XTexS<<1, YTexS<<1,
DXTexS<<1, DYTexS<<1,
giWantedFMT, giWantedTYPE, texturebuffer);
}
/////////////////////////////////////////////////////////////////////////////
void DefineSubTextureSort(void)
{
if(iHiResTextures)
{
DefineSubTextureSortHiRes();
return;
}
if(!gTexName)
{
glGenTextures(1, &gTexName);
glBindTexture(GL_TEXTURE_2D, gTexName);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, iClampType);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, iClampType);
if(iFilterType)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
glTexImage2D(GL_TEXTURE_2D, 0, giWantedRGBA, 256, 256, 0,giWantedFMT, giWantedTYPE, texturepart);
}
else glBindTexture(GL_TEXTURE_2D, gTexName);
glTexSubImage2D(GL_TEXTURE_2D, 0, XTexS, YTexS,
DXTexS, DYTexS,
giWantedFMT, giWantedTYPE, texturepart);
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// texture cache garbage collection
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void DoTexGarbageCollection(void)
{
static unsigned short LRUCleaned=0;
unsigned short iC,iC1,iC2;
int i,j,iMax;textureSubCacheEntryS * tsb;
iC=4;//=iSortTexCnt/2,
LRUCleaned+=iC; // we clean different textures each time
if((LRUCleaned+iC)>=iSortTexCnt) LRUCleaned=0; // wrap? wrap!
iC1=LRUCleaned; // range of textures to clean
iC2=LRUCleaned+iC;
for(iC=iC1;iC<iC2;iC++) // make some textures available
{
pxSsubtexLeft[iC]->l=0;
}
for(i=0;i<3;i++) // remove all references to that textures
for(j=0;j<MAXTPAGES;j++)
for(iC=0;iC<4;iC++) // loop all texture rect info areas
{
tsb=pscSubtexStore[i][j]+(iC*SOFFB);
iMax=tsb->pos.l;
if(iMax)
do
{
tsb++;
if(tsb->cTexID>=iC1 && tsb->cTexID<iC2) // info uses the cleaned textures? remove info
tsb->ClutID=0;
}
while(--iMax);
}
usLRUTexPage=LRUCleaned;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// search cache for existing (already used) parts
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
unsigned char * CheckTextureInSubSCache(int TextureMode, uint32_t GivenClutId, unsigned short * pCache)
{
textureSubCacheEntryS * tsx, * tsb, *tsg;//, *tse=NULL;
int i,iMax;EXLong npos;
unsigned char cx,cy;
int iC,j,k;uint32_t rx,ry,mx,my;
EXLong * ul=0, * uls;
EXLong rfree;
unsigned char cXAdj,cYAdj;
npos.l=*((uint32_t *)&gl_ux[4]);
//--------------------------------------------------------------//
// find matching texturepart first... speed up...
//--------------------------------------------------------------//
tsg=pscSubtexStore[TextureMode][GlobalTexturePage];
tsg+=((GivenClutId&CLUTCHK)>>CLUTSHIFT)*SOFFB;
iMax=tsg->pos.l;
if(iMax)
{
i=iMax;
tsb=tsg+1;
do
{
if(GivenClutId==tsb->ClutID &&
(INCHECK(tsb->pos,npos)))
{
{
cx=tsb->pos.c[3]-tsb->posTX;
cy=tsb->pos.c[1]-tsb->posTY;
gl_ux[0]-=cx;
gl_ux[1]-=cx;
gl_ux[2]-=cx;
gl_ux[3]-=cx;
gl_vy[0]-=cy;
gl_vy[1]-=cy;
gl_vy[2]-=cy;
gl_vy[3]-=cy;
ubOpaqueDraw=tsb->Opaque;
*pCache=tsb->cTexID;
return NULL;
}
}
tsb++;
}
while(--i);
}
//----------------------------------------------------//
cXAdj=1;cYAdj=1;
rx=(int)gl_ux[6]-(int)gl_ux[7];
ry=(int)gl_ux[4]-(int)gl_ux[5];
tsx=NULL;tsb=tsg+1;
for(i=0;i<iMax;i++,tsb++)
{
if(!tsb->ClutID) {tsx=tsb;break;}
}
if(!tsx)
{
iMax++;
if(iMax>=SOFFB-2)
{
if(iTexGarbageCollection) // gc mode?
{
if(*pCache==0)
{
dwTexPageComp|=(1<<GlobalTexturePage);
*pCache=0xffff;
return 0;
}
iMax--;
tsb=tsg+1;
for(i=0;i<iMax;i++,tsb++) // 1. search other slots with same cluts, and unite the area
if(GivenClutId==tsb->ClutID)
{
if(!tsx) {tsx=tsb;rfree.l=npos.l;} //
else tsb->ClutID=0;
rfree.c[3]=min(rfree.c[3],tsb->pos.c[3]);
rfree.c[2]=max(rfree.c[2],tsb->pos.c[2]);
rfree.c[1]=min(rfree.c[1],tsb->pos.c[1]);
rfree.c[0]=max(rfree.c[0],tsb->pos.c[0]);
MarkFree(tsb);
}
if(tsx) // 3. if one or more found, create a new rect with bigger size
{
*((uint32_t *)&gl_ux[4])=npos.l=rfree.l;
rx=(int)rfree.c[2]-(int)rfree.c[3];
ry=(int)rfree.c[0]-(int)rfree.c[1];
DoTexGarbageCollection();
goto ENDLOOP3;
}
}
iMax=1;
}
tsx=tsg+iMax;
tsg->pos.l=iMax;
}
//----------------------------------------------------//
// now get a free texture space
//----------------------------------------------------//
if(iTexGarbageCollection) usLRUTexPage=0;
ENDLOOP3:
rx+=3;if(rx>255) {cXAdj=0;rx=255;}
ry+=3;if(ry>255) {cYAdj=0;ry=255;}
iC=usLRUTexPage;
for(k=0;k<iSortTexCnt;k++)
{
uls=pxSsubtexLeft[iC];
iMax=uls->l;ul=uls+1;
//--------------------------------------------------//
// first time
if(!iMax)
{
rfree.l=0;
if(rx>252 && ry>252)
{uls->l=1;ul->l=0xffffffff;ul=0;goto ENDLOOP;}
if(rx<253)
{
uls->l=uls->l+1;
ul->c[3]=rx;
ul->c[2]=255-rx;
ul->c[1]=0;
ul->c[0]=ry;
ul++;
}
if(ry<253)
{
uls->l=uls->l+1;
ul->c[3]=0;
ul->c[2]=255;
ul->c[1]=ry;
ul->c[0]=255-ry;
}
ul=0;
goto ENDLOOP;
}
//--------------------------------------------------//
for(i=0;i<iMax;i++,ul++)
{
if(ul->l!=0xffffffff &&
ry<=ul->c[0] &&
rx<=ul->c[2])
{
rfree=*ul;
mx=ul->c[2]-2;
my=ul->c[0]-2;
if(rx<mx && ry<my)
{
ul->c[3]+=rx;
ul->c[2]-=rx;
ul->c[0]=ry;
for(ul=uls+1,j=0;j<iMax;j++,ul++)
if(ul->l==0xffffffff) break;
if(j<CSUBSIZE-2)
{
if(j==iMax) uls->l=uls->l+1;
ul->c[3]=rfree.c[3];
ul->c[2]=rfree.c[2];
ul->c[1]=rfree.c[1]+ry;
ul->c[0]=rfree.c[0]-ry;
}
}
else if(rx<mx)
{
ul->c[3]+=rx;
ul->c[2]-=rx;
}
else if(ry<my)
{
ul->c[1]+=ry;
ul->c[0]-=ry;
}
else
{
ul->l=0xffffffff;
}
ul=0;
goto ENDLOOP;
}
}
//--------------------------------------------------//
iC++; if(iC>=iSortTexCnt) iC=0;
}
//----------------------------------------------------//
// check, if free space got
//----------------------------------------------------//
ENDLOOP:
if(ul)
{
//////////////////////////////////////////////////////
{
dwTexPageComp=0;
for(i=0;i<3;i++) // cleaning up
for(j=0;j<MAXTPAGES;j++)
{
tsb=pscSubtexStore[i][j];
(tsb+SOFFA)->pos.l=0;
(tsb+SOFFB)->pos.l=0;
(tsb+SOFFC)->pos.l=0;
(tsb+SOFFD)->pos.l=0;
}
for(i=0;i<iSortTexCnt;i++)
{ul=pxSsubtexLeft[i];ul->l=0;}
usLRUTexPage=0;
}
//////////////////////////////////////////////////////
iC=usLRUTexPage;
uls=pxSsubtexLeft[usLRUTexPage];
uls->l=0;ul=uls+1;
rfree.l=0;
if(rx>252 && ry>252)
{uls->l=1;ul->l=0xffffffff;}
else
{
if(rx<253)
{
uls->l=uls->l+1;
ul->c[3]=rx;
ul->c[2]=255-rx;
ul->c[1]=0;
ul->c[0]=ry;
ul++;
}
if(ry<253)
{
uls->l=uls->l+1;
ul->c[3]=0;
ul->c[2]=255;
ul->c[1]=ry;
ul->c[0]=255-ry;
}
}
tsg->pos.l=1;tsx=tsg+1;
}
rfree.c[3]+=cXAdj;
rfree.c[1]+=cYAdj;
tsx->cTexID =*pCache=iC;
tsx->pos = npos;
tsx->ClutID = GivenClutId;
tsx->posTX = rfree.c[3];
tsx->posTY = rfree.c[1];
cx=gl_ux[7]-rfree.c[3];
cy=gl_ux[5]-rfree.c[1];
gl_ux[0]-=cx;
gl_ux[1]-=cx;
gl_ux[2]-=cx;
gl_ux[3]-=cx;
gl_vy[0]-=cy;
gl_vy[1]-=cy;
gl_vy[2]-=cy;
gl_vy[3]-=cy;
XTexS=rfree.c[3];
YTexS=rfree.c[1];
return &tsx->Opaque;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// search cache for free place (on compress)
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
BOOL GetCompressTexturePlace(textureSubCacheEntryS * tsx)
{
int i,j,k,iMax,iC;uint32_t rx,ry,mx,my;
EXLong * ul=0, * uls, rfree;
unsigned char cXAdj=1,cYAdj=1;
rx=(int)tsx->pos.c[2]-(int)tsx->pos.c[3];
ry=(int)tsx->pos.c[0]-(int)tsx->pos.c[1];
rx+=3;if(rx>255) {cXAdj=0;rx=255;}
ry+=3;if(ry>255) {cYAdj=0;ry=255;}
iC=usLRUTexPage;
for(k=0;k<iSortTexCnt;k++)
{
uls=pxSsubtexLeft[iC];
iMax=uls->l;ul=uls+1;
//--------------------------------------------------//
// first time
if(!iMax)
{
rfree.l=0;
if(rx>252 && ry>252)
{uls->l=1;ul->l=0xffffffff;ul=0;goto TENDLOOP;}
if(rx<253)
{
uls->l=uls->l+1;
ul->c[3]=rx;
ul->c[2]=255-rx;
ul->c[1]=0;
ul->c[0]=ry;
ul++;
}
if(ry<253)
{
uls->l=uls->l+1;
ul->c[3]=0;
ul->c[2]=255;
ul->c[1]=ry;
ul->c[0]=255-ry;
}
ul=0;
goto TENDLOOP;
}
//--------------------------------------------------//
for(i=0;i<iMax;i++,ul++)
{
if(ul->l!=0xffffffff &&
ry<=ul->c[0] &&
rx<=ul->c[2])
{
rfree=*ul;
mx=ul->c[2]-2;
my=ul->c[0]-2;
if(rx<mx && ry<my)
{
ul->c[3]+=rx;
ul->c[2]-=rx;
ul->c[0]=ry;
for(ul=uls+1,j=0;j<iMax;j++,ul++)
if(ul->l==0xffffffff) break;
if(j<CSUBSIZE-2)
{
if(j==iMax) uls->l=uls->l+1;
ul->c[3]=rfree.c[3];
ul->c[2]=rfree.c[2];
ul->c[1]=rfree.c[1]+ry;
ul->c[0]=rfree.c[0]-ry;
}
}
else if(rx<mx)
{
ul->c[3]+=rx;
ul->c[2]-=rx;
}
else if(ry<my)
{
ul->c[1]+=ry;
ul->c[0]-=ry;
}
else
{
ul->l=0xffffffff;
}
ul=0;
goto TENDLOOP;
}
}
//--------------------------------------------------//
iC++; if(iC>=iSortTexCnt) iC=0;
}
//----------------------------------------------------//
// check, if free space got
//----------------------------------------------------//
TENDLOOP:
if(ul) return FALSE;
rfree.c[3]+=cXAdj;
rfree.c[1]+=cYAdj;
tsx->cTexID = iC;
tsx->posTX = rfree.c[3];
tsx->posTY = rfree.c[1];
XTexS=rfree.c[3];
YTexS=rfree.c[1];
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// compress texture cache (to make place for new texture part, if needed)
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void CompressTextureSpace(void)
{
textureSubCacheEntryS * tsx, * tsg, * tsb;
int i,j,k,m,n,iMax;EXLong * ul, r,opos;
short sOldDST=DrawSemiTrans,cx,cy;
int lOGTP=GlobalTexturePage;
uint32_t l,row;
uint32_t *lSRCPtr;
opos.l=*((uint32_t *)&gl_ux[4]);
// 1. mark all textures as free
for(i=0;i<iSortTexCnt;i++)
{ul=pxSsubtexLeft[i];ul->l=0;}
usLRUTexPage=0;
// 2. compress
for(j=0;j<3;j++)
{
for(k=0;k<MAXTPAGES;k++)
{
tsg=pscSubtexStore[j][k];
if((!(dwTexPageComp&(1<<k))))
{
(tsg+SOFFA)->pos.l=0;
(tsg+SOFFB)->pos.l=0;
(tsg+SOFFC)->pos.l=0;
(tsg+SOFFD)->pos.l=0;
continue;
}
for(m=0;m<4;m++,tsg+=SOFFB)
{
iMax=tsg->pos.l;
tsx=tsg+1;
for(i=0;i<iMax;i++,tsx++)
{
if(tsx->ClutID)
{
r.l=tsx->pos.l;
for(n=i+1,tsb=tsx+1;n<iMax;n++,tsb++)
{
if(tsx->ClutID==tsb->ClutID)
{
r.c[3]=min(r.c[3],tsb->pos.c[3]);
r.c[2]=max(r.c[2],tsb->pos.c[2]);
r.c[1]=min(r.c[1],tsb->pos.c[1]);
r.c[0]=max(r.c[0],tsb->pos.c[0]);
tsb->ClutID=0;
}
}
// if(r.l!=tsx->pos.l)
{
cx=((tsx->ClutID << 4) & 0x3F0);
cy=((tsx->ClutID >> 6) & CLUTYMASK);
if(j!=2)
{
// palette check sum
l=0;lSRCPtr=(uint32_t *)(psxVuw+cx+(cy*1024));
if(j==1) for(row=1;row<129;row++) l+=((*lSRCPtr++)-1)*row;
else for(row=1;row<9;row++) l+=((*lSRCPtr++)-1)<<row;
l=((l+HIWORD(l))&0x3fffL)<<16;
if(l!=(tsx->ClutID&(0x00003fff<<16)))
{
tsx->ClutID=0;continue;
}
}
tsx->pos.l=r.l;
if(!GetCompressTexturePlace(tsx)) // no place?
{
for(i=0;i<3;i++) // -> clean up everything
for(j=0;j<MAXTPAGES;j++)
{
tsb=pscSubtexStore[i][j];
(tsb+SOFFA)->pos.l=0;
(tsb+SOFFB)->pos.l=0;
(tsb+SOFFC)->pos.l=0;
(tsb+SOFFD)->pos.l=0;
}
for(i=0;i<iSortTexCnt;i++)
{ul=pxSsubtexLeft[i];ul->l=0;}
usLRUTexPage=0;
DrawSemiTrans=sOldDST;
GlobalTexturePage=lOGTP;
*((uint32_t *)&gl_ux[4])=opos.l;
dwTexPageComp=0;
return;
}
if(tsx->ClutID&(1<<30)) DrawSemiTrans=1;
else DrawSemiTrans=0;
*((uint32_t *)&gl_ux[4])=r.l;
gTexName=uiStexturePage[tsx->cTexID];
LoadSubTexFn(k,j,cx,cy);
uiStexturePage[tsx->cTexID]=gTexName;
tsx->Opaque=ubOpaqueDraw;
}
}
}
if(iMax)
{
tsx=tsg+iMax;
while(!tsx->ClutID && iMax) {tsx--;iMax--;}
tsg->pos.l=iMax;
}
}
}
}
if(dwTexPageComp==0xffffffff) dwTexPageComp=0;
*((uint32_t *)&gl_ux[4])=opos.l;
GlobalTexturePage=lOGTP;
DrawSemiTrans=sOldDST;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//
// main entry for searching/creating textures, called from prim.c
//
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
GLuint SelectSubTextureS(int TextureMode, uint32_t GivenClutId)
{
unsigned char * OPtr;unsigned short iCache;short cx,cy;
// sort sow/tow infos for fast access
unsigned char ma1,ma2,mi1,mi2;
if(gl_ux[0]>gl_ux[1]) {mi1=gl_ux[1];ma1=gl_ux[0];}
else {mi1=gl_ux[0];ma1=gl_ux[1];}
if(gl_ux[2]>gl_ux[3]) {mi2=gl_ux[3];ma2=gl_ux[2];}
else {mi2=gl_ux[2];ma2=gl_ux[3];}
if(mi1>mi2) gl_ux[7]=mi2;
else gl_ux[7]=mi1;
if(ma1>ma2) gl_ux[6]=ma1;
else gl_ux[6]=ma2;
if(gl_vy[0]>gl_vy[1]) {mi1=gl_vy[1];ma1=gl_vy[0];}
else {mi1=gl_vy[0];ma1=gl_vy[1];}
if(gl_vy[2]>gl_vy[3]) {mi2=gl_vy[3];ma2=gl_vy[2];}
else {mi2=gl_vy[2];ma2=gl_vy[3];}
if(mi1>mi2) gl_ux[5]=mi2;
else gl_ux[5]=mi1;
if(ma1>ma2) gl_ux[4]=ma1;
else gl_ux[4]=ma2;
// get clut infos in one 32 bit val
if(TextureMode==2) // no clut here
{
GivenClutId=CLUTUSED|(DrawSemiTrans<<30);cx=cy=0;
if(iFrameTexType && Fake15BitTexture())
return (GLuint)gTexName;
}
else
{
cx=((GivenClutId << 4) & 0x3F0); // but here
cy=((GivenClutId >> 6) & CLUTYMASK);
GivenClutId=(GivenClutId&CLUTMASK)|(DrawSemiTrans<<30)|CLUTUSED;
// palette check sum.. removed MMX asm, this easy func works as well
{
uint32_t l=0,row;
uint32_t *lSRCPtr = (uint32_t *)(psxVuw+cx+(cy*1024));
if(TextureMode==1) for(row=1;row<129;row++) l+=((*lSRCPtr++)-1)*row;
else for(row=1;row<9;row++) l+=((*lSRCPtr++)-1)<<row;
l=(l+HIWORD(l))&0x3fffL;
GivenClutId|=(l<<16);
}
}
// search cache
iCache=0;
OPtr=CheckTextureInSubSCache(TextureMode,GivenClutId,&iCache);
// cache full? compress and try again
if(iCache==0xffff)
{
CompressTextureSpace();
OPtr=CheckTextureInSubSCache(TextureMode,GivenClutId,&iCache);
}
// found? fine
usLRUTexPage=iCache;
if(!OPtr) return uiStexturePage[iCache];
// not found? upload texture and store infos in cache
gTexName=uiStexturePage[iCache];
LoadSubTexFn(GlobalTexturePage,TextureMode,cx,cy);
uiStexturePage[iCache]=gTexName;
*OPtr=ubOpaqueDraw;
return (GLuint) gTexName;
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
|
iCatButler/pcsxr
|
plugins/peopsxgl/texture.c
|
C
|
gpl-3.0
| 137,790 |
<?php
// Heading
$_['heading_title'] = '商品查看报告';
// Text
$_['text_list'] = '商品查看清单';
$_['text_success'] = '成功: 商品查看报告已重置 !';
// Column
$_['column_name'] = '商品名称';
$_['column_model'] = '型号';
$_['column_viewed'] = '已查看';
$_['column_percent'] = '百分比';
// Error
$_['error_permission'] = '警告: 您没有权限重置商品查看报告 !';
|
zhuoahe/zzz
|
upload/admin/language/zh-CN/report/product_viewed.php
|
PHP
|
gpl-3.0
| 440 |
package org.owasp.seraphimdroid;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import org.owasp.seraphimdroid.model.PermissionData;
public class PermissionDescription extends Activity {
private TextView tvPermissionHeader;
private TextView tvPermissionDescription;
private TextView tvMaliciousUseDescription;
private PermissionGetter permissionGetter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_permission_description);
this.setFinishOnTouchOutside(false);
this.setTitle("Description");
// Initializing views.
tvPermissionHeader = (TextView) this
.findViewById(R.id.tvPermissionHeader);
tvPermissionDescription = (TextView) this
.findViewById(R.id.tvPermissionDescription);
tvMaliciousUseDescription = (TextView) this
.findViewById(R.id.tvMaliciousUseDescription);
Button btnFinish = (Button) findViewById(R.id.btn_finish);
btnFinish.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
PermissionDescription.this.finish();
}
});
permissionGetter = new PermissionGetter(getPackageManager(), this);
// Getting required Data
String permission = getIntent().getStringExtra("PERMISSION_NAME");
PermissionData pd = null;
pd = permissionGetter.generatePermissionData(permission);
// Setting view properties.
if (pd != null) {
tvPermissionHeader.setText(pd.getPermissionName());
tvPermissionDescription.setText(pd.getDescription());
tvMaliciousUseDescription.setText(pd.getMaliciousUseDescription());
}
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
}
|
nikolamilosevic86/owasp-seraphimdroid
|
Seraphimdroid/app/src/main/java/org/owasp/seraphimdroid/PermissionDescription.java
|
Java
|
gpl-3.0
| 1,902 |
/**
* This file was generated from "mine.bmp" using...
*
* file2c -dn mines_mine -f mine.bmp mine.bmp ../romfs_mine.h
*
*/
char mines_mine[] = {
0x42, 0x4D, 0xCE, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8A, 0x00, 0x00, 0x00, 0x7C, 0x00,
0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x03, 0x00,
0x00, 0x00, 0x44, 0x08, 0x00, 0x00, 0x23, 0x2E, 0x00, 0x00, 0x23, 0x2E, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF,
0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x1D, 0x52, 0x5F, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x2E, 0xB4, 0xD6, 0xFF, 0x3C, 0xB1, 0xCE, 0xFF, 0x40, 0xB0, 0xCC, 0xFF, 0x39,
0xB6, 0xD1, 0xFF, 0x37, 0xBB, 0xCF, 0xFF, 0x2F, 0xB8, 0xD5, 0xFF, 0x52, 0xA8, 0xB9, 0xFF, 0x3E,
0x62, 0x6D, 0xFF, 0x33, 0x52, 0x5C, 0xFF, 0x31, 0x4B, 0x55, 0xFF, 0x2B, 0x43, 0x4E, 0xFF, 0x2A,
0x44, 0x4F, 0xFF, 0x34, 0x52, 0x5A, 0xFF, 0x4E, 0x70, 0x77, 0xFF, 0x76, 0x9C, 0xA3, 0xFF, 0x88,
0xB1, 0xBB, 0xFF, 0x58, 0xB6, 0xCC, 0xFF, 0x2F, 0xB8, 0xD5, 0xFF, 0x3B, 0xAC, 0xCD, 0xFF, 0x38,
0xB9, 0xD0, 0xFF, 0x45, 0xBA, 0xCB, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x35,
0xC0, 0xD5, 0xFF, 0x3B, 0xAF, 0xD1, 0xFF, 0x3A, 0xB4, 0xD2, 0xFF, 0x3E, 0xB1, 0xD2, 0xFF, 0x32,
0xBC, 0xDA, 0xFF, 0x45, 0x99, 0xAD, 0xFF, 0x17, 0x25, 0x30, 0xFF, 0x0A, 0x10, 0x18, 0xFF, 0x18,
0x1D, 0x21, 0xFF, 0x25, 0x28, 0x2C, 0xFF, 0x29, 0x2C, 0x2F, 0xFF, 0x22, 0x26, 0x29, 0xFF, 0x14,
0x19, 0x1E, 0xFF, 0x0C, 0x13, 0x1C, 0xFF, 0x28, 0x2E, 0x34, 0xFF, 0x7E, 0x80, 0x80, 0xFF, 0xAB,
0xB4, 0xB6, 0xFF, 0x4B, 0xBC, 0xD4, 0xFF, 0x3A, 0xB4, 0xD6, 0xFF, 0x37, 0xAA, 0xD5, 0xFF, 0x39,
0xB1, 0xD3, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x42, 0xAF, 0xCE, 0xFF, 0x41,
0xC4, 0xD3, 0xFF, 0x37, 0xC1, 0xD5, 0xFF, 0x37, 0xB6, 0xCD, 0xFF, 0x2C, 0x68, 0x77, 0xFF, 0x19,
0x2E, 0x3A, 0xFF, 0x22, 0x26, 0x28, 0xFF, 0x36, 0x35, 0x36, 0xFF, 0x3A, 0x3A, 0x39, 0xFF, 0x3F,
0x3F, 0x3E, 0xFF, 0x44, 0x44, 0x43, 0xFF, 0x46, 0x45, 0x45, 0xFF, 0x43, 0x44, 0x44, 0xFF, 0x39,
0x39, 0x3A, 0xFF, 0x1B, 0x1F, 0x25, 0xFF, 0x0F, 0x17, 0x21, 0xFF, 0x71, 0x73, 0x76, 0xFF, 0x51,
0xBB, 0xD1, 0xFF, 0x39, 0xB6, 0xD5, 0xFF, 0x3F, 0xB4, 0xD1, 0xFF, 0x3D, 0xAE, 0xD3, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x3F, 0xB1, 0xD1, 0xFF, 0x3A, 0xB4, 0xD2, 0xFF, 0x39,
0xB5, 0xCB, 0xFF, 0x2B, 0x6A, 0x7A, 0xFF, 0x1A, 0x2C, 0x35, 0xFF, 0x27, 0x28, 0x27, 0xFF, 0x21,
0x21, 0x20, 0xFF, 0x1B, 0x1B, 0x1B, 0xFF, 0x24, 0x24, 0x24, 0xFF, 0x25, 0x25, 0x25, 0xFF, 0x2C,
0x2C, 0x2C, 0xFF, 0x35, 0x35, 0x35, 0xFF, 0x3E, 0x3E, 0x3E, 0xFF, 0x39, 0x39, 0x38, 0xFF, 0x44,
0x43, 0x43, 0xFF, 0x29, 0x2C, 0x2E, 0xFF, 0x09, 0x12, 0x1C, 0xFF, 0x57, 0x9D, 0xB0, 0xFF, 0x42,
0xAC, 0xCE, 0xFF, 0x3E, 0xAA, 0xCE, 0xFF, 0x3C, 0xB1, 0xCE, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x33, 0xB1, 0xD1, 0xFF, 0x31, 0xB9, 0xD2, 0xFF, 0x4A, 0x93, 0xAB, 0xFF, 0x13,
0x28, 0x32, 0xFF, 0x1E, 0x1F, 0x1E, 0xFF, 0x13, 0x13, 0x13, 0xFF, 0x2E, 0x2E, 0x2F, 0xFF, 0x39,
0x39, 0x39, 0xFF, 0x09, 0x09, 0x09, 0xFF, 0x18, 0x18, 0x18, 0xFF, 0x19, 0x19, 0x19, 0xFF, 0x1D,
0x1D, 0x1D, 0xFF, 0x16, 0x16, 0x16, 0xFF, 0x4D, 0x4D, 0x4D, 0xFF, 0x2B, 0x2B, 0x2B, 0xFF, 0x43,
0x42, 0x41, 0xFF, 0x28, 0x29, 0x2C, 0xFF, 0x1E, 0x42, 0x51, 0xFF, 0x47, 0xAC, 0xC5, 0xFF, 0x4C,
0xAD, 0xC8, 0xFF, 0x49, 0xB7, 0xCB, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x3A,
0xC4, 0xCC, 0xFF, 0x35, 0xBA, 0xCA, 0xFF, 0x21, 0x43, 0x51, 0xFF, 0x15, 0x17, 0x19, 0xFF, 0x19,
0x18, 0x17, 0xFF, 0x19, 0x19, 0x19, 0xFF, 0x96, 0x96, 0x96, 0xFF, 0xAE, 0xAE, 0xAE, 0xFF, 0x38,
0x38, 0x38, 0xFF, 0x13, 0x13, 0x13, 0xFF, 0x15, 0x15, 0x15, 0xFF, 0x17, 0x17, 0x17, 0xFF, 0x55,
0x55, 0x55, 0xFF, 0xB8, 0xB8, 0xB8, 0xFF, 0x5C, 0x5C, 0x5C, 0xFF, 0x28, 0x28, 0x28, 0xFF, 0x3B,
0x3A, 0x3A, 0xFF, 0x19, 0x23, 0x2B, 0xFF, 0x3D, 0x7E, 0x8C, 0xFF, 0x31, 0xBA, 0xD3, 0xFF, 0x3B,
0xB7, 0xCD, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x36, 0xC5, 0xD2, 0xFF, 0x4C,
0x9B, 0xB2, 0xFF, 0x0F, 0x22, 0x2E, 0xFF, 0x1E, 0x1D, 0x1C, 0xFF, 0x1E, 0x1E, 0x1E, 0xFF, 0x1A,
0x1A, 0x1A, 0xFF, 0x19, 0x19, 0x19, 0xFF, 0x24, 0x24, 0x24, 0xFF, 0x71, 0x71, 0x71, 0xFF, 0x9E,
0x9E, 0x9E, 0xFF, 0x7F, 0x7F, 0x7F, 0xFF, 0xA1, 0xA1, 0xA1, 0xFF, 0x51, 0x51, 0x51, 0xFF, 0x1A,
0x1A, 0x1A, 0xFF, 0x15, 0x15, 0x15, 0xFF, 0x1A, 0x1A, 0x1A, 0xFF, 0x2D, 0x2E, 0x2D, 0xFF, 0x25,
0x26, 0x27, 0xFF, 0x2C, 0x52, 0x64, 0xFF, 0x50, 0xA9, 0xBD, 0xFF, 0x3C, 0xB6, 0xCC, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x3D, 0xB5, 0xCF, 0xFF, 0x31, 0x5A, 0x6C, 0xFF, 0x1D,
0x20, 0x25, 0xFF, 0x25, 0x24, 0x24, 0xFF, 0x25, 0x25, 0x25, 0xFF, 0x36, 0x36, 0x36, 0xFF, 0x52,
0x52, 0x52, 0xFF, 0x52, 0x52, 0x52, 0xFF, 0x6C, 0x6C, 0x6C, 0xFF, 0x79, 0x79, 0x79, 0xFF, 0x64,
0x64, 0x64, 0xFF, 0x7D, 0x7D, 0x7D, 0xFF, 0x61, 0x61, 0x61, 0xFF, 0x4E, 0x4E, 0x4E, 0xFF, 0x4A,
0x4A, 0x4A, 0xFF, 0x26, 0x26, 0x26, 0xFF, 0x18, 0x18, 0x17, 0xFF, 0x1F, 0x1F, 0x20, 0xFF, 0x19,
0x20, 0x29, 0xFF, 0x33, 0x84, 0x9E, 0xFF, 0x3C, 0xB9, 0xD0, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x3A, 0xB9, 0xC8, 0xFF, 0x1B, 0x47, 0x5A, 0xFF, 0x25, 0x26, 0x27, 0xFF, 0x2A,
0x2A, 0x29, 0xFF, 0x28, 0x28, 0x28, 0xFF, 0x49, 0x49, 0x49, 0xFF, 0xC3, 0xC3, 0xC3, 0xFF, 0x9A,
0x9A, 0x9A, 0xFF, 0x45, 0x45, 0x45, 0xFF, 0x45, 0x45, 0x45, 0xFF, 0x65, 0x65, 0x65, 0xFF, 0x2B,
0x2B, 0x2B, 0xFF, 0x5B, 0x5B, 0x5B, 0xFF, 0xAB, 0xAB, 0xAB, 0xFF, 0xAE, 0xAE, 0xAE, 0xFF, 0x27,
0x27, 0x27, 0xFF, 0x11, 0x11, 0x11, 0xFF, 0x11, 0x11, 0x11, 0xFF, 0x10, 0x14, 0x1B, 0xFF, 0x2B,
0x75, 0x88, 0xFF, 0x3A, 0xBA, 0xCA, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x32,
0xB3, 0xCE, 0xFF, 0x1B, 0x48, 0x5E, 0xFF, 0x31, 0x30, 0x2F, 0xFF, 0x35, 0x35, 0x35, 0xFF, 0x34,
0x34, 0x34, 0xFF, 0x3B, 0x3B, 0x3B, 0xFF, 0x98, 0x98, 0x98, 0xFF, 0x23, 0x23, 0x23, 0xFF, 0x32,
0x32, 0x32, 0xFF, 0xCA, 0xCA, 0xCA, 0xFF, 0xF3, 0xF3, 0xF3, 0xFF, 0x68, 0x68, 0x68, 0xFF, 0x08,
0x08, 0x08, 0xFF, 0x39, 0x39, 0x39, 0xFF, 0x91, 0x91, 0x91, 0xFF, 0x19, 0x19, 0x19, 0xFF, 0x19,
0x19, 0x19, 0xFF, 0x10, 0x0F, 0x0E, 0xFF, 0x0C, 0x10, 0x15, 0xFF, 0x2B, 0x72, 0x8C, 0xFF, 0x3E,
0xAB, 0xCA, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x3C, 0xB1, 0xCA, 0xFF, 0x20,
0x4B, 0x63, 0xFF, 0x39, 0x3A, 0x3A, 0xFF, 0x42, 0x42, 0x42, 0xFF, 0x44, 0x44, 0x44, 0xFF, 0x3B,
0x3B, 0x3B, 0xFF, 0x29, 0x29, 0x29, 0xFF, 0x73, 0x73, 0x73, 0xFF, 0xD8, 0xD8, 0xD8, 0xFF, 0xC3,
0xC3, 0xC3, 0xFF, 0x8F, 0x8F, 0x8F, 0xFF, 0xD7, 0xD7, 0xD7, 0xFF, 0xB8, 0xB8, 0xB8, 0xFF, 0x2B,
0x2B, 0x2B, 0xFF, 0x29, 0x29, 0x29, 0xFF, 0x25, 0x25, 0x25, 0xFF, 0x1E, 0x1E, 0x1E, 0xFF, 0x14,
0x14, 0x13, 0xFF, 0x0E, 0x12, 0x1A, 0xFF, 0x26, 0x73, 0x91, 0xFF, 0x35, 0xB7, 0xD3, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x42, 0xB9, 0xCA, 0xFF, 0x30, 0x5B, 0x71, 0xFF, 0x47,
0x49, 0x4D, 0xFF, 0x53, 0x52, 0x51, 0xFF, 0x53, 0x53, 0x53, 0xFF, 0x60, 0x60, 0x60, 0xFF, 0x39,
0x39, 0x39, 0xFF, 0x9B, 0x9B, 0x9B, 0xFF, 0x82, 0x82, 0x82, 0xFF, 0x6F, 0x6F, 0x6F, 0xFF, 0xD2,
0xD2, 0xD2, 0xFF, 0x40, 0x40, 0x40, 0xFF, 0xB6, 0xB6, 0xB6, 0xFF, 0x3C, 0x3C, 0x3C, 0xFF, 0x2F,
0x2F, 0x2F, 0xFF, 0x2B, 0x2B, 0x2B, 0xFF, 0x21, 0x21, 0x21, 0xFF, 0x18, 0x17, 0x18, 0xFF, 0x13,
0x1B, 0x24, 0xFF, 0x35, 0x7B, 0x8E, 0xFF, 0x49, 0xAF, 0xC5, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x33, 0xC3, 0xD9, 0xFF, 0x4C, 0x96, 0xAD, 0xFF, 0x3A, 0x4E, 0x5A, 0xFF, 0x71,
0x6F, 0x6D, 0xFF, 0x75, 0x75, 0x75, 0xFF, 0x7C, 0x7C, 0x7C, 0xFF, 0x59, 0x59, 0x59, 0xFF, 0x7E,
0x7E, 0x7E, 0xFF, 0xBE, 0xBE, 0xBE, 0xFF, 0xD2, 0xD2, 0xD2, 0xFF, 0xEF, 0xEF, 0xEF, 0xFF, 0xC7,
0xC7, 0xC7, 0xFF, 0x98, 0x98, 0x98, 0xFF, 0x34, 0x34, 0x34, 0xFF, 0x35, 0x35, 0x35, 0xFF, 0x31,
0x31, 0x31, 0xFF, 0x25, 0x25, 0x25, 0xFF, 0x17, 0x18, 0x19, 0xFF, 0x26, 0x49, 0x59, 0xFF, 0x41,
0xA7, 0xBF, 0xFF, 0x32, 0xB9, 0xD6, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x37,
0xB5, 0xD5, 0xFF, 0x39, 0xBA, 0xD2, 0xFF, 0x2C, 0x53, 0x68, 0xFF, 0x7B, 0x7B, 0x7B, 0xFF, 0x98,
0x97, 0x97, 0xFF, 0xAF, 0xAF, 0xAF, 0xFF, 0x9A, 0x9A, 0x9A, 0xFF, 0x79, 0x79, 0x79, 0xFF, 0x99,
0x99, 0x99, 0xFF, 0xE5, 0xE5, 0xE5, 0xFF, 0xF2, 0xF2, 0xF2, 0xFF, 0xC3, 0xC3, 0xC3, 0xFF, 0x4F,
0x4F, 0x4F, 0xFF, 0x3A, 0x3A, 0x3A, 0xFF, 0x3A, 0x3A, 0x3A, 0xFF, 0x33, 0x33, 0x33, 0xFF, 0x2B,
0x2A, 0x29, 0xFF, 0x18, 0x1F, 0x25, 0xFF, 0x35, 0x74, 0x8C, 0xFF, 0x37, 0xAF, 0xCE, 0xFF, 0x37,
0xB4, 0xD3, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x3D, 0xB9, 0xCB, 0xFF, 0x41,
0xB6, 0xC8, 0xFF, 0x45, 0x9E, 0xAE, 0xFF, 0x4B, 0x66, 0x72, 0xFF, 0xA3, 0xA1, 0x9F, 0xFF, 0xDC,
0xDC, 0xDC, 0xFF, 0xCA, 0xCA, 0xCA, 0xFF, 0xAD, 0xAD, 0xAD, 0xFF, 0x86, 0x86, 0x86, 0xFF, 0x68,
0x68, 0x68, 0xFF, 0x5A, 0x5A, 0x5A, 0xFF, 0x51, 0x51, 0x51, 0xFF, 0x52, 0x52, 0x52, 0xFF, 0x4E,
0x4E, 0x4E, 0xFF, 0x43, 0x43, 0x43, 0xFF, 0x39, 0x38, 0x38, 0xFF, 0x2E, 0x2E, 0x2F, 0xFF, 0x17,
0x30, 0x44, 0xFF, 0x45, 0x98, 0xA7, 0xFF, 0x37, 0xC0, 0xCD, 0xFF, 0x38, 0xB8, 0xCC, 0xFF, 0x28,
0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x39, 0xB6, 0xD1, 0xFF, 0x32, 0xB9, 0xD2, 0xFF, 0x43,
0xAE, 0xCA, 0xFF, 0x31, 0x7C, 0x90, 0xFF, 0x5F, 0x7A, 0x83, 0xFF, 0xC7, 0xC5, 0xC3, 0xFF, 0xE2,
0xE1, 0xE0, 0xFF, 0xD0, 0xD0, 0xD0, 0xFF, 0xB7, 0xB7, 0xB7, 0xFF, 0x9C, 0x9C, 0x9C, 0xFF, 0x8E,
0x8E, 0x8E, 0xFF, 0x78, 0x78, 0x78, 0xFF, 0x67, 0x67, 0x67, 0xFF, 0x56, 0x55, 0x55, 0xFF, 0x4C,
0x4A, 0x49, 0xFF, 0x3D, 0x3D, 0x3E, 0xFF, 0x1F, 0x36, 0x46, 0xFF, 0x18, 0x2D, 0x3E, 0xFF, 0x2B,
0x5C, 0x72, 0xFF, 0x42, 0xA7, 0xC6, 0xFF, 0x3E, 0xB1, 0xCE, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17,
0x42, 0x4D, 0xFF, 0x32, 0xC5, 0xD6, 0xFF, 0x43, 0xAE, 0xC1, 0xFF, 0x34, 0xBB, 0xD4, 0xFF, 0x33,
0xA7, 0xBF, 0xFF, 0x36, 0x7A, 0x8F, 0xFF, 0x50, 0x6B, 0x78, 0xFF, 0xAA, 0xAB, 0xAB, 0xFF, 0xC7,
0xC5, 0xC3, 0xFF, 0xB9, 0xB8, 0xB8, 0xFF, 0x9E, 0x9E, 0x9E, 0xFF, 0x8F, 0x8F, 0x8F, 0xFF, 0x7C,
0x7C, 0x7B, 0xFF, 0x6D, 0x6C, 0x6B, 0xFF, 0x5E, 0x5B, 0x59, 0xFF, 0x43, 0x4A, 0x4F, 0xFF, 0x21,
0x3B, 0x4E, 0xFF, 0x18, 0x30, 0x3F, 0xFF, 0x43, 0x41, 0x40, 0xFF, 0x2B, 0x37, 0x3E, 0xFF, 0x24,
0x7B, 0x9B, 0xFF, 0x3A, 0xAD, 0xCA, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x3C,
0xB6, 0xD0, 0xFF, 0x3B, 0xB3, 0xD1, 0xFF, 0x3A, 0xB5, 0xD4, 0xFF, 0x3E, 0xB1, 0xCE, 0xFF, 0x3D,
0xA8, 0xC4, 0xFF, 0x46, 0x95, 0xAF, 0xFF, 0x30, 0x5F, 0x73, 0xFF, 0x4F, 0x68, 0x75, 0xFF, 0x79,
0x7F, 0x82, 0xFF, 0x82, 0x83, 0x84, 0xFF, 0x7F, 0x7E, 0x7E, 0xFF, 0x6C, 0x6E, 0x70, 0xFF, 0x4F,
0x5A, 0x60, 0xFF, 0x2E, 0x53, 0x65, 0xFF, 0x1E, 0x4F, 0x67, 0xFF, 0x28, 0x45, 0x56, 0xFF, 0x88,
0x85, 0x83, 0xFF, 0x67, 0x6C, 0x6E, 0xFF, 0x22, 0x46, 0x5B, 0xFF, 0x4A, 0xA1, 0xC6, 0xFF, 0x3F,
0xB5, 0xCF, 0xFF, 0x28, 0x78, 0x8C, 0xFF, 0x17, 0x42, 0x4D, 0xFF, 0x3B, 0xBA, 0xD5, 0xFF, 0x43,
0xAE, 0xC9, 0xFF, 0x38, 0xC0, 0xD4, 0xFF, 0x27, 0xC3, 0xDF, 0xFF, 0x29, 0xBB, 0xDF, 0xFF, 0x35,
0xB2, 0xD6, 0xFF, 0x33, 0xB0, 0xCC, 0xFF, 0x4E, 0xA0, 0xB4, 0xFF, 0x31, 0x6F, 0x84, 0xFF, 0x26,
0x5F, 0x76, 0xFF, 0x23, 0x5C, 0x76, 0xFF, 0x27, 0x63, 0x7B, 0xFF, 0x3A, 0x77, 0x91, 0xFF, 0x4B,
0xA2, 0xBF, 0xFF, 0x2C, 0xA3, 0xC2, 0xFF, 0x50, 0x9B, 0xB3, 0xFF, 0x6D, 0x8C, 0x9A, 0xFF, 0x25,
0x4E, 0x67, 0xFF, 0x39, 0x90, 0xAF, 0xFF, 0x58, 0xAF, 0xCE, 0xFF, 0x3B, 0xB6, 0xD7, 0xFF, 0x45,
0x89, 0xB1, 0xFF, 0x2F, 0x58, 0x6E, 0xFF, 0x4A, 0xB1, 0xC0, 0xFF, 0x3D, 0xB8, 0xC7, 0xFF, 0x45,
0xB9, 0xC3, 0xFF, 0x42, 0xBA, 0xC2, 0xFF, 0x38, 0xBE, 0xCA, 0xFF, 0x38, 0xBF, 0xCC, 0xFF, 0x3A,
0xC5, 0xCA, 0xFF, 0x41, 0xBC, 0xC7, 0xFF, 0x44, 0xBD, 0xC8, 0xFF, 0x44, 0xC1, 0xC6, 0xFF, 0x3D,
0xBC, 0xC7, 0xFF, 0x3C, 0xB8, 0xCA, 0xFF, 0x38, 0xC3, 0xCC, 0xFF, 0x38, 0xB8, 0xCC, 0xFF, 0x37,
0xBC, 0xCF, 0xFF, 0x41, 0xBA, 0xC4, 0xFF, 0x4B, 0xBA, 0xC3, 0xFF, 0x4C, 0xB1, 0xC7, 0xFF, 0x5A,
0xB7, 0xC5, 0xFF, 0x5F, 0xC5, 0xDD, 0xFF, 0x65, 0xA9, 0xC3, 0xFF, 0x34, 0x82, 0xB1, 0xFF, 0x3E,
0x69, 0x8C, 0xFF, 0x2E, 0xC4, 0xD6, 0xFF, 0x31, 0xB6, 0xD7, 0xFF, 0x30, 0xC0, 0xDA, 0xFF, 0x34,
0xB9, 0xDA, 0xFF, 0x34, 0xB9, 0xDA, 0xFF, 0x2F, 0xC3, 0xD9, 0xFF, 0x2D, 0xB7, 0xD9, 0xFF, 0x2A,
0xBC, 0xDC, 0xFF, 0x39, 0xB6, 0xD1, 0xFF, 0x40, 0xAE, 0xCE, 0xFF, 0x3C, 0xC2, 0xD2, 0xFF, 0x37,
0xC1, 0xD5, 0xFF, 0x2E, 0xBC, 0xDA, 0xFF, 0x32, 0xC0, 0xD6, 0xFF, 0x2A, 0xBE, 0xD4, 0xFF, 0x34,
0xBA, 0xCE, 0xFF, 0x36, 0xB7, 0xCE, 0xFF, 0x32, 0xB7, 0xD4, 0xFF, 0x32, 0xB5, 0xD6, 0xFF, 0x3E,
0xB7, 0xCC, 0xFF, 0x45, 0xAC, 0xD1, 0xFF, 0x3B, 0xA3, 0xCB, 0xFF, 0x27, 0x71, 0xB1,
};
#ifdef ROMFS_DIRENTRY_HEAD
ROMFS_DIRENTRY mines_mine_dir = { 0, 0, ROMFS_DIRENTRY_HEAD, "mine.bmp", 2254, mines_mine };
#undef ROMFS_DIRENTRY_HEAD
#define ROMFS_DIRENTRY_HEAD &mines_mine_dir
#endif
|
TRothfelder/Multicopter
|
libs/ugfx/demos/games/minesweeper/resources/romfs/romfs_mine.h
|
C
|
gpl-3.0
| 14,175 |
package nl.knaw.huygens.timbuctoo.security.dataaccess;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import nl.knaw.huygens.timbuctoo.security.PermissionConfiguration;
import nl.knaw.huygens.timbuctoo.util.Tuple;
import nl.knaw.huygens.timbuctoo.v5.security.exceptions.AccessNotPossibleException;
import java.util.Iterator;
import java.util.Optional;
import java.util.function.Supplier;
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
public interface AccessFactory {
LoginAccess getLoginAccess() throws AccessNotPossibleException;
UserAccess getUserAccess() throws AccessNotPossibleException;
VreAuthorizationAccess getVreAuthorizationAccess() throws AccessNotPossibleException;
Iterator<Tuple<String, Supplier<Optional<String>>>> getHealthChecks();
PermissionConfiguration getPermissionConfig() throws AccessNotPossibleException;
}
|
HuygensING/timbuctoo
|
timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/security/dataaccess/AccessFactory.java
|
Java
|
gpl-3.0
| 911 |
function enter(pi) {
pi.showInstruction("Press #e#b[S]#k#n to view your character information.", 250, 5);
}
|
Maxcloud/Mushy
|
scripts/portal/advice08.js
|
JavaScript
|
gpl-3.0
| 111 |
// MonoGame - Copyright (C) The MonoGame Team
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
using System;
using System.Collections.Generic;
namespace Microsoft.Xna.Framework.Content.Pipeline
{
/// <summary>
/// Provides properties that identify and provide metadata about the importer, such as supported file extensions and caching information.
/// Importers are required to initialize this attribute.
/// </summary>
public class ContentImporterAttribute : Attribute
{
List<string> extensions = new List<string>();
/// <summary>
/// Gets and sets the caching of the content during importation.
/// </summary>
public bool CacheImportedData { get; set; }
/// <summary>
/// Gets or sets the name of the default processor for content read by this importer.
/// </summary>
public string DefaultProcessor { get; set; }
/// <summary>
/// Gets or sets the string representing the importer in a user interface. This name is not used by the content pipeline and should not be passed to the BuildAssets task (a custom MSBuild task used by XNA Game Studio). It is used for display purposes only.
/// </summary>
public virtual string DisplayName { get; set; }
/// <summary>
/// Gets the supported file name extensions of the importer.
/// </summary>
public IEnumerable<string> FileExtensions { get { return extensions; } }
/// <summary>
/// Initializes a new instance of ContentImporterAttribute and sets the file name extension supported by the importer.
/// </summary>
/// <param name="fileExtension">The list of file name extensions supported by the importer. Prefix each extension with a '.'.</param>
public ContentImporterAttribute(
string fileExtension
)
{
extensions.Add(fileExtension);
}
/// <summary>
/// Initializes a new instance of ContentImporterAttribute and sets the file name extensions supported by the importer.
/// </summary>
/// <param name="fileExtensions">The list of file name extensions supported by the importer. Prefix each extension with a '.'.</param>
public ContentImporterAttribute(
params string[] fileExtensions
)
{
extensions.AddRange(fileExtensions);
}
}
}
|
Blucky87/Otiose2D
|
src/libs/MonoGame/MonoGame.Framework.Content.Pipeline/ContentImporterAttribute.cs
|
C#
|
gpl-3.0
| 2,520 |
// tausolver.h: solves vector "tau" eqns (Canuto & Hussaini eqn 7.3.18-20)
// channelflow-1.3 www.channelflow.org
// copyright (C) 2001-2009 John F. Gibson, license declaration at end of file
#ifndef CHANNELFLOW_TAUSOLVER_H
#define CHANNELFLOW_TAUSOLVER_H
#include "channelflow/mathdefs.h"
#include "channelflow/helmholtz.h"
#include "channelflow/vector.h"
#include "channelflow/chebyshev.h"
namespace channelflow {
// Class for solving 7.3.18-7.3.20 of Canuto & Hussaini
// nu u''_jk(y) - lambda u_jk(y) - grad P_jk = -R_jk,
// div u_jk = 0
// u_jk(+-1) = 0
//
// where u_jk(y) is the vector-valued jkth xz-Fourier coeff of u(x,y,z)
// P(y) is in R
// and the vector operators are interpreted accordingingly (diff in x
// equal multiplication by 2 pi k).
Real divcheck(std::string& label, int kx, int kz, Real Lx, Real Lz,
const ComplexChebyCoeff& u, const ComplexChebyCoeff& v,
const ComplexChebyCoeff& w, bool verbose=false);
class TauSolver {
public:
TauSolver();
TauSolver(int kx, int kz, Real Lx, Real Lz, Real a, Real b, Real lambda,
Real nu, int Ny, bool tauCorrection=true);
//TauSolver(int kx, int kz, Real Lx, Real Lz, Real a, Real b, Real lambda,
//Real nu, int nChebyModes, bool dx_on=true, bool dz_on=true,
//bool tauCorrection=true);
//******Added by Peter H Heins***********
TauSolver(int kx, int kz, Real Lx, Real Lz, Real a, Real b, Real lambda,
Real nu, int Ny, Real vr_lower, Real vi_lower, Real vr_upper, Real vi_upper, bool tauCorrection=true);
//******End - Peter H Heins*************
void solve(ComplexChebyCoeff& u, ComplexChebyCoeff& v, ComplexChebyCoeff& w,
ComplexChebyCoeff& P, const ComplexChebyCoeff& Rx,
const ComplexChebyCoeff& Ry, const ComplexChebyCoeff& Rz) const;
//******Added by Peter H Heins***********
void solve_Inhom(ComplexChebyCoeff& u, ComplexChebyCoeff& v,
ComplexChebyCoeff& w, ComplexChebyCoeff& P, const ComplexChebyCoeff& Rx, const ComplexChebyCoeff& Ry, const ComplexChebyCoeff& Rz, Real vr_lower, Real vr_upper, Real vi_lower, Real vi_upper, Complex u_lower, Complex u_upper, Complex w_lower, Complex w_upper) const;
//******End - Peter H Heins**************
Real verify(const ComplexChebyCoeff& u, const ComplexChebyCoeff& v,
const ComplexChebyCoeff& w, const ComplexChebyCoeff& P,
const ComplexChebyCoeff& Rx, const ComplexChebyCoeff& Ry,
const ComplexChebyCoeff& Rz, bool verbose=false) const;
// Solve tau eqns with additional unknown, time-varying, -dPdx on LHS.
// and additional constraint mean(u) = umean.
void solve(ComplexChebyCoeff& u, ComplexChebyCoeff& v,
ComplexChebyCoeff& w, ComplexChebyCoeff& P,
Real& dPdx,
const ComplexChebyCoeff& Rx, const ComplexChebyCoeff& Ry,
const ComplexChebyCoeff& Rz, Real umean) const;
//******Added by Peter H Heins***********
void solve_Inhom(ComplexChebyCoeff& u, ComplexChebyCoeff& v, ComplexChebyCoeff& w, ComplexChebyCoeff& P, Real& dPdx, const ComplexChebyCoeff& Rx, const ComplexChebyCoeff& Ry, const ComplexChebyCoeff& Rz, Real vr_lower, Real vr_upper, Real vi_lower, Real vi_upper, Real umean) const;
//******End - Peter H Heins**************
Real verify(const ComplexChebyCoeff& u, const ComplexChebyCoeff& v,
const ComplexChebyCoeff& w, const ComplexChebyCoeff& P,
Real dPdx,
const ComplexChebyCoeff& Rx, const ComplexChebyCoeff& Ry,
const ComplexChebyCoeff& Rz, Real umean, bool verbose=false) const;
// Enforce v'(+-1)==0 with influence matrix method, leaving v(+-1)==0 and RHS unchanged.
void influenceCorrection(ChebyCoeff& P, ChebyCoeff& v) const;
// These are helper functions for the above, not meant to be used alone,
// but provided as public for testing purposes. r == div(R).
void solve_P_and_v(ChebyCoeff& P, ChebyCoeff& v,
const ChebyCoeff& r, const ChebyCoeff& Ry,
Real& sigmaNb1, Real& sigmaNb) const;
//******Added by Peter H Heins***********
void solve_P_and_v_inhom(ChebyCoeff& P, ChebyCoeff& v, ChebyCoeff& r, const ChebyCoeff& Ry, Real v_lower, Real v_upper, Real& sigmaNb1, Real& sigmaNb, const Real& sigma0_Nb_, const Real& sigma0_Nb1_) const;
//******End - Peter H Heins**************
Real verify_P_and_v(const ChebyCoeff& P, const ChebyCoeff& v,
const ChebyCoeff& r, const ChebyCoeff& Ry,
Real sigmaNb1, Real sigmaNb, bool verbose=false) const;
int kx() const {return kx_;}
int kz() const {return kz_;}
//Real kxLx() const{return kxLx_;}
//Real kzLz() const{return kzLz_;}
Real lambda() const{return lambda_;}
Real nu() const{return nu_;}
private:
int N_; // number of Chebyshev modes
int Nb_; // N-1. Convenience variable, corresponds to C&H's N.
int kx_; // x wave number
int kz_; // z wave number
Real two_pi_kxLx_; // 2 pi kx/Lx
Real two_pi_kzLz_; // 2 pi kz/Lz
Real kappa2_; // 4 pi^2 [(kx/Lx)^2 + (kz/Lz)^2]
Real a_;
Real b_;
Real lambda_;
Real nu_; // viscosity
bool tauCorrection_; // Try to eliminate tau errors in (P,v) solutions
HelmholtzSolver pressureHelmholtz_;
HelmholtzSolver velocityHelmholtz_;
// These quantities are constant in time in the tau algorithm.
// So they're initialized in the constructor and kept fixed.
ChebyCoeff P_0_;
ChebyCoeff v_0_;
ChebyCoeff P_plus_;
ChebyCoeff v_plus_;
ChebyCoeff P_minus_;
ChebyCoeff v_minus_;
//******Added by Peter H Heins*************
ChebyCoeff P_0_r;
ChebyCoeff v_0_r;
ChebyCoeff P_0_i;
ChebyCoeff v_0_i;
Real sigma0_Nb_r;
Real sigma0_Nb1_r;
Real sigma0_Nb_i;
Real sigma0_Nb1_i;
// Element of the inverse of the influence matrix.
Real i00_;
Real i01_;
Real i10_;
Real i11_;
Real sigma0_Nb1_; // tau correction factor for mode Nb-1
Real sigma0_Nb_; // tau correction factor for mode Nb
// L1 norm of first N-2 components of u.
Real tauNorm(const ChebyCoeff& u) const;
Real tauNorm(const ComplexChebyCoeff& u) const;
Real tauDist(const ChebyCoeff& u, const ChebyCoeff& v) const;
Real tauDist(const ComplexChebyCoeff& u, const ComplexChebyCoeff& v) const;
};
} //namespace channelflow
#endif
/* tausolver.h: solves vector "tau" eqns (Canuto & Hussaini eqn 7.3.18-20)
*
* channelflow-1.3, www.channelflow.org
*
* Copyright (C) 2001-2009 John F. Gibson
*
* [email protected]
* Center for Nonlinear Sciences, School of Physics
* Georgia Institute of Technology
* Atlanta, GA 30332-0430
*
* 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, U
*/
|
P-Heins/CFBC
|
Mac/tausolver.h
|
C
|
gpl-3.0
| 7,341 |
/* This is an implementation of the threads API of POSIX 1003.1-2001.
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2012 Pthreads-win32 contributors
*
* Homepage1: http://sourceware.org/pthreads-win32/
* Homepage2: http://sourceforge.net/projects/pthreads4w/
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* 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 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 in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined( PTHREAD_H )
#define PTHREAD_H
/*
* See the README file for an explanation of the pthreads-win32 version
* numbering scheme and how the DLL is named etc.
*/
#define PTW32_VERSION 2,10,0,0
#define PTW32_VERSION_STRING "2, 10, 0, 0\0"
/* There are three implementations of cancel cleanup.
* Note that pthread.h is included in both application
* compilation units and also internally for the library.
* The code here and within the library aims to work
* for all reasonable combinations of environments.
*
* The three implementations are:
*
* WIN32 SEH
* C
* C++
*
* Please note that exiting a push/pop block via
* "return", "exit", "break", or "continue" will
* lead to different behaviour amongst applications
* depending upon whether the library was built
* using SEH, C++, or C. For example, a library built
* with SEH will call the cleanup routine, while both
* C++ and C built versions will not.
*/
/*
* Define defaults for cleanup code.
* Note: Unless the build explicitly defines one of the following, then
* we default to standard C style cleanup. This style uses setjmp/longjmp
* in the cancellation and thread exit implementations and therefore won't
* do stack unwinding if linked to applications that have it (e.g.
* C++ apps). This is currently consistent with most/all commercial Unix
* POSIX threads implementations.
*/
#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C )
# define __CLEANUP_C
#endif
#if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC))
#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler.
#endif
/*
* Stop here if we are being included by the resource compiler.
*/
#if !defined(RC_INVOKED)
#undef PTW32_LEVEL
#if defined(_POSIX_SOURCE)
#define PTW32_LEVEL 0 /* Early POSIX */
#endif
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1 /* Include 1b, 1c and 1d */
#endif
#if defined(INCLUDE_NP)
#undef PTW32_LEVEL
#define PTW32_LEVEL 2 /* Include Non-Portable extensions */
#endif
#define PTW32_LEVEL_MAX 3
#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL)
#define PTW32_LEVEL PTW32_LEVEL_MAX /* Include everything */
#endif
#if defined(__MINGW32__) || defined(__MINGW64__)
# define PTW32_CONFIG_MINGW
#endif
#if defined(_MSC_VER)
# if _MSC_VER < 1300
# define PTW32_CONFIG_MSVC6
# endif
# if _MSC_VER < 1400
# define PTW32_CONFIG_MSVC7
# endif
#endif
/*
* -------------------------------------------------------------
*
*
* Module: pthread.h
*
* Purpose:
* Provides an implementation of PThreads based upon the
* standard:
*
* POSIX 1003.1-2001
* and
* The Single Unix Specification version 3
*
* (these two are equivalent)
*
* in order to enhance code portability between Windows,
* various commercial Unix implementations, and Linux.
*
* See the ANNOUNCE file for a full list of conforming
* routines and defined constants, and a list of missing
* routines and constants not defined in this implementation.
*
* Authors:
* There have been many contributors to this library.
* The initial implementation was contributed by
* John Bossom, and several others have provided major
* sections or revisions of parts of the implementation.
* Often significant effort has been contributed to
* find and fix important bugs and other problems to
* improve the reliability of the library, which sometimes
* is not reflected in the amount of code which changed as
* result.
* As much as possible, the contributors are acknowledged
* in the ChangeLog file in the source code distribution
* where their changes are noted in detail.
*
* Contributors are listed in the CONTRIBUTORS file.
*
* As usual, all bouquets go to the contributors, and all
* brickbats go to the project maintainer.
*
* Maintainer:
* The code base for this project is coordinated and
* eventually pre-tested, packaged, and made available by
*
* Ross Johnson <[email protected]>
*
* QA Testers:
* Ultimately, the library is tested in the real world by
* a host of competent and demanding scientists and
* engineers who report bugs and/or provide solutions
* which are then fixed or incorporated into subsequent
* versions of the library. Each time a bug is fixed, a
* test case is written to prove the fix and ensure
* that later changes to the code don't reintroduce the
* same error. The number of test cases is slowly growing
* and therefore so is the code reliability.
*
* Compliance:
* See the file ANNOUNCE for the list of implemented
* and not-implemented routines and defined options.
* Of course, these are all defined is this file as well.
*
* Web site:
* The source code and other information about this library
* are available from
*
* http://sources.redhat.com/pthreads-win32/
*
* -------------------------------------------------------------
*/
/* Try to avoid including windows.h */
#if defined(PTW32_CONFIG_MINGW) && defined(__cplusplus)
#define PTW32_INCLUDE_WINDOWS_H
#endif
#if defined(PTW32_INCLUDE_WINDOWS_H)
#include <windows.h>
#endif
/*
* Boolean values to make us independent of system includes.
*/
enum {
PTW32_FALSE = 0,
PTW32_TRUE = (! PTW32_FALSE)
};
/*
* This is a duplicate of what is in the autoconf config.h,
* which is only used when building the pthread-win32 libraries.
*/
#if !defined(PTW32_CONFIG_H)
# if defined(WINCE)
# define NEED_ERRNO
# define NEED_SEM
# elif defined(_UWIN)
# define HAVE_MODE_T
# define HAVE_STRUCT_TIMESPEC
# define HAVE_SIGNAL_H
# elif defined(__MINGW64__)
# define HAVE_STRUCT_TIMESPEC
# define HAVE_MODE_T
# elif defined(__MINGW32__)
# define HAVE_MODE_T
# endif
#endif
#if !defined(NEED_FTIME)
#include <time.h>
#else /* NEED_FTIME */
/* use native WIN32 time API */
#endif /* NEED_FTIME */
#if defined(HAVE_SIGNAL_H)
#include <signal.h>
#endif
#include <limits.h>
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
#if defined(NEED_ERRNO)
#include "need_errno.h"
#else
#include <errno.h>
#endif
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#include <sched.h>
/*
* Several systems don't define some error numbers.
*/
#if !defined(ENOTSUP)
# define ENOTSUP 48 /* This is the value in Solaris. */
#endif
#if !defined(ETIMEDOUT)
# define ETIMEDOUT 10060 /* Same as WSAETIMEDOUT */
#endif
#if !defined(ENOSYS)
# define ENOSYS 140 /* Semi-arbitrary value */
#endif
#if !defined(EDEADLK)
# if defined(EDEADLOCK)
# define EDEADLK EDEADLOCK
# else
# define EDEADLK 36 /* This is the value in MSVC. */
# endif
#endif
/* POSIX 2008 - related to robust mutexes */
#if !defined(EOWNERDEAD)
# define EOWNERDEAD 43
#endif
#if !defined(ENOTRECOVERABLE)
# define ENOTRECOVERABLE 44
#endif
/*
* To avoid including windows.h we define only those things that we
* actually need from it.
*/
#if !defined(PTW32_INCLUDE_WINDOWS_H)
#if !defined(HANDLE)
# define PTW32__HANDLE_DEF
# define HANDLE void *
#endif
#if !defined(DWORD)
# define PTW32__DWORD_DEF
# define DWORD unsigned long
#endif
#endif
#if !defined(HAVE_STRUCT_TIMESPEC)
#define HAVE_STRUCT_TIMESPEC
#if !defined(_TIMESPEC_DEFINED)
#define _TIMESPEC_DEFINED
struct timespec {
time_t tv_sec;
long tv_nsec;
};
#endif /* _TIMESPEC_DEFINED */
#endif /* HAVE_STRUCT_TIMESPEC */
#if !defined(SIG_BLOCK)
#define SIG_BLOCK 0
#endif /* SIG_BLOCK */
#if !defined(SIG_UNBLOCK)
#define SIG_UNBLOCK 1
#endif /* SIG_UNBLOCK */
#if !defined(SIG_SETMASK)
#define SIG_SETMASK 2
#endif /* SIG_SETMASK */
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
/*
* -------------------------------------------------------------
*
* POSIX 1003.1-2001 Options
* =========================
*
* Options are normally set in <unistd.h>, which is not provided
* with pthreads-win32.
*
* For conformance with the Single Unix Specification (version 3), all of the
* options below are defined, and have a value of either -1 (not supported)
* or 200112L (supported).
*
* These options can neither be left undefined nor have a value of 0, because
* either indicates that sysconf(), which is not implemented, may be used at
* runtime to check the status of the option.
*
* _POSIX_THREADS (== 20080912L)
* If == 20080912L, you can use threads
*
* _POSIX_THREAD_ATTR_STACKSIZE (== 200809L)
* If == 200809L, you can control the size of a thread's
* stack
* pthread_attr_getstacksize
* pthread_attr_setstacksize
*
* _POSIX_THREAD_ATTR_STACKADDR (== -1)
* If == 200809L, you can allocate and control a thread's
* stack. If not supported, the following functions
* will return ENOSYS, indicating they are not
* supported:
* pthread_attr_getstackaddr
* pthread_attr_setstackaddr
*
* _POSIX_THREAD_PRIORITY_SCHEDULING (== -1)
* If == 200112L, you can use realtime scheduling.
* This option indicates that the behaviour of some
* implemented functions conforms to the additional TPS
* requirements in the standard. E.g. rwlocks favour
* writers over readers when threads have equal priority.
*
* _POSIX_THREAD_PRIO_INHERIT (== -1)
* If == 200809L, you can create priority inheritance
* mutexes.
* pthread_mutexattr_getprotocol +
* pthread_mutexattr_setprotocol +
*
* _POSIX_THREAD_PRIO_PROTECT (== -1)
* If == 200809L, you can create priority ceiling mutexes
* Indicates the availability of:
* pthread_mutex_getprioceiling
* pthread_mutex_setprioceiling
* pthread_mutexattr_getprioceiling
* pthread_mutexattr_getprotocol +
* pthread_mutexattr_setprioceiling
* pthread_mutexattr_setprotocol +
*
* _POSIX_THREAD_PROCESS_SHARED (== -1)
* If set, you can create mutexes and condition
* variables that can be shared with another
* process.If set, indicates the availability
* of:
* pthread_mutexattr_getpshared
* pthread_mutexattr_setpshared
* pthread_condattr_getpshared
* pthread_condattr_setpshared
*
* _POSIX_THREAD_SAFE_FUNCTIONS (== 200809L)
* If == 200809L you can use the special *_r library
* functions that provide thread-safe behaviour
*
* _POSIX_READER_WRITER_LOCKS (== 200809L)
* If == 200809L, you can use read/write locks
*
* _POSIX_SPIN_LOCKS (== 200809L)
* If == 200809L, you can use spin locks
*
* _POSIX_BARRIERS (== 200809L)
* If == 200809L, you can use barriers
*
* _POSIX_ROBUST_MUTEXES (== 200809L)
* If == 200809L, you can use robust mutexes
* Officially this should also imply
* _POSIX_THREAD_PROCESS_SHARED != -1 however
* not here yet.
*
* -------------------------------------------------------------
*/
/*
* POSIX Options
*/
#undef _POSIX_THREADS
#define _POSIX_THREADS 200809L
#undef _POSIX_READER_WRITER_LOCKS
#define _POSIX_READER_WRITER_LOCKS 200809L
#undef _POSIX_SPIN_LOCKS
#define _POSIX_SPIN_LOCKS 200809L
#undef _POSIX_BARRIERS
#define _POSIX_BARRIERS 200809L
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
#undef _POSIX_THREAD_ATTR_STACKSIZE
#define _POSIX_THREAD_ATTR_STACKSIZE 200809L
#undef _POSIX_ROBUST_MUTEXES
#define _POSIX_ROBUST_MUTEXES 200809L
/*
* The following options are not supported
*/
#undef _POSIX_THREAD_ATTR_STACKADDR
#define _POSIX_THREAD_ATTR_STACKADDR -1
#undef _POSIX_THREAD_PRIO_INHERIT
#define _POSIX_THREAD_PRIO_INHERIT -1
#undef _POSIX_THREAD_PRIO_PROTECT
#define _POSIX_THREAD_PRIO_PROTECT -1
/* TPS is not fully supported. */
#undef _POSIX_THREAD_PRIORITY_SCHEDULING
#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
#undef _POSIX_THREAD_PROCESS_SHARED
#define _POSIX_THREAD_PROCESS_SHARED -1
/*
* POSIX 1003.1-2001 Limits
* ===========================
*
* These limits are normally set in <limits.h>, which is not provided with
* pthreads-win32.
*
* PTHREAD_DESTRUCTOR_ITERATIONS
* Maximum number of attempts to destroy
* a thread's thread-specific data on
* termination (must be at least 4)
*
* PTHREAD_KEYS_MAX
* Maximum number of thread-specific data keys
* available per process (must be at least 128)
*
* PTHREAD_STACK_MIN
* Minimum supported stack size for a thread
*
* PTHREAD_THREADS_MAX
* Maximum number of threads supported per
* process (must be at least 64).
*
* SEM_NSEMS_MAX
* The maximum number of semaphores a process can have.
* (must be at least 256)
*
* SEM_VALUE_MAX
* The maximum value a semaphore can have.
* (must be at least 32767)
*
*/
#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#undef PTHREAD_DESTRUCTOR_ITERATIONS
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#undef _POSIX_THREAD_KEYS_MAX
#define _POSIX_THREAD_KEYS_MAX 128
#undef PTHREAD_KEYS_MAX
#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
#undef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 0
#undef _POSIX_THREAD_THREADS_MAX
#define _POSIX_THREAD_THREADS_MAX 64
/* Arbitrary value */
#undef PTHREAD_THREADS_MAX
#define PTHREAD_THREADS_MAX 2019
#undef _POSIX_SEM_NSEMS_MAX
#define _POSIX_SEM_NSEMS_MAX 256
/* Arbitrary value */
#undef SEM_NSEMS_MAX
#define SEM_NSEMS_MAX 1024
#undef _POSIX_SEM_VALUE_MAX
#define _POSIX_SEM_VALUE_MAX 32767
#undef SEM_VALUE_MAX
#define SEM_VALUE_MAX INT_MAX
#if defined(__GNUC__) && !defined(__declspec)
# error Please upgrade your GNU compiler to one that supports __declspec.
#endif
/*
* When building the library, you should define PTW32_BUILD so that
* the variables/functions are exported correctly. When using the library,
* do NOT define PTW32_BUILD, and then the variables/functions will
* be imported correctly.
*/
#if !defined(PTW32_STATIC_LIB)
# if defined(PTW32_BUILD)
# define PTW32_DLLPORT __declspec (dllexport)
# else
# define PTW32_DLLPORT __declspec (dllimport)
# endif
#else
# define PTW32_DLLPORT
#endif
#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX
# include <sys/types.h>
#else
/*
* Generic handle type - intended to extend uniqueness beyond
* that available with a simple pointer. It should scale for either
* IA-32 or IA-64.
*/
typedef struct {
void * p; /* Pointer to actual object */
unsigned int x; /* Extra information - reuse count etc */
} ptw32_handle_t;
typedef ptw32_handle_t pthread_t;
typedef struct pthread_attr_t_ * pthread_attr_t;
typedef struct pthread_once_t_ pthread_once_t;
typedef struct pthread_key_t_ * pthread_key_t;
typedef struct pthread_mutex_t_ * pthread_mutex_t;
typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t;
typedef struct pthread_cond_t_ * pthread_cond_t;
typedef struct pthread_condattr_t_ * pthread_condattr_t;
#endif
typedef struct pthread_rwlock_t_ * pthread_rwlock_t;
typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t;
typedef struct pthread_spinlock_t_ * pthread_spinlock_t;
typedef struct pthread_barrier_t_ * pthread_barrier_t;
typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t;
/*
* ====================
* ====================
* POSIX Threads
* ====================
* ====================
*/
enum {
/*
* pthread_attr_{get,set}detachstate
*/
PTHREAD_CREATE_JOINABLE = 0, /* Default */
PTHREAD_CREATE_DETACHED = 1,
/*
* pthread_attr_{get,set}inheritsched
*/
PTHREAD_INHERIT_SCHED = 0,
PTHREAD_EXPLICIT_SCHED = 1, /* Default */
/*
* pthread_{get,set}scope
*/
PTHREAD_SCOPE_PROCESS = 0,
PTHREAD_SCOPE_SYSTEM = 1, /* Default */
/*
* pthread_setcancelstate paramters
*/
PTHREAD_CANCEL_ENABLE = 0, /* Default */
PTHREAD_CANCEL_DISABLE = 1,
/*
* pthread_setcanceltype parameters
*/
PTHREAD_CANCEL_ASYNCHRONOUS = 0,
PTHREAD_CANCEL_DEFERRED = 1, /* Default */
/*
* pthread_mutexattr_{get,set}pshared
* pthread_condattr_{get,set}pshared
*/
PTHREAD_PROCESS_PRIVATE = 0,
PTHREAD_PROCESS_SHARED = 1,
/*
* pthread_mutexattr_{get,set}robust
*/
PTHREAD_MUTEX_STALLED = 0, /* Default */
PTHREAD_MUTEX_ROBUST = 1,
/*
* pthread_barrier_wait
*/
PTHREAD_BARRIER_SERIAL_THREAD = -1
};
/*
* ====================
* ====================
* cancellation
* ====================
* ====================
*/
#define PTHREAD_CANCELED ((void *)(size_t) -1)
/*
* ====================
* ====================
* Once Key
* ====================
* ====================
*/
#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0}
struct pthread_once_t_
{
int done; /* indicates if user function has been executed */
void * lock;
int reserved1;
int reserved2;
};
/*
* ====================
* ====================
* Object initialisers
* ====================
* ====================
*/
#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -1)
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -2)
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -3)
/*
* Compatibility with LinuxThreads
*/
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER
#define PTHREAD_COND_INITIALIZER ((pthread_cond_t)(size_t) -1)
#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t)(size_t) -1)
#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t)(size_t) -1)
/*
* Mutex types.
*/
enum
{
/* Compatibility with LinuxThreads */
PTHREAD_MUTEX_FAST_NP,
PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP,
PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP,
/* For compatibility with POSIX */
PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
};
typedef struct ptw32_cleanup_t ptw32_cleanup_t;
#if defined(_MSC_VER)
/* Disable MSVC 'anachronism used' warning */
#pragma warning( disable : 4229 )
#endif
typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *);
#if defined(_MSC_VER)
#pragma warning( default : 4229 )
#endif
struct ptw32_cleanup_t
{
ptw32_cleanup_callback_t routine;
void *arg;
struct ptw32_cleanup_t *prev;
};
#if defined(__CLEANUP_SEH)
/*
* WIN32 SEH version of cancel cleanup.
*/
#define pthread_cleanup_push( _rout, _arg ) \
{ \
ptw32_cleanup_t _cleanup; \
\
_cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \
_cleanup.arg = (_arg); \
__try \
{ \
#define pthread_cleanup_pop( _execute ) \
} \
__finally \
{ \
if( _execute || AbnormalTermination()) \
{ \
(*(_cleanup.routine))( _cleanup.arg ); \
} \
} \
}
#else /* __CLEANUP_SEH */
#if defined(__CLEANUP_C)
/*
* C implementation of PThreads cancel cleanup
*/
#define pthread_cleanup_push( _rout, _arg ) \
{ \
ptw32_cleanup_t _cleanup; \
\
ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
#define pthread_cleanup_pop( _execute ) \
(void) ptw32_pop_cleanup( _execute ); \
}
#else /* __CLEANUP_C */
#if defined(__CLEANUP_CXX)
/*
* C++ version of cancel cleanup.
* - John E. Bossom.
*/
class PThreadCleanup {
/*
* PThreadCleanup
*
* Purpose
* This class is a C++ helper class that is
* used to implement pthread_cleanup_push/
* pthread_cleanup_pop.
* The destructor of this class automatically
* pops the pushed cleanup routine regardless
* of how the code exits the scope
* (i.e. such as by an exception)
*/
ptw32_cleanup_callback_t cleanUpRout;
void * obj;
int executeIt;
public:
PThreadCleanup() :
cleanUpRout( 0 ),
obj( 0 ),
executeIt( 0 )
/*
* No cleanup performed
*/
{
}
PThreadCleanup(
ptw32_cleanup_callback_t routine,
void * arg ) :
cleanUpRout( routine ),
obj( arg ),
executeIt( 1 )
/*
* Registers a cleanup routine for 'arg'
*/
{
}
~PThreadCleanup()
{
if ( executeIt && ((void *) cleanUpRout != (void *) 0) )
{
(void) (*cleanUpRout)( obj );
}
}
void execute( int exec )
{
executeIt = exec;
}
};
/*
* C++ implementation of PThreads cancel cleanup;
* This implementation takes advantage of a helper
* class who's destructor automatically calls the
* cleanup routine if we exit our scope weirdly
*/
#define pthread_cleanup_push( _rout, _arg ) \
{ \
PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
(void *) (_arg) );
#define pthread_cleanup_pop( _execute ) \
cleanup.execute( _execute ); \
}
#else
#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
#endif /* __CLEANUP_CXX */
#endif /* __CLEANUP_C */
#endif /* __CLEANUP_SEH */
/*
* ===============
* ===============
* Methods
* ===============
* ===============
*/
/*
* PThread Attribute Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr,
int *detachstate);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr,
void **stackaddr);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr,
size_t * stacksize);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr,
int detachstate);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr,
void *stackaddr);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr,
size_t stacksize);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr,
struct sched_param *param);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr,
const struct sched_param *param);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *,
int);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (const pthread_attr_t *,
int *);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr,
int inheritsched);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(const pthread_attr_t * attr,
int * inheritsched);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *,
int);
PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *,
int *);
/*
* PThread Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid,
const pthread_attr_t * attr,
void *(PTW32_CDECL *start) (void *),
void *arg);
PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid);
PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1,
pthread_t t2);
PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr);
PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread,
void **value_ptr);
PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void);
PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread);
PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state,
int *oldstate);
PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type,
int *oldtype);
PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void);
PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control,
void (PTW32_CDECL *init_routine) (void));
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute);
PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
ptw32_cleanup_callback_t routine,
void *arg);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
/*
* Thread Specific Data Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key,
void (PTW32_CDECL *destructor) (void *));
PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key);
PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key,
const void *value);
PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key);
/*
* Mutex Attribute Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t
* attr,
int *pshared);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
int pshared);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *kind);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setrobust(
pthread_mutexattr_t *attr,
int robust);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getrobust(
const pthread_mutexattr_t * attr,
int * robust);
/*
* Barrier Attribute Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t
* attr,
int *pshared);
PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
int pshared);
/*
* Mutex Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex,
const pthread_mutexattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex);
PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex);
PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t * mutex,
const struct timespec *abstime);
PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex);
PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex);
PTW32_DLLPORT int PTW32_CDECL pthread_mutex_consistent (pthread_mutex_t * mutex);
/*
* Spinlock Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared);
PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock);
PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock);
PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock);
PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock);
/*
* Barrier Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier,
const pthread_barrierattr_t * attr,
unsigned int count);
PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier);
PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier);
/*
* Condition Variable Attribute Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr,
int *pshared);
PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr,
int pshared);
/*
* Condition Variable Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond,
const pthread_condattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond);
PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond,
pthread_mutex_t * mutex);
PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond,
pthread_mutex_t * mutex,
const struct timespec *abstime);
PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond);
PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond);
/*
* Scheduling
*/
PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread,
int policy,
const struct sched_param *param);
PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread,
int *policy,
struct sched_param *param);
PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int);
PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void);
/*
* Read-Write Lock Functions
*/
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock,
const pthread_rwlockattr_t *attr);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
const struct timespec *abstime);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
const struct timespec *abstime);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr,
int *pshared);
PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
int pshared);
#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1
/*
* Signal Functions. Should be defined in <signal.h> but MSVC and MinGW32
* already have signal.h that don't define these.
*/
PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig);
/*
* Non-portable functions
*/
/*
* Compatibility with Linux.
*/
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr,
int kind);
PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr,
int *kind);
PTW32_DLLPORT int PTW32_CDECL pthread_timedjoin_np(pthread_t thread,
void **value_ptr,
const struct timespec *abstime);
PTW32_DLLPORT int PTW32_CDECL pthread_tryjoin_np(pthread_t thread,
void **value_ptr);
PTW32_DLLPORT int PTW32_CDECL pthread_setaffinity_np(pthread_t thread,
size_t cpusetsize,
const cpu_set_t *cpuset);
PTW32_DLLPORT int PTW32_CDECL pthread_getaffinity_np(pthread_t thread,
size_t cpusetsize,
cpu_set_t *cpuset);
/*
* Possibly supported by other POSIX threads implementations
*/
PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval);
PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void);
PTW32_DLLPORT unsigned __int64 PTW32_CDECL pthread_getunique_np(pthread_t thread);
/*
* Useful if an application wants to statically link
* the lib rather than load the DLL at run-time.
*/
PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void);
PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void);
PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void);
PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void);
/*
* Features that are auto-detected at load/run time.
*/
PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int);
enum ptw32_features {
PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */
PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */
};
/*
* Register a system time change with the library.
* Causes the library to perform various functions
* in response to the change. Should be called whenever
* the application's top level window receives a
* WM_TIMECHANGE message. It can be passed directly to
* pthread_create() as a new thread if desired.
*/
PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *);
#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
/*
* Returns the Win32 HANDLE for the POSIX thread.
*/
PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
/*
* Returns the win32 thread ID for POSIX thread.
*/
PTW32_DLLPORT DWORD PTW32_CDECL pthread_getw32threadid_np (pthread_t thread);
/*
* Protected Methods
*
* This function blocks until the given WIN32 handle
* is signaled or pthread_cancel had been called.
* This function allows the caller to hook into the
* PThreads cancel mechanism. It is implemented using
*
* WaitForMultipleObjects
*
* on 'waitHandle' and a manually reset WIN32 Event
* used to implement pthread_cancel. The 'timeout'
* argument to TimedWait is simply passed to
* WaitForMultipleObjects.
*/
PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle);
PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle,
DWORD timeout);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
/*
* Declare a thread-safe errno for Open Watcom
* (note: this has not been tested in a long time)
*/
#if defined(__WATCOMC__) && !defined(errno)
# if defined(_MT) || defined(_DLL)
__declspec(dllimport) extern int * __cdecl _errno(void);
# define errno (*_errno())
# endif
#endif
/*
* If pthreads-win32 is compiled as a DLL with MSVC, and
* both it and the application are linked against the static
* C runtime (i.e. with the /MT compiler flag), then the
* application will not see the same C runtime globals as
* the library. These include the errno variable, and the
* termination routine called by terminate(). For details,
* refer to the following links:
*
* http://support.microsoft.com/kb/94248
* (Section 4: Problems Encountered When Using Multiple CRT Libraries)
*
* http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/b4500c0d-1b69-40c7-9ef5-08da1025b5bf
*
* When pthreads-win32 is built with PTW32_USES_SEPARATE_CRT
* defined, the following features are enabled:
*
* (1) In addition to setting the errno variable when errors
* occur, the library will also call SetLastError() with the
* same value. The application can then use GetLastError()
* to obtain the value of errno. (This pair of routines are
* in kernel32.dll, and so are not affected by the use of
* multiple CRT libraries.)
*
* (2) When C++ or SEH cleanup is used, the library defines
* a function pthread_win32_set_terminate_np(), which can be
* used to set the termination routine that should be called
* when an unhandled exception occurs in a thread function
* (or otherwise inside the library).
*
* Note: "_DLL" implies the /MD compiler flag.
*/
#if defined(_MSC_VER) && !defined(_DLL) && !defined(PTW32_STATIC_LIB)
# define PTW32_USES_SEPARATE_CRT
#endif
#if defined(PTW32_USES_SEPARATE_CRT) && (defined(__CLEANUP_CXX) || defined(__CLEANUP_SEH))
typedef void (*ptw32_terminate_handler)();
PTW32_DLLPORT ptw32_terminate_handler PTW32_CDECL pthread_win32_set_terminate_np(ptw32_terminate_handler termFunction);
#endif
/*
* Some compiler environments don't define some things.
*/
#if defined(__BORLANDC__)
# define _ftime ftime
# define _timeb timeb
#endif
#if defined(__cplusplus)
/*
* Internal exceptions
*/
class ptw32_exception {};
class ptw32_exception_cancel : public ptw32_exception {};
class ptw32_exception_exit : public ptw32_exception {};
#endif
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
/* FIXME: This is only required if the library was built using SEH */
/*
* Get internal SEH tag
*/
PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#if !defined(PTW32_BUILD)
#if defined(__CLEANUP_SEH)
/*
* Redefine the SEH __except keyword to ensure that applications
* propagate our internal exceptions up to the library's internal handlers.
*/
#define __except( E ) \
__except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
? EXCEPTION_CONTINUE_SEARCH : ( E ) )
#endif /* __CLEANUP_SEH */
#if defined(__CLEANUP_CXX)
/*
* Redefine the C++ catch keyword to ensure that applications
* propagate our internal exceptions up to the library's internal handlers.
*/
#if defined(_MSC_VER)
/*
* WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
* if you want Pthread-Win32 cancellation and pthread_exit to work.
*/
#if !defined(PtW32NoCatchWarn)
#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.")
#pragma message("------------------------------------------------------------------")
#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads")
#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread")
#pragma message(" cancellation and pthread_exit to work. For example:")
#pragma message("")
#pragma message(" #if defined(PtW32CatchAll)")
#pragma message(" PtW32CatchAll")
#pragma message(" #else")
#pragma message(" catch(...)")
#pragma message(" #endif")
#pragma message(" {")
#pragma message(" /* Catchall block processing */")
#pragma message(" }")
#pragma message("------------------------------------------------------------------")
#endif
#define PtW32CatchAll \
catch( ptw32_exception & ) { throw; } \
catch( ... )
#else /* _MSC_VER */
#define catch( E ) \
catch( ptw32_exception & ) { throw; } \
catch( E )
#endif /* _MSC_VER */
#endif /* __CLEANUP_CXX */
#endif /* ! PTW32_BUILD */
#if defined(__cplusplus)
} /* End of extern "C" */
#endif /* __cplusplus */
#if defined(PTW32__HANDLE_DEF)
# undef HANDLE
#endif
#if defined(PTW32__DWORD_DEF)
# undef DWORD
#endif
#undef PTW32_LEVEL
#undef PTW32_LEVEL_MAX
#endif /* ! RC_INVOKED */
#endif /* PTHREAD_H */
|
ArcticaProject/vcxsrv
|
pthreads/pthread.h
|
C
|
gpl-3.0
| 44,265 |
var group___s_p_i__events =
[
[ "ARM_SPI_EVENT_TRANSFER_COMPLETE", "group___s_p_i__events.html#gaabdfc9e17641144cd50d36d15511a1b8", null ],
[ "ARM_SPI_EVENT_DATA_LOST", "group___s_p_i__events.html#ga8e63d99c80ea56de596a8d0a51fd8244", null ],
[ "ARM_SPI_EVENT_MODE_FAULT", "group___s_p_i__events.html#ga7eaa229003689aa18598273490b3e630", null ]
];
|
Stanford-BDML/super-scamp
|
vendor/CMSIS/CMSIS/Documentation/Driver/html/group___s_p_i__events.js
|
JavaScript
|
gpl-3.0
| 358 |
Ext.define('MDBAdmin.view._common.AuthInfo', {
extend: 'Ext.Container',
alias: 'widget.mdba-AuthInfo',
border: false,
initComponent: function () {
this.items = {
};
this.callParent(arguments);
}
});
|
VSvarozic/MongoDbWebUiMvc5
|
MDB.WebUi/scripts/app/view/_common/AuthInfo.js
|
JavaScript
|
gpl-3.0
| 249 |
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
#pragma once
// Forward Declaration
class CIcsManager;
class CIcsConnection
{
protected:
// Not refcounted.
// Lifetime is superset of all objects of this type.
CIcsManager* m_pIcsMgr;
INetConnection* m_pNetConnection;
INetSharingConfiguration* m_pNSConfig;
LONG m_lIndex;
bool m_bSharingEnabled;
bool m_bPublic;
bool m_bPrivate;
bool m_bSupported;
NETCON_PROPERTIES m_NetConnProps;
public:
CIcsConnection();
~CIcsConnection();
HRESULT
InitIcsConnection
(
CIcsManager* pIcsMgr,
INetConnection* pNetConnection,
LONG lIndex
);
HRESULT
DisableSharing
(
);
HRESULT
EnableAsPublic
(
);
HRESULT
EnableAsPrivate
(
);
bool IsSupported( ) const { return m_bSupported; };
bool IsSharingEnabled() const {return m_bSharingEnabled;};
bool IsPublic() const {return m_bPublic;};
bool IsPrivate() const {return m_bPrivate;};
bool
IsMatch
(
GUID* pGuid
);
void GetConnectionGuid(GUID & Guid) const {Guid = m_NetConnProps.guidId;};
void GetConnectionName(CAtlString & strName) const {strName = m_NetConnProps.pszwName;};
HRESULT
RefreshSharingEnabled
(
);
};
|
ianbannerman/inssidious
|
IcsMgr/inc/icsconn.h
|
C
|
gpl-3.0
| 1,739 |
---
layout: rules
title: TITLE 4: ADMISSION, RESIGNATION, EXCLUSION AND READMISSION OF MEMBERS
# :contents is an array of two element arrays that defines the menu which appears in the masthead
# each subarray should be in the form ["anchor-name","clickable title"]
contents : [
["#rule-4.1", "Rule 4.1"],
["#rule-4.2", "Rule 4.2"],
["#rule-4.3", "Rule 4.3"],
["#rule-4.4", "Rule 4.4"],
["#rule-4.5", "Rule 4.5"],
["#rule-4.6", "Rule 4.6"],
["#rule-4.7", "Rule 4.7"],
["#rule-4.8", "Rule 4.8"],
["#rule-4.9", "Rule 4.9"],
["#rule-4.10", "Rule 4.10"],
["#rule-4.11", "Rule 4.11"],
["#rule-4.12", "Rule 4.12"],
["#rule-4.13", "Rule 4.13"],
["#rule-4.14", "Rule 4.14"],
["#rule-4.15", "Rule 4.15"],
["#rule-4.16", "Rule 4.16"],
["#rule-4.17", "Rule 4.17"]
]
---
<h2 id="rule-4.1">Rule 4.1</h2>
Members of the Association fall into a single category and have equal rights and obligations as set out in the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}). Members enjoy the rights given by the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}) from the moment they sign their membership documents.
<h2 id="rule-4.2">Rule 4.2</h2>
All Members of the Association must abide by the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}), these [Internal Rules]({{ "/rules/" | prepend: site.baseurl }}), and decisions of the Board and Steering Committee.
<h2 id="rule-4.3">Rule 4.3</h2>
The Board may receive applications from new organisations wishing to be admitted as Members of the Association. Such applications may be dealt with as an item of business at both Annual Meetings and Extraordinary Meetings.
<h2 id="rule-4.4">Rule 4.4</h2>
Candidates for admission as a Member of the Association must fall within one of the following categories:
* National Meteorological Services recognised by the World Meteorological Organization;
* Government Organisations which hold a mandate or authority to carry out weather and climate research and services;
* Other Public Organisations which, in the opinion of the Board, are constituted for a purpose which is compatible with the purpose and objectives of the Association; or
* Other Non-Profit Organisations (including Non-Governmental Organisations) which, in the opinion of the Board, are constituted for a purpose which is compatible with the purpose and objectives of the Association.
<h2 id="rule-4.5">Rule 4.5</h2>
Applications for admission as a Member should be made in writing and addressed to the Chairperson of the Board. The application should set out the candidate’s name, its tasks, activities, corporate purpose and legal status, provide details of its interests in the field of meteorology and briefly set out why it wishes to become a Member of the Association and how it might contribute to the realisation of the Association’s objectives.
<h2 id="rule-4.6">Rule 4.6</h2>
The Board may (but shall not be obliged to) invite a representative of any candidate for membership to attend an Annual or Extraordinary Meeting of the Board at which that candidate’s application is to be considered, in order to present the candidate’s interests and capabilities to the Board.
<h2 id="rule-4.7">Rule 4.7</h2>
An application for admission as a Member may only be accepted by unanimous decision of the Board in Annual or Extraordinary Meeting, the Board having given due regard to the membership criteria set out in these [Internal Rules]({{ "/rules/" | prepend: site.baseurl }}).
<h2 id="rule-4.8">Rule 4.8</h2>
In considering whether to approve or reject any application for membership of the Association, the Board should have in mind the following matters:
* The willingness of the candidate to abide by the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}) and these [Internal Rules]({{ "/rules/" | prepend: site.baseurl }});
* The compatibility of the candidate’s corporate purpose with the purpose of the organisation;
* The financial soundness of the candidate;
* The scientific and technical capability of the candidate and the compatibility of these capabilities with the Association’s purpose and its current and future strategic programmes and work plans;
* Whether admission of the candidate would best serve the interests of the Association and its existing Members and Partners in ensuring that the purpose and objectives of the Association are met; and
* Any other matter which the Board reasonably feels may have a bearing on its decision.
<h2 id="rule-4.9">Rule 4.9</h2>
In accordance with [Article 7]({{ "/articles/7-resignation-of-a-member.html" | prepend: site.baseurl }}) of the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}), any Member that wishes to resign from the Association must give notice, at least six months prior to 31 December of the year in which the Member wishes to leave. The notice must be in writing and addressed to the Chairperson of the Board. If the notice requirements have been properly complied with, that Member will cease to be a Member of the Association from 1 January of the following year.
<h2 id="rule-4.10">Rule 4.10</h2>
Any Member who resigns from the Association shall remain fully liable for its commitments (whether financial or in kind) to the Association prior to its resignation taking effect. A resigning Member may only be released from its existing obligations by unanimous decision of the Board
<h2 id="rule-4.11">Rule 4.11</h2>
If any Member puts the Association’s activities at risk by failing to meet its obligations (whether financial or in kind), such failure may be reported to the Board who may convene an Extraordinary Meeting to decide whether, in line with [Article 8]({{ "/articles/8-exclusion-of-a-member.html" | prepend: site.baseurl }}) of the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}), that Member should be excluded from the Association. At the Meeting dealing with the question of exclusion, the Member whom it is sought to exclude shall not be taken into account for presence or approval quorum.
<h2 id="rule-4.12">Rule 4.12</h2>
It is recognised that exclusion is a drastic measure and that all reasonable means of curing any default should be considered before any decision is taken to exclude a Member from the Association. In deciding whether or not a Member should be excluded, the Board should consider the following matters:
* The impact on the Association of the default (particularly where the default is ongoing);
* The defaulting Member’s willingness and ability to cure the default;
* The realistic timescale within which the default might be cured;
* The impact on the Association of losing the expertise, abilities and resources brought by the Member whom it is sought to exclude;
* The availability of alternative resources;
* The financial stability of the Member whom it is sought to exclude;
* Whether the defaulting Member has previously met its obligations to the Association; and
* Any other matter which the Board reasonably feels may have a bearing on its decision.
<h2 id="rule-4.13">Rule 4.13</h2>
In line with [Article 12.13]({{ "/articles/12-board.html#article-12.13" | prepend: site.baseurl }}) of the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}), the Board may only exclude a Member from the Association by unanimous decision (the Member whom it is sought to exclude not being taken into account for presence or approval quorum).
<h2 id="rule-4.14">Rule 4.14</h2>
A Member who is excluded from the Association shall be given written notice of the Board’s decision as soon as reasonably practicable. The excluded Member shall cease to be a Member of the Association as soon as the notice is dispatched.
<h2 id="rule-4.15">Rule 4.15</h2>
In accordance with [Article 8.3]({{ "/articles/8-exclusion-of-a-member.html#article-8.3" | prepend: site.baseurl }}) of the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}), a Member who is excluded from the Association may subsequently apply for readmission. Applications shall be dealt with in the manner set out in Rules [4.1](#rule-4.1) to [4.8](#rule-4.8) of these [Internal Rules]({{ "/rules/" | prepend: site.baseurl }}), save that no application for readmission may be considered by the Board until the excluded Member makes good any financial default to the Association.
<h2 id="rule-4.16">Rule 4.16</h2>
In accordance with [Article 7.3]({{ "/articles/7-resignation-of-a-member.html#article-7.3" | prepend: site.baseurl }}) and [8.2]({{ "/articles/8-exclusion-of-a-member.html#article-8.2" | prepend: site.baseurl }}) of the [Articles of Association]({{ "/articles/" | prepend: site.baseurl }}), any Member who ceases to belong to the Association, whether through resignation or exclusion, shall not be entitled to any share of the Association’s funds and may not claim a refund of any membership dues previously paid.
<h2 id="rule-4.17">Rule 4.17</h2>
The Association is legally obligated to have at least two Members. In the event that only one Member remains, that Member shall make maximum efforts to have a second Member admitted to the Association within 45 days. If the Association then fails to secure a second Member, the remaining Member shall be required to begin the process of liquidating the Association.
[previous: TITLE 3]({{ "/rules/3-registered-office.html" | prepend: site.baseurl }}) \| [next: TITLE 5]({{ "/rules/5-relationship-with-organisational-partners.html" | prepend: site.baseurl }})
|
OpenWIS/openwis-documentation
|
rules/4-member-admission-resignation-exclusion-and-readmission.md
|
Markdown
|
gpl-3.0
| 9,623 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2018 Florian Bruhin (The Compiler) <[email protected]>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 3 of the License, or
# (at your option) any later version.
#
# qutebrowser 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 qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""The main statusbar widget."""
import enum
import attr
from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty, Qt, QSize, QTimer
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStackedLayout, QSizePolicy
from qutebrowser.browser import browsertab
from qutebrowser.config import config
from qutebrowser.utils import usertypes, log, objreg, utils
from qutebrowser.mainwindow.statusbar import (backforward, command, progress,
keystring, percentage, url,
tabindex)
from qutebrowser.mainwindow.statusbar import text as textwidget
@attr.s
class ColorFlags:
"""Flags which change the appearance of the statusbar.
Attributes:
prompt: If we're currently in prompt-mode.
insert: If we're currently in insert mode.
command: If we're currently in command mode.
mode: The current caret mode (CaretMode.off/.on/.selection).
private: Whether this window is in private browsing mode.
passthrough: If we're currently in passthrough-mode.
"""
CaretMode = enum.Enum('CaretMode', ['off', 'on', 'selection'])
prompt = attr.ib(False)
insert = attr.ib(False)
command = attr.ib(False)
caret = attr.ib(CaretMode.off)
private = attr.ib(False)
passthrough = attr.ib(False)
def to_stringlist(self):
"""Get a string list of set flags used in the stylesheet.
This also combines flags in ways they're used in the sheet.
"""
strings = []
if self.prompt:
strings.append('prompt')
if self.insert:
strings.append('insert')
if self.command:
strings.append('command')
if self.private:
strings.append('private')
if self.passthrough:
strings.append('passthrough')
if self.private and self.command:
strings.append('private-command')
if self.caret == self.CaretMode.on:
strings.append('caret')
elif self.caret == self.CaretMode.selection:
strings.append('caret-selection')
else:
assert self.caret == self.CaretMode.off
return strings
def _generate_stylesheet():
flags = [
('private', 'statusbar.private'),
('caret', 'statusbar.caret'),
('caret-selection', 'statusbar.caret.selection'),
('prompt', 'prompts'),
('insert', 'statusbar.insert'),
('command', 'statusbar.command'),
('passthrough', 'statusbar.passthrough'),
('private-command', 'statusbar.command.private'),
]
stylesheet = """
QWidget#StatusBar,
QWidget#StatusBar QLabel,
QWidget#StatusBar QLineEdit {
font: {{ conf.fonts.statusbar }};
background-color: {{ conf.colors.statusbar.normal.bg }};
color: {{ conf.colors.statusbar.normal.fg }};
}
"""
for flag, option in flags:
stylesheet += """
QWidget#StatusBar[color_flags~="%s"],
QWidget#StatusBar[color_flags~="%s"] QLabel,
QWidget#StatusBar[color_flags~="%s"] QLineEdit {
color: {{ conf.colors.%s }};
background-color: {{ conf.colors.%s }};
}
""" % (flag, flag, flag, # noqa: S001
option + '.fg', option + '.bg')
return stylesheet
class StatusBar(QWidget):
"""The statusbar at the bottom of the mainwindow.
Attributes:
txt: The Text widget in the statusbar.
keystring: The KeyString widget in the statusbar.
percentage: The Percentage widget in the statusbar.
url: The UrlText widget in the statusbar.
prog: The Progress widget in the statusbar.
cmd: The Command widget in the statusbar.
_hbox: The main QHBoxLayout.
_stack: The QStackedLayout with cmd/txt widgets.
_win_id: The window ID the statusbar is associated with.
Signals:
resized: Emitted when the statusbar has resized, so the completion
widget can adjust its size to it.
arg: The new size.
moved: Emitted when the statusbar has moved, so the completion widget
can move to the right position.
arg: The new position.
"""
resized = pyqtSignal('QRect')
moved = pyqtSignal('QPoint')
_severity = None
_color_flags = []
STYLESHEET = _generate_stylesheet()
def __init__(self, *, win_id, private, parent=None):
super().__init__(parent)
objreg.register('statusbar', self, scope='window', window=win_id)
self.setObjectName(self.__class__.__name__)
self.setAttribute(Qt.WA_StyledBackground)
config.set_register_stylesheet(self)
self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed)
self._win_id = win_id
self._color_flags = ColorFlags()
self._color_flags.private = private
self._hbox = QHBoxLayout(self)
self._set_hbox_padding()
self._hbox.setSpacing(5)
self._stack = QStackedLayout()
self._hbox.addLayout(self._stack)
self._stack.setContentsMargins(0, 0, 0, 0)
self.cmd = command.Command(private=private, win_id=win_id)
self._stack.addWidget(self.cmd)
objreg.register('status-command', self.cmd, scope='window',
window=win_id)
self.txt = textwidget.Text()
self._stack.addWidget(self.txt)
self.cmd.show_cmd.connect(self._show_cmd_widget)
self.cmd.hide_cmd.connect(self._hide_cmd_widget)
self._hide_cmd_widget()
self.url = url.UrlText()
self.percentage = percentage.Percentage()
self.backforward = backforward.Backforward()
self.tabindex = tabindex.TabIndex()
self.keystring = keystring.KeyString()
self.prog = progress.Progress(self)
self._draw_widgets()
config.instance.changed.connect(self._on_config_changed)
QTimer.singleShot(0, self.maybe_hide)
def __repr__(self):
return utils.get_repr(self)
@pyqtSlot(str)
def _on_config_changed(self, option):
if option == 'statusbar.hide':
self.maybe_hide()
elif option == 'statusbar.padding':
self._set_hbox_padding()
elif option == 'statusbar.widgets':
self._draw_widgets()
def _draw_widgets(self):
"""Draw statusbar widgets."""
# Start with widgets hidden and show them when needed
for widget in [self.url, self.percentage,
self.backforward, self.tabindex,
self.keystring, self.prog]:
widget.hide()
self._hbox.removeWidget(widget)
tab = self._current_tab()
# Read the list and set widgets accordingly
for segment in config.val.statusbar.widgets:
if segment == 'url':
self._hbox.addWidget(self.url)
self.url.show()
elif segment == 'scroll':
self._hbox.addWidget(self.percentage)
self.percentage.show()
elif segment == 'scroll_raw':
self._hbox.addWidget(self.percentage)
self.percentage.raw = True
self.percentage.show()
elif segment == 'history':
self._hbox.addWidget(self.backforward)
self.backforward.enabled = True
if tab:
self.backforward.on_tab_changed(tab)
elif segment == 'tabs':
self._hbox.addWidget(self.tabindex)
self.tabindex.show()
elif segment == 'keypress':
self._hbox.addWidget(self.keystring)
self.keystring.show()
elif segment == 'progress':
self._hbox.addWidget(self.prog)
self.prog.enabled = True
if tab:
self.prog.on_tab_changed(tab)
@pyqtSlot()
def maybe_hide(self):
"""Hide the statusbar if it's configured to do so."""
tab = self._current_tab()
hide = config.val.statusbar.hide
if hide or (tab is not None and tab.data.fullscreen):
self.hide()
else:
self.show()
def _set_hbox_padding(self):
padding = config.val.statusbar.padding
self._hbox.setContentsMargins(padding.left, 0, padding.right, 0)
@pyqtProperty('QStringList')
def color_flags(self):
"""Getter for self.color_flags, so it can be used as Qt property."""
return self._color_flags.to_stringlist()
def _current_tab(self):
"""Get the currently displayed tab."""
window = objreg.get('tabbed-browser', scope='window',
window=self._win_id)
return window.widget.currentWidget()
def set_mode_active(self, mode, val):
"""Setter for self.{insert,command,caret}_active.
Re-set the stylesheet after setting the value, so everything gets
updated by Qt properly.
"""
if mode == usertypes.KeyMode.insert:
log.statusbar.debug("Setting insert flag to {}".format(val))
self._color_flags.insert = val
if mode == usertypes.KeyMode.passthrough:
log.statusbar.debug("Setting passthrough flag to {}".format(val))
self._color_flags.passthrough = val
if mode == usertypes.KeyMode.command:
log.statusbar.debug("Setting command flag to {}".format(val))
self._color_flags.command = val
elif mode in [usertypes.KeyMode.prompt, usertypes.KeyMode.yesno]:
log.statusbar.debug("Setting prompt flag to {}".format(val))
self._color_flags.prompt = val
elif mode == usertypes.KeyMode.caret:
if not val:
# Turning on is handled in on_current_caret_selection_toggled
log.statusbar.debug("Setting caret mode off")
self._color_flags.caret = ColorFlags.CaretMode.off
config.set_register_stylesheet(self, update=False)
def _set_mode_text(self, mode):
"""Set the mode text."""
if mode == 'passthrough':
key_instance = config.key_instance
all_bindings = key_instance.get_reverse_bindings_for('passthrough')
bindings = all_bindings.get('leave-mode')
if bindings:
suffix = ' ({} to leave)'.format(bindings[0])
else:
suffix = ''
else:
suffix = ''
text = "-- {} MODE --{}".format(mode.upper(), suffix)
self.txt.set_text(self.txt.Text.normal, text)
def _show_cmd_widget(self):
"""Show command widget instead of temporary text."""
self._stack.setCurrentWidget(self.cmd)
self.show()
def _hide_cmd_widget(self):
"""Show temporary text instead of command widget."""
log.statusbar.debug("Hiding cmd widget")
self._stack.setCurrentWidget(self.txt)
self.maybe_hide()
@pyqtSlot(str)
def set_text(self, val):
"""Set a normal (persistent) text in the status bar."""
self.txt.set_text(self.txt.Text.normal, val)
@pyqtSlot(usertypes.KeyMode)
def on_mode_entered(self, mode):
"""Mark certain modes in the commandline."""
keyparsers = objreg.get('keyparsers', scope='window',
window=self._win_id)
if keyparsers[mode].passthrough:
self._set_mode_text(mode.name)
if mode in [usertypes.KeyMode.insert,
usertypes.KeyMode.command,
usertypes.KeyMode.caret,
usertypes.KeyMode.prompt,
usertypes.KeyMode.yesno,
usertypes.KeyMode.passthrough]:
self.set_mode_active(mode, True)
@pyqtSlot(usertypes.KeyMode, usertypes.KeyMode)
def on_mode_left(self, old_mode, new_mode):
"""Clear marked mode."""
keyparsers = objreg.get('keyparsers', scope='window',
window=self._win_id)
if keyparsers[old_mode].passthrough:
if keyparsers[new_mode].passthrough:
self._set_mode_text(new_mode.name)
else:
self.txt.set_text(self.txt.Text.normal, '')
if old_mode in [usertypes.KeyMode.insert,
usertypes.KeyMode.command,
usertypes.KeyMode.caret,
usertypes.KeyMode.prompt,
usertypes.KeyMode.yesno,
usertypes.KeyMode.passthrough]:
self.set_mode_active(old_mode, False)
@pyqtSlot(browsertab.AbstractTab)
def on_tab_changed(self, tab):
"""Notify sub-widgets when the tab has been changed."""
self.url.on_tab_changed(tab)
self.prog.on_tab_changed(tab)
self.percentage.on_tab_changed(tab)
self.backforward.on_tab_changed(tab)
self.maybe_hide()
assert tab.private == self._color_flags.private
@pyqtSlot(bool)
def on_caret_selection_toggled(self, selection):
"""Update the statusbar when entering/leaving caret selection mode."""
log.statusbar.debug("Setting caret selection {}".format(selection))
if selection:
self._set_mode_text("caret selection")
self._color_flags.caret = ColorFlags.CaretMode.selection
else:
self._set_mode_text("caret")
self._color_flags.caret = ColorFlags.CaretMode.on
config.set_register_stylesheet(self, update=False)
def resizeEvent(self, e):
"""Extend resizeEvent of QWidget to emit a resized signal afterwards.
Args:
e: The QResizeEvent.
"""
super().resizeEvent(e)
self.resized.emit(self.geometry())
def moveEvent(self, e):
"""Extend moveEvent of QWidget to emit a moved signal afterwards.
Args:
e: The QMoveEvent.
"""
super().moveEvent(e)
self.moved.emit(e.pos())
def minimumSizeHint(self):
"""Set the minimum height to the text height plus some padding."""
padding = config.val.statusbar.padding
width = super().minimumSizeHint().width()
height = self.fontMetrics().height() + padding.top + padding.bottom
return QSize(width, height)
|
toofar/qutebrowser
|
qutebrowser/mainwindow/statusbar/bar.py
|
Python
|
gpl-3.0
| 15,236 |
p {
margin: 0;
}
.first-collum {
width: 33%;
height: 100%;
display: flex;
color: #FFF;
font-family: "Open Sans";
flex-direction: column;
}
.data {
margin-top: 20px;
margin-left: 20px;
background-color: rgba(255, 255 ,255, .1);
height: 340px;
}
.title {
font-size: 2em;
font-weight: 100;
padding-left: 20px;
padding-top: 10px;
margin: 0;
}
.time-data {
font-size: 9rem;
padding-left: 16px;
margin-top: 0px;
margin-bottom: 0;
font-weight: bold;
}
.coffee {
margin-top: 20px;
margin-left: 20px;
background-color: rgba(255, 255, 255, .1);
height: 340px;
}
.money {
margin-top: 20px;
margin-left: 20px;
background-color: rgba(255, 255, 255, .1);
height: 230px;
overflow: hidden;
}
.coffee .content {
padding: 20px;
}
.big{
font-weight: 900;
font-size: 36px;
padding: 20px;
}
.money-value{
font-weight: 900;
font-size: 100px;
padding: 20px;
}
.icon-block-coffee {
float: left;
padding-left: 39px;
padding-right: 39px;
}
.icon-smoke {
position: absolute;
}
.text-block-coffee {
width: 30%;
float: left;
}
.img-coffee {
float: left;
padding-top: 90px;
}
.img-small-smoke-coffee {
position: absolute;
left: 50px;
padding-top: 31px;
float: left;
animation: smallsmoke 2s infinite 1s;
animation-direction: alternate;
animation-timing-function: ease-in-out;
}
@keyframes smallsmoke {
from {
transform: translate(0,0);
}
to {
transform: translate(0,7px);
}
}
.img-big-smoke-coffee {
position: absolute;
left: 70px;
padding-top: 15px;
float: left;
animation: bigsmoke 2.2s infinite 1s;
animation-direction: alternate;
animation-timing-function: ease-in-out;
}
@-webkit-keyframes bigsmoke {
from {
transform: translate(0,0);
}
to {
transform: translate(0,7px);
}
}
.time-coffee {
float: left;
font-size: 4.5em;
font-weight: bold;
padding-top: 20px;
}
.avatar-coffee {
float: left;
width: 300px;
padding-top: 33px;
}
.img-avatar-coffee {
float: left;
margin-right: 10px;
width: 80px;
height: 80px;
border-radius: 10px;
}
.name-avatar-coffee {
font-size: 1.5em;
padding-top: 0px;
font-weight: 700;
}
.lvl-avatar-coffee {
font-size: 1.2em;
padding-top: 0px;
font-weight: 100;
}
.lvl-stars-avatar-coffee {
padding-top: 0px;
}
.text-block-avatar {
float: left;
}
.another-coins {
transform: translate3d(620px, 0, 0);
animation: quotation 13s infinite;
animation-timing-function: linear;
}
@keyframes quotation {
0% {
transform: translate3d(620px, 0, 0);
}
100% {
transform: translate3d(-550px, 0, 0);
}
}
|
devpixelwolf/Pixelboard
|
src/assets/css/index.css
|
CSS
|
gpl-3.0
| 2,556 |
"use strict";
var layouts = require('../layouts')
, dgram = require('dgram')
, util = require('util');
function logstashUDP (config, layout) {
var udp = dgram.createSocket('udp4');
var type = config.logType ? config.logType : config.category;
layout = layout || layouts.dummyLayout;
if(!config.fields) {
config.fields = {};
}
return function log(loggingEvent) {
/*
https://gist.github.com/jordansissel/2996677
{
"message" => "hello world",
"@version" => "1",
"@timestamp" => "2014-04-22T23:03:14.111Z",
"type" => "stdin",
"host" => "hello.local"
}
@timestamp is the ISO8601 high-precision timestamp for the event.
@version is the version number of this json schema
Every other field is valid and fine.
*/
if (loggingEvent.data.length > 1) {
var secondEvData = loggingEvent.data[1];
for (var k in secondEvData) {
config.fields[k] = secondEvData[k];
}
}
config.fields.level = loggingEvent.level.levelStr;
var logObject = {
"@version" : "1",
"@timestamp" : (new Date(loggingEvent.startTime)).toISOString(),
"type" : config.logType ? config.logType : config.category,
"message" : layout(loggingEvent),
"fields" : config.fields
};
sendLog(udp, config.host, config.port, logObject);
};
}
function sendLog(udp, host, port, logObject) {
var buffer = new Buffer(JSON.stringify(logObject));
udp.send(buffer, 0, buffer.length, port, host, function(err, bytes) {
if(err) {
console.error(
"log4js.logstashUDP - %s:%p Error: %s", host, port, util.inspect(err)
);
}
});
}
function configure(config) {
var layout;
if (config.layout) {
layout = layouts.layout(config.layout.type, config.layout);
}
return logstashUDP(config, layout);
}
exports.appender = logstashUDP;
exports.configure = configure;
|
klhdy/im-indepartment
|
packORGAN/client/sealtalk-desktop-ent-src/node_modules/log4js/lib/appenders/logstashUDP.js
|
JavaScript
|
gpl-3.0
| 2,002 |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Kapitel 4. Wiederherstellung</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="JBackpack-Handbuch">
<link rel="up" href="index.html" title="JBackpack-Handbuch">
<link rel="prev" href="backup.html" title="Kapitel 3. Datensicherung">
<link rel="next" href="advanced_settings.html" title="Kapitel 5. Erweiterte Einstellungen">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Kapitel 4. Wiederherstellung</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="backup.html">Zurück</a> </td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="advanced_settings.html">Weiter</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="chapter" title="Kapitel 4. Wiederherstellung">
<div class="titlepage"><div><div><h2 class="title">
<a name="restore"></a>Kapitel 4. Wiederherstellung</h2></div></div></div>
<p>
<a class="indexterm" name="id1329116"></a>
Wenn Sie Dateien wiederherstellen wollen, müssen Sie auf den Reiter
<span class="quote">„<span class="quote">Wiederherstellung</span>“</span> wechseln:
</p>
<div class="figure">
<a name="id1329504"></a><p class="title"><b>Abbildung 4.1. Wiederherstellung</b></p>
<div class="figure-contents"><div><img src="Wiederherstellung.png" alt="Wiederherstellung"></div></div>
</div>
<p><br class="figure-break">
<a class="indexterm" name="id1329512"></a>
<a class="indexterm" name="id1329517"></a>
Auf der linken Seite wird die Liste der verfügbaren Datensicherungen
angezeigt. Für jede Datensicherung wird dessen Typ, Zeitstempel und
Speicherplatzbedarf angezeigt. Es gibt zwei verschiedene
Datensicherungstypen: Die oberste Datensicherung wird
<span class="quote">„<span class="quote">Spiegel</span>“</span> genannt. Sie beinhaltet alle Dateien der
letzten Datensicherung und wird mit einem Festplattensymbol
gekennzeichnet. Alle anderen Datensicherungen werden
<span class="quote">„<span class="quote">Inkremente</span>“</span> genannt und speichern nur die Unterschiede
relativ zur jüngeren Datensicherung (und benötigen deswegen
normalerweise deutlich weniger Speicherplatz als der Spiegel). Sie
sind durch ein Pfeilsymbol gekennzeichnet.
</p>
<p>
Wenn Sie eine Datensicherung aus der Liste auswählen, wird die
Dateistruktur dieser Datensicherung in der Dateiauswahl auf der
rechten Seite angezeigt. Mit Hilfe der Pfeilknöpfe unter der Liste
der Datensicherungen können Sie einfach zwischen den
Datensicherungen wechseln, ohne immer wieder den Mauszeiger bewegen
und zielen zu müssen.
</p>
<p>
Unter den Pfeilknöpfen werden verschiedene Werte zum
Speicherplatzbedarf angezeigt:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
<a class="indexterm" name="id1329598"></a>
die kumulative Grösse (die Summe der Grössen der ausgewählten
Datensicherung und aller älteren Datensicherungen)
</p></li>
<li class="listitem"><p>
<a class="indexterm" name="id1329554"></a>
die Summe der Grössen aller Datensicherungen
</p></li>
<li class="listitem"><p>
die Auslastung des Speicherplatzes des
Datensicherungsverzeichnisses
</p></li>
</ul></div>
<p>
Mit Hilfe dieser Informationen können Sie entscheiden, ob und
wie viele Datensicherungen Sie aufheben oder löschen wollen. Sie
können das Löschen von alten Datensicherungen auch automatisieren.
Weitere Informationen dazu finden Sie im
<a class="xref" href="advanced_settings.html#autodeletion" title="5.1. Automatisches Löschen alter Datensicherungen">Abschnitt 5.1, „Automatisches Löschen alter Datensicherungen“</a>.
</p>
<p>
Auf der oberen rechten Seite können Sie wählen, ob Sie entweder die
gesamte Datensicherung oder nur ausgewählte Dateien wiederherstellen
wollen.
</p>
<p>
Sie können sich ausgewählte Dateien über den
<span class="quote">„<span class="quote">Vorschau</span>“</span>-Knopf unter der Dateiliste ansehen. Die
ausgewählten Dateien werden dann in einem temporären Verzeichnis
nur-lesbar wiederhergestellt und mit einem passenden Programm zur
Vorschau geöffnet.
</p>
<p>
Im unteren Fensterbereich können Sie die Wiederherstellung starten.
Sie können die ausgewählten Dateien vor der Wiederherstellung zählen
lassen. Das ermöglicht die Anzeige eines Fortschrittsbalkens während
der Wiederherstellung, kann aber ein paar zusätzliche Sekunden
dauern. Sie können ausserdem wählen, wohin die Daten
wiederhergestellt werden sollen: entweder in das originale
Quellverzeichnis oder in ein anderes Verzeichnis.
</p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="backup.html">Zurück</a> </td>
<td width="20%" align="center"> </td>
<td width="40%" align="right"> <a accesskey="n" href="advanced_settings.html">Weiter</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Kapitel 3. Datensicherung </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Zum Anfang</a></td>
<td width="40%" align="right" valign="top"> Kapitel 5. Erweiterte Einstellungen</td>
</tr>
</table>
</div>
</body>
</html>
|
amon-ra/jbackpack
|
src/ch/fhnw/jbackpack/help/windows/de_CH/restore.html
|
HTML
|
gpl-3.0
| 6,159 |
#region License
// Copyright (c) 2013, ClearCanvas Inc.
// All rights reserved.
// http://www.ClearCanvas.ca
//
// This file is part of the ClearCanvas RIS/PACS open source project.
//
// The ClearCanvas RIS/PACS open source project 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 3 of the
// License, or (at your option) any later version.
//
// The ClearCanvas RIS/PACS open source project 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
// the ClearCanvas RIS/PACS open source project. If not, see
// <http://www.gnu.org/licenses/>.
#endregion
using Macro.ImageServer.Enterprise;
using Macro.ImageServer.Model.Parameters;
namespace Macro.ImageServer.Model.Brokers
{
/// <summary>
/// Broker for selecting the value of Modality based on a partition and Study Instance UID.
/// </summary>
public interface IQueryModalitiesInStudy : IProcedureQueryBroker<ModalitiesInStudyQueryParameters, Series>
{
}
}
|
mayioit/MacroMedicalSystem
|
ImageServer/Model/Brokers/IQueryModalitiesInStudy.cs
|
C#
|
gpl-3.0
| 1,325 |
{% extends "site_base.html"%}
{% load crispy_forms_tags %}
{% load i18n %}
{% block body %}
<h1>Editar la nota del alumnos {{ object.asistencia.alumno }} en el grupo {{ object.grupo }} en el trimestre {{ object.trimestre }}</h1>
<form action="" method="post">{% csrf_token %}
{{ form|crispy }}
<br />
<div class="form-actions">
<button type="submit">Enviar</button>
</div>
</form>
{% endblock %}
|
Etxea/gestioneide
|
evaluacion/templates/evaluacion/notatrimestral_form.html
|
HTML
|
gpl-3.0
| 439 |
<?php
/** class LogViewerHook
* Just allows user to add in any logs they feel they need on the log viewer
*
* NOTE: The log file will need web access to view. This is given by the root
* of the folder to read the contents and files of with:
* chmod -R 755 <foldername>
* list translates in ls -l to:
* drwxr-xr-x
* Also the file will need to be readable by everybody:
* chmod +r <filename>
*/
class LogViewerHook extends Hook
{
var $name = 'LogViewerHook';
var $description = 'Allows adding/removing log viewer files to the system';
var $author = 'Tom Elliott/Lee Rowlett';
var $active = false;
public function LogViewerAdd($arguments)
{
foreach($arguments['files'] AS $name => $filearray)
{
$ftpstart = $arguments['ftpstart'][$name];
$logfile = "/var/log/syslog";
$shortdesc = "System Log";
if (file_exists($ftpstart.$logfile))
$arguments['files'][$name][$shortdesc] = $ftpstart.$logfile;
else
$logfile = "/var/log/messages";
if (file_exists($ftpstart.$logfile))
$arguments['files'][$name][$shortdesc] = $ftpstart.$logfile;
}
}
}
$LogViewerHook = new LogViewerHook();
// Hook Event
$HookManager->register('LOG_VIEWER_HOOK', array($LogViewerHook, 'LogViewerAdd'));
|
Crazyphil/fogproject
|
packages/web/lib/hooks/LogViewerHook.hook.php
|
PHP
|
gpl-3.0
| 1,256 |
<?php
class EmailEncode {
/*
Encode an email address for HTML output
Usage
$email = '[email protected]';
$encoder = new EmailEncode();
echo $encoder->encode($email); // shows my@email.ch
*/
private function encode(&$email){
$output='';
for($i=0;$i<strlen($email);$i++){$output.='&#'.ord($email[$i]).';';}
return $output;
}//encode
}//Emailencoder
|
mhmli/helpers
|
php/Calculation/class.encode_email.php
|
PHP
|
gpl-3.0
| 428 |
package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockSpreadEvent;
// CraftBukkit end
public class BlockMycel extends Block {
public static final BlockStateBoolean SNOWY = BlockStateBoolean.of("snowy");
protected BlockMycel() {
super(Material.GRASS, MaterialMapColor.z);
this.j(this.blockStateList.getBlockData().set(BlockMycel.SNOWY, Boolean.valueOf(false)));
this.a(true);
this.a(CreativeModeTab.b);
}
public IBlockData updateState(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) {
Block block = iblockaccess.getType(blockposition.up()).getBlock();
return iblockdata.set(BlockMycel.SNOWY, Boolean.valueOf(block == Blocks.SNOW || block == Blocks.SNOW_LAYER));
}
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
if (!world.isClientSide) {
if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().p() > 2) {
// CraftBukkit start
// world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, EnumDirtVariant.DIRT));
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState();
blockState.setType(CraftMagicNumbers.getMaterial(Blocks.DIRT));
BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
} else {
if (world.getLightLevel(blockposition.up()) >= 9) {
for (int i = 0; i < Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); ++i) { // Spigot
BlockPosition blockposition1 = blockposition.a(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1);
IBlockData iblockdata1 = world.getType(blockposition1);
Block block = world.getType(blockposition1.up()).getBlock();
if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.p() <= 2) {
// CraftBukkit start
// world.setTypeUpdate(blockposition1, this.getBlockData());
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()).getState();
blockState.setType(CraftMagicNumbers.getMaterial(this));
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), blockState);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockState.update(true);
}
// CraftBukkit end
}
}
}
}
}
}
public Item getDropType(IBlockData iblockdata, Random random, int i) {
return Blocks.DIRT.getDropType(Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, BlockDirt.EnumDirtVariant.DIRT), random, i);
}
public int toLegacyData(IBlockData iblockdata) {
return 0;
}
protected BlockStateList getStateList() {
return new BlockStateList(this, new IBlockState[] { BlockMycel.SNOWY});
}
}
|
JunkyBulgaria/Spig
|
src/main/java/net/minecraft/server/BlockMycel.java
|
Java
|
gpl-3.0
| 4,134 |
package Class::Load::XS; # git description: v0.09-19-g9364900
use strict;
use warnings;
our $VERSION = '0.10';
use Class::Load 0.20;
use XSLoader;
XSLoader::load(
__PACKAGE__,
$VERSION,
);
1;
# ABSTRACT: XS implementation of parts of Class::Load
# KEYWORDS: class module load require use runtime XS
__END__
=pod
=encoding UTF-8
=head1 NAME
Class::Load::XS - XS implementation of parts of Class::Load
=head1 VERSION
version 0.10
=head1 SYNOPSIS
use Class::Load;
=head1 DESCRIPTION
This module provides an XS implementation for portions of L<Class::Load>. See
L<Class::Load> for API details.
=for Pod::Coverage is_class_loaded
=head1 SUPPORT
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Class-Load-XS>
(or L<[email protected]|mailto:[email protected]>).
There is also a mailing list available for users of this distribution, at
L<http://lists.perl.org/list/moose.html>.
There is also an irc channel available for users of this distribution, at
L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>.
=head1 AUTHOR
Dave Rolsky <[email protected]>
=head1 CONTRIBUTORS
=for stopwords Karen Etheridge Jesse Luehrs hurricup
=over 4
=item *
Karen Etheridge <[email protected]>
=item *
Jesse Luehrs <[email protected]>
=item *
hurricup <[email protected]>
=back
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
=cut
|
mgood7123/UPM
|
Files/Code/perl/lib/site_perl/5.26.1/i686-linux-thread-multi-quadmath/Class/Load/XS.pm
|
Perl
|
gpl-3.0
| 1,548 |
using Dapper;
using NzbDrone.Core.Datastore;
namespace NzbDrone.Core.Housekeeping.Housekeepers
{
public class CleanupOrphanedMovieFiles : IHousekeepingTask
{
private readonly IMainDatabase _database;
public CleanupOrphanedMovieFiles(IMainDatabase database)
{
_database = database;
}
public void Clean()
{
using (var mapper = _database.OpenConnection())
{
mapper.Execute(@"DELETE FROM MovieFiles
WHERE Id IN (
SELECT MovieFiles.Id FROM MovieFiles
LEFT OUTER JOIN Movies
ON MovieFiles.Id = Movies.MovieFileId
WHERE Movies.Id IS NULL)");
}
}
}
}
|
Radarr/Radarr
|
src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedMovieFiles.cs
|
C#
|
gpl-3.0
| 843 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.