code
stringlengths
4
1.01M
language
stringclasses
2 values
/********************************************************************\ * BitlBee -- An IRC to other IM-networks gateway * * * * Copyright 2002-2004 Wilmer van der Gaast and others * \********************************************************************/ /* Some stuff to fetch, save and handle nicknames for your buddies */ /* 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 with the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ void nick_set( account_t *acc, const char *handle, const char *nick ); char *nick_get( account_t *acc, const char *handle ); void nick_dedupe( account_t *acc, const char *handle, char nick[MAX_NICK_LENGTH+1] ); int nick_saved( account_t *acc, const char *handle ); void nick_del( account_t *acc, const char *handle ); void nick_strip( char *nick ); int nick_ok( const char *nick ); int nick_lc( char *nick ); int nick_uc( char *nick ); int nick_cmp( const char *a, const char *b ); char *nick_dup( const char *nick );
Java
#include "BitArray.h" namespace Rapid { void BitArrayT::append(char const * Bytes, std::size_t Size) { mBytes.append(Bytes, Size); } std::size_t BitArrayT::size() const { return mBytes.size() * 8; } bool BitArrayT::operator[](std::size_t Index) const { auto ByteIndex = Index / 8; auto BitIndex = Index % 8; return static_cast<std::uint8_t>(mBytes[ByteIndex]) >> BitIndex & 0x1; } }
Java
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code 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. Quake III Arena source code 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 Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ /***************************************************************************** * name: be_aas_file.c * * desc: AAS file loading/writing * * $Archive: /MissionPack/code/botlib/be_aas_file.c $ * *****************************************************************************/ #include "../game/q_shared.h" #include "l_memory.h" #include "l_script.h" #include "l_precomp.h" #include "l_struct.h" #include "l_libvar.h" #include "l_utils.h" #include "aasfile.h" #include "../game/botlib.h" #include "../game/be_aas.h" #include "be_aas_funcs.h" #include "be_interface.h" #include "be_aas_def.h" //#define AASFILEDEBUG //=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void AAS_SwapAASData(void) { int i, j; //bounding boxes for (i = 0; i < aasworld.numbboxes; i++) { aasworld.bboxes[i].presencetype = LittleLong(aasworld.bboxes[i].presencetype); aasworld.bboxes[i].flags = LittleLong(aasworld.bboxes[i].flags); for (j = 0; j < 3; j++) { aasworld.bboxes[i].mins[j] = LittleLong(aasworld.bboxes[i].mins[j]); aasworld.bboxes[i].maxs[j] = LittleLong(aasworld.bboxes[i].maxs[j]); } //end for } //end for //vertexes for (i = 0; i < aasworld.numvertexes; i++) { for (j = 0; j < 3; j++) aasworld.vertexes[i][j] = LittleFloat(aasworld.vertexes[i][j]); } //end for //planes for (i = 0; i < aasworld.numplanes; i++) { for (j = 0; j < 3; j++) aasworld.planes[i].normal[j] = LittleFloat(aasworld.planes[i].normal[j]); aasworld.planes[i].dist = LittleFloat(aasworld.planes[i].dist); aasworld.planes[i].type = LittleLong(aasworld.planes[i].type); } //end for //edges for (i = 0; i < aasworld.numedges; i++) { aasworld.edges[i].v[0] = LittleLong(aasworld.edges[i].v[0]); aasworld.edges[i].v[1] = LittleLong(aasworld.edges[i].v[1]); } //end for //edgeindex for (i = 0; i < aasworld.edgeindexsize; i++) { aasworld.edgeindex[i] = LittleLong(aasworld.edgeindex[i]); } //end for //faces for (i = 0; i < aasworld.numfaces; i++) { aasworld.faces[i].planenum = LittleLong(aasworld.faces[i].planenum); aasworld.faces[i].faceflags = LittleLong(aasworld.faces[i].faceflags); aasworld.faces[i].numedges = LittleLong(aasworld.faces[i].numedges); aasworld.faces[i].firstedge = LittleLong(aasworld.faces[i].firstedge); aasworld.faces[i].frontarea = LittleLong(aasworld.faces[i].frontarea); aasworld.faces[i].backarea = LittleLong(aasworld.faces[i].backarea); } //end for //face index for (i = 0; i < aasworld.faceindexsize; i++) { aasworld.faceindex[i] = LittleLong(aasworld.faceindex[i]); } //end for //convex areas for (i = 0; i < aasworld.numareas; i++) { aasworld.areas[i].areanum = LittleLong(aasworld.areas[i].areanum); aasworld.areas[i].numfaces = LittleLong(aasworld.areas[i].numfaces); aasworld.areas[i].firstface = LittleLong(aasworld.areas[i].firstface); for (j = 0; j < 3; j++) { aasworld.areas[i].mins[j] = LittleFloat(aasworld.areas[i].mins[j]); aasworld.areas[i].maxs[j] = LittleFloat(aasworld.areas[i].maxs[j]); aasworld.areas[i].center[j] = LittleFloat(aasworld.areas[i].center[j]); } //end for } //end for //area settings for (i = 0; i < aasworld.numareasettings; i++) { aasworld.areasettings[i].contents = LittleLong(aasworld.areasettings[i].contents); aasworld.areasettings[i].areaflags = LittleLong(aasworld.areasettings[i].areaflags); aasworld.areasettings[i].presencetype = LittleLong(aasworld.areasettings[i].presencetype); aasworld.areasettings[i].cluster = LittleLong(aasworld.areasettings[i].cluster); aasworld.areasettings[i].clusterareanum = LittleLong(aasworld.areasettings[i].clusterareanum); aasworld.areasettings[i].numreachableareas = LittleLong(aasworld.areasettings[i].numreachableareas); aasworld.areasettings[i].firstreachablearea = LittleLong(aasworld.areasettings[i].firstreachablearea); } //end for //area reachability for (i = 0; i < aasworld.reachabilitysize; i++) { aasworld.reachability[i].areanum = LittleLong(aasworld.reachability[i].areanum); aasworld.reachability[i].facenum = LittleLong(aasworld.reachability[i].facenum); aasworld.reachability[i].edgenum = LittleLong(aasworld.reachability[i].edgenum); for (j = 0; j < 3; j++) { aasworld.reachability[i].start[j] = LittleFloat(aasworld.reachability[i].start[j]); aasworld.reachability[i].end[j] = LittleFloat(aasworld.reachability[i].end[j]); } //end for aasworld.reachability[i].traveltype = LittleLong(aasworld.reachability[i].traveltype); aasworld.reachability[i].traveltime = LittleShort(aasworld.reachability[i].traveltime); } //end for //nodes for (i = 0; i < aasworld.numnodes; i++) { aasworld.nodes[i].planenum = LittleLong(aasworld.nodes[i].planenum); aasworld.nodes[i].children[0] = LittleLong(aasworld.nodes[i].children[0]); aasworld.nodes[i].children[1] = LittleLong(aasworld.nodes[i].children[1]); } //end for //cluster portals for (i = 0; i < aasworld.numportals; i++) { aasworld.portals[i].areanum = LittleLong(aasworld.portals[i].areanum); aasworld.portals[i].frontcluster = LittleLong(aasworld.portals[i].frontcluster); aasworld.portals[i].backcluster = LittleLong(aasworld.portals[i].backcluster); aasworld.portals[i].clusterareanum[0] = LittleLong(aasworld.portals[i].clusterareanum[0]); aasworld.portals[i].clusterareanum[1] = LittleLong(aasworld.portals[i].clusterareanum[1]); } //end for //cluster portal index for (i = 0; i < aasworld.portalindexsize; i++) { aasworld.portalindex[i] = LittleLong(aasworld.portalindex[i]); } //end for //cluster for (i = 0; i < aasworld.numclusters; i++) { aasworld.clusters[i].numareas = LittleLong(aasworld.clusters[i].numareas); aasworld.clusters[i].numreachabilityareas = LittleLong(aasworld.clusters[i].numreachabilityareas); aasworld.clusters[i].numportals = LittleLong(aasworld.clusters[i].numportals); aasworld.clusters[i].firstportal = LittleLong(aasworld.clusters[i].firstportal); } //end for } //end of the function AAS_SwapAASData //=========================================================================== // dump the current loaded aas file // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void AAS_DumpAASData(void) { aasworld.numbboxes = 0; if (aasworld.bboxes) FreeMemory(aasworld.bboxes); aasworld.bboxes = NULL; aasworld.numvertexes = 0; if (aasworld.vertexes) FreeMemory(aasworld.vertexes); aasworld.vertexes = NULL; aasworld.numplanes = 0; if (aasworld.planes) FreeMemory(aasworld.planes); aasworld.planes = NULL; aasworld.numedges = 0; if (aasworld.edges) FreeMemory(aasworld.edges); aasworld.edges = NULL; aasworld.edgeindexsize = 0; if (aasworld.edgeindex) FreeMemory(aasworld.edgeindex); aasworld.edgeindex = NULL; aasworld.numfaces = 0; if (aasworld.faces) FreeMemory(aasworld.faces); aasworld.faces = NULL; aasworld.faceindexsize = 0; if (aasworld.faceindex) FreeMemory(aasworld.faceindex); aasworld.faceindex = NULL; aasworld.numareas = 0; if (aasworld.areas) FreeMemory(aasworld.areas); aasworld.areas = NULL; aasworld.numareasettings = 0; if (aasworld.areasettings) FreeMemory(aasworld.areasettings); aasworld.areasettings = NULL; aasworld.reachabilitysize = 0; if (aasworld.reachability) FreeMemory(aasworld.reachability); aasworld.reachability = NULL; aasworld.numnodes = 0; if (aasworld.nodes) FreeMemory(aasworld.nodes); aasworld.nodes = NULL; aasworld.numportals = 0; if (aasworld.portals) FreeMemory(aasworld.portals); aasworld.portals = NULL; aasworld.numportals = 0; if (aasworld.portalindex) FreeMemory(aasworld.portalindex); aasworld.portalindex = NULL; aasworld.portalindexsize = 0; if (aasworld.clusters) FreeMemory(aasworld.clusters); aasworld.clusters = NULL; aasworld.numclusters = 0; // aasworld.loaded = qfalse; aasworld.initialized = qfalse; aasworld.savefile = qfalse; } //end of the function AAS_DumpAASData //=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== #ifdef AASFILEDEBUG void AAS_FileInfo(void) { int i, n, optimized; botimport.Print(PRT_MESSAGE, "version = %d\n", AASVERSION); botimport.Print(PRT_MESSAGE, "numvertexes = %d\n", aasworld.numvertexes); botimport.Print(PRT_MESSAGE, "numplanes = %d\n", aasworld.numplanes); botimport.Print(PRT_MESSAGE, "numedges = %d\n", aasworld.numedges); botimport.Print(PRT_MESSAGE, "edgeindexsize = %d\n", aasworld.edgeindexsize); botimport.Print(PRT_MESSAGE, "numfaces = %d\n", aasworld.numfaces); botimport.Print(PRT_MESSAGE, "faceindexsize = %d\n", aasworld.faceindexsize); botimport.Print(PRT_MESSAGE, "numareas = %d\n", aasworld.numareas); botimport.Print(PRT_MESSAGE, "numareasettings = %d\n", aasworld.numareasettings); botimport.Print(PRT_MESSAGE, "reachabilitysize = %d\n", aasworld.reachabilitysize); botimport.Print(PRT_MESSAGE, "numnodes = %d\n", aasworld.numnodes); botimport.Print(PRT_MESSAGE, "numportals = %d\n", aasworld.numportals); botimport.Print(PRT_MESSAGE, "portalindexsize = %d\n", aasworld.portalindexsize); botimport.Print(PRT_MESSAGE, "numclusters = %d\n", aasworld.numclusters); // for (n = 0, i = 0; i < aasworld.numareasettings; i++) { if (aasworld.areasettings[i].areaflags & AREA_GROUNDED) n++; } //end for botimport.Print(PRT_MESSAGE, "num grounded areas = %d\n", n); // botimport.Print(PRT_MESSAGE, "planes size %d bytes\n", aasworld.numplanes * sizeof(aas_plane_t)); botimport.Print(PRT_MESSAGE, "areas size %d bytes\n", aasworld.numareas * sizeof(aas_area_t)); botimport.Print(PRT_MESSAGE, "areasettings size %d bytes\n", aasworld.numareasettings * sizeof(aas_areasettings_t)); botimport.Print(PRT_MESSAGE, "nodes size %d bytes\n", aasworld.numnodes * sizeof(aas_node_t)); botimport.Print(PRT_MESSAGE, "reachability size %d bytes\n", aasworld.reachabilitysize * sizeof(aas_reachability_t)); botimport.Print(PRT_MESSAGE, "portals size %d bytes\n", aasworld.numportals * sizeof(aas_portal_t)); botimport.Print(PRT_MESSAGE, "clusters size %d bytes\n", aasworld.numclusters * sizeof(aas_cluster_t)); optimized = aasworld.numplanes * sizeof(aas_plane_t) + aasworld.numareas * sizeof(aas_area_t) + aasworld.numareasettings * sizeof(aas_areasettings_t) + aasworld.numnodes * sizeof(aas_node_t) + aasworld.reachabilitysize * sizeof(aas_reachability_t) + aasworld.numportals * sizeof(aas_portal_t) + aasworld.numclusters * sizeof(aas_cluster_t); botimport.Print(PRT_MESSAGE, "optimzed size %d KB\n", optimized >> 10); } //end of the function AAS_FileInfo #endif //AASFILEDEBUG //=========================================================================== // allocate memory and read a lump of a AAS file // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== char *AAS_LoadAASLump(fileHandle_t fp, int offset, int length, int *lastoffset, int size) { char *buf; // if (!length) { //just alloc a dummy return (char *) GetClearedHunkMemory(size+1); } //end if //seek to the data if (offset != *lastoffset) { botimport.Print(PRT_WARNING, "AAS file not sequentially read\n"); if (botimport.FS_Seek(fp, offset, FS_SEEK_SET)) { AAS_Error("can't seek to aas lump\n"); AAS_DumpAASData(); botimport.FS_FCloseFile(fp); return NULL; } //end if } //end if //allocate memory buf = (char *) GetClearedHunkMemory(length+1); //read the data if (length) { botimport.FS_Read(buf, length, fp ); *lastoffset += length; } //end if return buf; } //end of the function AAS_LoadAASLump //=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void AAS_DData(unsigned char *data, int size) { int i; for (i = 0; i < size; i++) { data[i] ^= (unsigned char) i * 119; } //end for } //end of the function AAS_DData //=========================================================================== // load an aas file // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== int AAS_LoadAASFile(char *filename) { fileHandle_t fp; aas_header_t header; int offset, length, lastoffset; botimport.Print(PRT_MESSAGE, "trying to load %s\n", filename); //dump current loaded aas file AAS_DumpAASData(); //open the file botimport.FS_FOpenFile( filename, &fp, FS_READ ); if (!fp) { AAS_Error("can't open %s\n", filename); return BLERR_CANNOTOPENAASFILE; } //end if //read the header botimport.FS_Read(&header, sizeof(aas_header_t), fp ); lastoffset = sizeof(aas_header_t); //check header identification header.ident = LittleLong(header.ident); if (header.ident != AASID) { AAS_Error("%s is not an AAS file\n", filename); botimport.FS_FCloseFile(fp); return BLERR_WRONGAASFILEID; } //end if //check the version header.version = LittleLong(header.version); // if (header.version != AASVERSION_OLD && header.version != AASVERSION) { AAS_Error("aas file %s is version %i, not %i\n", filename, header.version, AASVERSION); botimport.FS_FCloseFile(fp); return BLERR_WRONGAASFILEVERSION; } //end if // if (header.version == AASVERSION) { AAS_DData((unsigned char *) &header + 8, sizeof(aas_header_t) - 8); } //end if // aasworld.bspchecksum = atoi(LibVarGetString( "sv_mapChecksum")); if (LittleLong(header.bspchecksum) != aasworld.bspchecksum) { AAS_Error("aas file %s is out of date\n", filename); botimport.FS_FCloseFile(fp); return BLERR_WRONGAASFILEVERSION; } //end if //load the lumps: //bounding boxes offset = LittleLong(header.lumps[AASLUMP_BBOXES].fileofs); length = LittleLong(header.lumps[AASLUMP_BBOXES].filelen); aasworld.bboxes = (aas_bbox_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_bbox_t)); aasworld.numbboxes = length / sizeof(aas_bbox_t); if (aasworld.numbboxes && !aasworld.bboxes) return BLERR_CANNOTREADAASLUMP; //vertexes offset = LittleLong(header.lumps[AASLUMP_VERTEXES].fileofs); length = LittleLong(header.lumps[AASLUMP_VERTEXES].filelen); aasworld.vertexes = (aas_vertex_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_vertex_t)); aasworld.numvertexes = length / sizeof(aas_vertex_t); if (aasworld.numvertexes && !aasworld.vertexes) return BLERR_CANNOTREADAASLUMP; //planes offset = LittleLong(header.lumps[AASLUMP_PLANES].fileofs); length = LittleLong(header.lumps[AASLUMP_PLANES].filelen); aasworld.planes = (aas_plane_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_plane_t)); aasworld.numplanes = length / sizeof(aas_plane_t); if (aasworld.numplanes && !aasworld.planes) return BLERR_CANNOTREADAASLUMP; //edges offset = LittleLong(header.lumps[AASLUMP_EDGES].fileofs); length = LittleLong(header.lumps[AASLUMP_EDGES].filelen); aasworld.edges = (aas_edge_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_edge_t)); aasworld.numedges = length / sizeof(aas_edge_t); if (aasworld.numedges && !aasworld.edges) return BLERR_CANNOTREADAASLUMP; //edgeindex offset = LittleLong(header.lumps[AASLUMP_EDGEINDEX].fileofs); length = LittleLong(header.lumps[AASLUMP_EDGEINDEX].filelen); aasworld.edgeindex = (aas_edgeindex_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_edgeindex_t)); aasworld.edgeindexsize = length / sizeof(aas_edgeindex_t); if (aasworld.edgeindexsize && !aasworld.edgeindex) return BLERR_CANNOTREADAASLUMP; //faces offset = LittleLong(header.lumps[AASLUMP_FACES].fileofs); length = LittleLong(header.lumps[AASLUMP_FACES].filelen); aasworld.faces = (aas_face_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_face_t)); aasworld.numfaces = length / sizeof(aas_face_t); if (aasworld.numfaces && !aasworld.faces) return BLERR_CANNOTREADAASLUMP; //faceindex offset = LittleLong(header.lumps[AASLUMP_FACEINDEX].fileofs); length = LittleLong(header.lumps[AASLUMP_FACEINDEX].filelen); aasworld.faceindex = (aas_faceindex_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_faceindex_t)); aasworld.faceindexsize = length / sizeof(aas_faceindex_t); if (aasworld.faceindexsize && !aasworld.faceindex) return BLERR_CANNOTREADAASLUMP; //convex areas offset = LittleLong(header.lumps[AASLUMP_AREAS].fileofs); length = LittleLong(header.lumps[AASLUMP_AREAS].filelen); aasworld.areas = (aas_area_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_area_t)); aasworld.numareas = length / sizeof(aas_area_t); if (aasworld.numareas && !aasworld.areas) return BLERR_CANNOTREADAASLUMP; //area settings offset = LittleLong(header.lumps[AASLUMP_AREASETTINGS].fileofs); length = LittleLong(header.lumps[AASLUMP_AREASETTINGS].filelen); aasworld.areasettings = (aas_areasettings_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_areasettings_t)); aasworld.numareasettings = length / sizeof(aas_areasettings_t); if (aasworld.numareasettings && !aasworld.areasettings) return BLERR_CANNOTREADAASLUMP; //reachability list offset = LittleLong(header.lumps[AASLUMP_REACHABILITY].fileofs); length = LittleLong(header.lumps[AASLUMP_REACHABILITY].filelen); aasworld.reachability = (aas_reachability_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_reachability_t)); aasworld.reachabilitysize = length / sizeof(aas_reachability_t); if (aasworld.reachabilitysize && !aasworld.reachability) return BLERR_CANNOTREADAASLUMP; //nodes offset = LittleLong(header.lumps[AASLUMP_NODES].fileofs); length = LittleLong(header.lumps[AASLUMP_NODES].filelen); aasworld.nodes = (aas_node_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_node_t)); aasworld.numnodes = length / sizeof(aas_node_t); if (aasworld.numnodes && !aasworld.nodes) return BLERR_CANNOTREADAASLUMP; //cluster portals offset = LittleLong(header.lumps[AASLUMP_PORTALS].fileofs); length = LittleLong(header.lumps[AASLUMP_PORTALS].filelen); aasworld.portals = (aas_portal_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_portal_t)); aasworld.numportals = length / sizeof(aas_portal_t); if (aasworld.numportals && !aasworld.portals) return BLERR_CANNOTREADAASLUMP; //cluster portal index offset = LittleLong(header.lumps[AASLUMP_PORTALINDEX].fileofs); length = LittleLong(header.lumps[AASLUMP_PORTALINDEX].filelen); aasworld.portalindex = (aas_portalindex_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_portalindex_t)); aasworld.portalindexsize = length / sizeof(aas_portalindex_t); if (aasworld.portalindexsize && !aasworld.portalindex) return BLERR_CANNOTREADAASLUMP; //clusters offset = LittleLong(header.lumps[AASLUMP_CLUSTERS].fileofs); length = LittleLong(header.lumps[AASLUMP_CLUSTERS].filelen); aasworld.clusters = (aas_cluster_t *) AAS_LoadAASLump(fp, offset, length, &lastoffset, sizeof(aas_cluster_t)); aasworld.numclusters = length / sizeof(aas_cluster_t); if (aasworld.numclusters && !aasworld.clusters) return BLERR_CANNOTREADAASLUMP; //swap everything AAS_SwapAASData(); //aas file is loaded aasworld.loaded = qtrue; //close the file botimport.FS_FCloseFile(fp); // #ifdef AASFILEDEBUG AAS_FileInfo(); #endif //AASFILEDEBUG // return BLERR_NOERROR; } //end of the function AAS_LoadAASFile //=========================================================================== // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== static int AAS_WriteAASLump_offset; int AAS_WriteAASLump(fileHandle_t fp, aas_header_t *h, int lumpnum, void *data, int length) { aas_lump_t *lump; lump = &h->lumps[lumpnum]; lump->fileofs = LittleLong(AAS_WriteAASLump_offset); //LittleLong(ftell(fp)); lump->filelen = LittleLong(length); if (length > 0) { botimport.FS_Write(data, length, fp ); } //end if AAS_WriteAASLump_offset += length; return qtrue; } //end of the function AAS_WriteAASLump //=========================================================================== // aas data is useless after writing to file because it is byte swapped // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== qboolean AAS_WriteAASFile(char *filename) { aas_header_t header; fileHandle_t fp; botimport.Print(PRT_MESSAGE, "writing %s\n", filename); //swap the aas data AAS_SwapAASData(); //initialize the file header Com_Memset(&header, 0, sizeof(aas_header_t)); header.ident = LittleLong(AASID); header.version = LittleLong(AASVERSION); header.bspchecksum = LittleLong(aasworld.bspchecksum); //open a new file botimport.FS_FOpenFile( filename, &fp, FS_WRITE ); if (!fp) { botimport.Print(PRT_ERROR, "error opening %s\n", filename); return qfalse; } //end if //write the header botimport.FS_Write(&header, sizeof(aas_header_t), fp); AAS_WriteAASLump_offset = sizeof(aas_header_t); //add the data lumps to the file if (!AAS_WriteAASLump(fp, &header, AASLUMP_BBOXES, aasworld.bboxes, aasworld.numbboxes * sizeof(aas_bbox_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_VERTEXES, aasworld.vertexes, aasworld.numvertexes * sizeof(aas_vertex_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_PLANES, aasworld.planes, aasworld.numplanes * sizeof(aas_plane_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_EDGES, aasworld.edges, aasworld.numedges * sizeof(aas_edge_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_EDGEINDEX, aasworld.edgeindex, aasworld.edgeindexsize * sizeof(aas_edgeindex_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_FACES, aasworld.faces, aasworld.numfaces * sizeof(aas_face_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_FACEINDEX, aasworld.faceindex, aasworld.faceindexsize * sizeof(aas_faceindex_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_AREAS, aasworld.areas, aasworld.numareas * sizeof(aas_area_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_AREASETTINGS, aasworld.areasettings, aasworld.numareasettings * sizeof(aas_areasettings_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_REACHABILITY, aasworld.reachability, aasworld.reachabilitysize * sizeof(aas_reachability_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_NODES, aasworld.nodes, aasworld.numnodes * sizeof(aas_node_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_PORTALS, aasworld.portals, aasworld.numportals * sizeof(aas_portal_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_PORTALINDEX, aasworld.portalindex, aasworld.portalindexsize * sizeof(aas_portalindex_t))) return qfalse; if (!AAS_WriteAASLump(fp, &header, AASLUMP_CLUSTERS, aasworld.clusters, aasworld.numclusters * sizeof(aas_cluster_t))) return qfalse; //rewrite the header with the added lumps botimport.FS_Seek(fp, 0, FS_SEEK_SET); AAS_DData((unsigned char *) &header + 8, sizeof(aas_header_t) - 8); botimport.FS_Write(&header, sizeof(aas_header_t), fp); //close the file botimport.FS_FCloseFile(fp); return qtrue; } //end of the function AAS_WriteAASFile
Java
<!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> <title>skip (EstraierPure::Condition)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File estraierpure.rb, line 370</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">skip</span>() <span class="ruby-ivar">@skip</span> <span class="ruby-keyword kw">end</span></pre> </body> </html>
Java
Дополнительно для удобства добавлены некоторые настройки компонента | Параметр | По умолчанию | Описание | | -------------------------------------- | ----------------------- | ---------------------------------- | | **msgallerysearch_available_buttons** | download,google,gallery | Кнопки на панели | | **msgallerysearch_copy_meta** | Да | Копировать мета данные изображений | | **msgallerysearch_custom_search** | Пусто | Ссылка на свой поиск | | **msgallerysearch_disable_auto_query** | Да | Отключить загрузку результатов | | **msgallerysearch_disable_minishop2** | Нет | Отключить для miniShop2 | | **msgallerysearch_disable_ms2gallery** | Нет | Отключить для ms2Gallery | Название кнопок для регистрации * download - ссылка на скачивание * google - найти в google * gallery - найти в изображениях
Java
/* Copyright (C) 2012 - 2015 Evan Teran evan.teran@gmail.com Copyright (C) 1995-2003,2004,2005,2006,2007,2008,2009,2010,2011 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, see <http://www.gnu.org/licenses/>. */ #ifndef ELF_VERDAUX_20121007_H_ #define ELF_VERDAUX_20121007_H_ #include "elf/elf_types.h" /* Auxialiary version information. */ struct elf32_verdaux { elf32_word vda_name; /* Version or dependency names */ elf32_word vda_next; /* Offset in bytes to next verdaux entry */ }; struct elf64_verdaux { elf64_word vda_name; /* Version or dependency names */ elf64_word vda_next; /* Offset in bytes to next verdaux entry */ }; #endif
Java
/* * linux/drivers/usb/gadget/s3c2410_udc.h * Samsung on-chip full speed USB device controllers * * Copyright (C) 2004-2007 Herbert Pötzl - Arnaud Patard * Additional cleanups by Ben Dooks <ben-linux@fluff.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 * */ #ifndef _S3C2410_UDC_H #define _S3C2410_UDC_H struct s3c2410_ep { struct list_head queue; unsigned long last_io; /* jiffies timestamp */ struct usb_gadget *gadget; struct s3c2410_udc *dev; const struct usb_endpoint_descriptor *desc; struct usb_ep ep; u8 num; unsigned short fifo_size; u8 bEndpointAddress; u8 bmAttributes; unsigned halted : 1; unsigned already_seen : 1; unsigned setup_stage : 1; }; /* Warning : ep0 has a fifo of 16 bytes */ /* Don't try to set 32 or 64 */ /* also testusb 14 fails wit 16 but is */ /* fine with 8 */ #define EP0_FIFO_SIZE 8 #define EP_FIFO_SIZE 64 #define DEFAULT_POWER_STATE 0x00 #define S3C2440_EP_FIFO_SIZE 128 static const char ep0name [] = "ep0"; static const char *const ep_name[] = { ep0name, /* everyone has ep0 */ /* s3c2410 four bidirectional bulk endpoints */ "ep1-bulk", "ep2-bulk", "ep3-bulk", "ep4-bulk", }; #define S3C2410_ENDPOINTS ARRAY_SIZE(ep_name) struct s3c2410_request { struct list_head queue; /* ep's requests */ struct usb_request req; }; enum ep0_state { EP0_IDLE, EP0_IN_DATA_PHASE, EP0_OUT_DATA_PHASE, EP0_END_XFER, EP0_STALL, }; static const char *ep0states[]= { "EP0_IDLE", "EP0_IN_DATA_PHASE", "EP0_OUT_DATA_PHASE", "EP0_END_XFER", "EP0_STALL", }; struct s3c2410_udc { spinlock_t lock; struct s3c2410_ep ep[S3C2410_ENDPOINTS]; int address; struct usb_gadget gadget; struct usb_gadget_driver *driver; struct s3c2410_request fifo_req; u8 fifo_buf[EP_FIFO_SIZE]; u16 devstatus; u32 port_status; int ep0state; unsigned got_irq : 1; unsigned req_std : 1; unsigned req_config : 1; unsigned req_pending : 1; u8 vbus; struct dentry *regs_info; }; #endif
Java
package org.compiere.dbPort; import java.util.Collections; import java.util.List; /** * Native PostgreSQL (pass-through) implementation of {@link Convert} * * @author tsa * */ public final class Convert_PostgreSQL_Native extends Convert { @Override protected final List<String> convertStatement(final String sqlStatement) { return Collections.singletonList(sqlStatement); } }
Java
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="es"> <head> <!-- Generated by javadoc (1.8.0_25) on Wed Feb 25 01:10:23 CET 2015 --> <title>Constant Field Values</title> <meta name="date" content="2015-02-25"> <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"> <script type="text/javascript" src="script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Constant Field Values"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="overview-summary.html">Overview</a></li> <li>Package</li> <li>Class</li> <li>Use</li> <li><a href="overview-tree.html">Tree</a></li> <li><a href="deprecated-list.html">Deprecated</a></li> <li><a href="index-files/index-1.html">Index</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?constant-values.html" target="_top">Frames</a></li> <li><a href="constant-values.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Constant Field Values" class="title">Constant Field Values</h1> <h2 title="Contents">Contents</h2> <ul> <li><a href="#com.darkorbit">com.darkorbit.*</a></li> </ul> </div> <div class="constantValuesContainer"><a name="com.darkorbit"> <!-- --> </a> <h2 title="com.darkorbit">com.darkorbit.*</h2> <ul class="blockList"> <li class="blockList"> <table class="constantsSummary" border="0" cellpadding="3" cellspacing="0" summary="Constant Field Values table, listing constant fields, and values"> <caption><span>com.darkorbit.packets.<a href="com/darkorbit/packets/Packet.html" title="class in com.darkorbit.packets">Packet</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th scope="col">Constant Field</th> <th class="colLast" scope="col">Value</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a name="com.darkorbit.packets.Packet.LOGIN"> <!-- --> </a><code>public&nbsp;static&nbsp;final&nbsp;java.lang.String</code></td> <td><code><a href="com/darkorbit/packets/Packet.html#LOGIN">LOGIN</a></code></td> <td class="colLast"><code>"LOGIN"</code></td> </tr> <tr class="rowColor"> <td class="colFirst"><a name="com.darkorbit.packets.Packet.POLICY"> <!-- --> </a><code>public&nbsp;static&nbsp;final&nbsp;java.lang.String</code></td> <td><code><a href="com/darkorbit/packets/Packet.html#POLICY">POLICY</a></code></td> <td class="colLast"><code>"&lt;policy-file-request/&gt;"</code></td> </tr> </tbody> </table> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="overview-summary.html">Overview</a></li> <li>Package</li> <li>Class</li> <li>Use</li> <li><a href="overview-tree.html">Tree</a></li> <li><a href="deprecated-list.html">Deprecated</a></li> <li><a href="index-files/index-1.html">Index</a></li> <li><a href="help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="index.html?constant-values.html" target="_top">Frames</a></li> <li><a href="constant-values.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
Java
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MediaBrowser.Api.Reports { public class ReportRow { /// <summary> /// Initializes a new instance of the ReportRow class. /// </summary> public ReportRow() { Columns = new List<ReportItem>(); } /// <summary> Gets or sets the identifier. </summary> /// <value> The identifier. </value> public string Id { get; set; } /// <summary> /// Gets or sets a value indicating whether this object has backdrop image. </summary> /// <value> true if this object has backdrop image, false if not. </value> public bool HasImageTagsBackdrop { get; set; } /// <summary> Gets or sets a value indicating whether this object has image tags. </summary> /// <value> true if this object has image tags, false if not. </value> public bool HasImageTagsPrimary { get; set; } /// <summary> /// Gets or sets a value indicating whether this object has image tags logo. </summary> /// <value> true if this object has image tags logo, false if not. </value> public bool HasImageTagsLogo { get; set; } /// <summary> /// Gets or sets a value indicating whether this object has local trailer. </summary> /// <value> true if this object has local trailer, false if not. </value> public bool HasLocalTrailer { get; set; } /// <summary> Gets or sets a value indicating whether this object has lock data. </summary> /// <value> true if this object has lock data, false if not. </value> public bool HasLockData { get; set; } /// <summary> /// Gets or sets a value indicating whether this object has embedded image. </summary> /// <value> true if this object has embedded image, false if not. </value> public bool HasEmbeddedImage { get; set; } /// <summary> Gets or sets a value indicating whether this object has subtitles. </summary> /// <value> true if this object has subtitles, false if not. </value> public bool HasSubtitles { get; set; } /// <summary> Gets or sets a value indicating whether this object has specials. </summary> /// <value> true if this object has specials, false if not. </value> public bool HasSpecials { get; set; } /// <summary> Gets or sets a value indicating whether this object is unidentified. </summary> /// <value> true if this object is unidentified, false if not. </value> public bool IsUnidentified { get; set; } /// <summary> Gets or sets the columns. </summary> /// <value> The columns. </value> public List<ReportItem> Columns { get; set; } /// <summary> Gets or sets the type. </summary> /// <value> The type. </value> public ReportIncludeItemTypes RowType { get; set; } /// <summary> Gets or sets the identifier of the user. </summary> /// <value> The identifier of the user. </value> public string UserId { get; set; } } }
Java
/* * Copyright (C) 2000 Ulrich Czekalla * * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #ifndef _WINE_WININET_H_ #define _WINE_WININET_H_ #ifdef __cplusplus extern "C" { #endif #define INTERNETAPI #define BOOLAPI INTERNETAPI BOOL WINAPI typedef LPVOID HINTERNET; typedef HINTERNET * LPHINTERNET; typedef WORD INTERNET_PORT; typedef INTERNET_PORT * LPINTERNET_PORT; #define INTERNET_INVALID_PORT_NUMBER 0 #define INTERNET_DEFAULT_FTP_PORT 21 #define INTERNET_DEFAULT_GOPHER_PORT 70 #define INTERNET_DEFAULT_HTTP_PORT 80 #define INTERNET_DEFAULT_HTTPS_PORT 443 #define INTERNET_DEFAULT_SOCKS_PORT 1080 #define INTERNET_MAX_HOST_NAME_LENGTH 256 #define INTERNET_MAX_USER_NAME_LENGTH 128 #define INTERNET_MAX_PASSWORD_LENGTH 128 #define INTERNET_MAX_PORT_NUMBER_LENGTH 5 #define INTERNET_MAX_PORT_NUMBER_VALUE 65535 #define INTERNET_MAX_PATH_LENGTH 2048 #define INTERNET_MAX_SCHEME_LENGTH 32 #define INTERNET_MAX_URL_LENGTH (INTERNET_MAX_SCHEME_LENGTH + sizeof("://")+ INTERNET_MAX_PATH_LENGTH) #define INTERNET_KEEP_ALIVE_UNKNOWN ((DWORD)-1) #define INTERNET_KEEP_ALIVE_ENABLED 1 #define INTERNET_KEEP_ALIVE_DISABLED 0 #define INTERNET_REQFLAG_FROM_CACHE 0x00000001 #define INTERNET_REQFLAG_ASYNC 0x00000002 #define INTERNET_REQFLAG_VIA_PROXY 0x00000004 #define INTERNET_REQFLAG_NO_HEADERS 0x00000008 #define INTERNET_REQFLAG_PASSIVE 0x00000010 #define INTERNET_REQFLAG_CACHE_WRITE_DISABLED 0x00000040 #define INTERNET_FLAG_RELOAD 0x80000000 #define INTERNET_FLAG_RAW_DATA 0x40000000 #define INTERNET_FLAG_EXISTING_CONNECT 0x20000000 #define INTERNET_FLAG_ASYNC 0x10000000 #define INTERNET_FLAG_PASSIVE 0x08000000 #define INTERNET_FLAG_NO_CACHE_WRITE 0x04000000 #define INTERNET_FLAG_DONT_CACHE INTERNET_FLAG_NO_CACHE_WRITE #define INTERNET_FLAG_MAKE_PERSISTENT 0x02000000 #define INTERNET_FLAG_FROM_CACHE 0x01000000 #define INTERNET_FLAG_OFFLINE INTERNET_FLAG_FROM_CACHE #define INTERNET_FLAG_SECURE 0x00800000 #define INTERNET_FLAG_KEEP_CONNECTION 0x00400000 #define INTERNET_FLAG_NO_AUTO_REDIRECT 0x00200000 #define INTERNET_FLAG_READ_PREFETCH 0x00100000 #define INTERNET_FLAG_NO_COOKIES 0x00080000 #define INTERNET_FLAG_NO_AUTH 0x00040000 #define INTERNET_FLAG_CACHE_IF_NET_FAIL 0x00010000 #define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP 0x00008000 #define INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS 0x00004000 #define INTERNET_FLAG_IGNORE_CERT_DATE_INVALID 0x00002000 #define INTERNET_FLAG_IGNORE_CERT_CN_INVALID 0x00001000 #define INTERNET_FLAG_RESYNCHRONIZE 0x00000800 #define INTERNET_FLAG_HYPERLINK 0x00000400 #define INTERNET_FLAG_NO_UI 0x00000200 #define INTERNET_FLAG_PRAGMA_NOCACHE 0x00000100 #define INTERNET_FLAG_CACHE_ASYNC 0x00000080 #define INTERNET_FLAG_FORMS_SUBMIT 0x00000040 #define INTERNET_FLAG_NEED_FILE 0x00000010 #define INTERNET_FLAG_MUST_CACHE_REQUEST INTERNET_FLAG_NEED_FILE #define INTERNET_FLAG_TRANSFER_ASCII FTP_TRANSFER_TYPE_ASCII #define INTERNET_FLAG_TRANSFER_BINARY FTP_TRANSFER_TYPE_BINARY #define SECURITY_INTERNET_MASK (INTERNET_FLAG_IGNORE_CERT_CN_INVALID|\ INTERNET_FLAG_IGNORE_CERT_DATE_INVALID|\ INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS|\ INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP) #define INTERNET_FLAGS_MASK (INTERNET_FLAG_RELOAD \ | INTERNET_FLAG_RAW_DATA \ | INTERNET_FLAG_EXISTING_CONNECT \ | INTERNET_FLAG_ASYNC \ | INTERNET_FLAG_PASSIVE \ | INTERNET_FLAG_NO_CACHE_WRITE \ | INTERNET_FLAG_MAKE_PERSISTENT \ | INTERNET_FLAG_FROM_CACHE \ | INTERNET_FLAG_SECURE \ | INTERNET_FLAG_KEEP_CONNECTION \ | INTERNET_FLAG_NO_AUTO_REDIRECT \ | INTERNET_FLAG_READ_PREFETCH \ | INTERNET_FLAG_NO_COOKIES \ | INTERNET_FLAG_NO_AUTH \ | INTERNET_FLAG_CACHE_IF_NET_FAIL \ | SECURITY_INTERNET_MASK \ | INTERNET_FLAG_RESYNCHRONIZE \ | INTERNET_FLAG_HYPERLINK \ | INTERNET_FLAG_NO_UI \ | INTERNET_FLAG_PRAGMA_NOCACHE \ | INTERNET_FLAG_CACHE_ASYNC \ | INTERNET_FLAG_FORMS_SUBMIT \ | INTERNET_FLAG_NEED_FILE \ | INTERNET_FLAG_TRANSFER_BINARY \ | INTERNET_FLAG_TRANSFER_ASCII \ ) #define INTERNET_ERROR_MASK_INSERT_CDROM 0x1 #define INTERNET_ERROR_MASK_COMBINED_SEC_CERT 0x2 #define INTERNET_ERROR_MASK_NEED_MSN_SSPI_PKG 0x4 #define INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY 0x8 #define INTERNET_OPTIONS_MASK (~INTERNET_FLAGS_MASK) #define WININET_API_FLAG_ASYNC 0x00000001 #define WININET_API_FLAG_SYNC 0x00000004 #define WININET_API_FLAG_USE_CONTEXT 0x00000008 #define INTERNET_NO_CALLBACK 0 typedef enum { INTERNET_SCHEME_PARTIAL = -2, INTERNET_SCHEME_UNKNOWN = -1, INTERNET_SCHEME_DEFAULT = 0, INTERNET_SCHEME_FTP, INTERNET_SCHEME_GOPHER, INTERNET_SCHEME_HTTP, INTERNET_SCHEME_HTTPS, INTERNET_SCHEME_FILE, INTERNET_SCHEME_NEWS, INTERNET_SCHEME_MAILTO, INTERNET_SCHEME_SOCKS, INTERNET_SCHEME_JAVASCRIPT, INTERNET_SCHEME_VBSCRIPT, INTERNET_SCHEME_RES, INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP, INTERNET_SCHEME_LAST = INTERNET_SCHEME_RES } INTERNET_SCHEME,* LPINTERNET_SCHEME; typedef struct { DWORD_PTR dwResult; DWORD dwError; } INTERNET_ASYNC_RESULT,* LPINTERNET_ASYNC_RESULT; typedef struct { DWORD dwAccessType; LPCSTR lpszProxy; LPCSTR lpszProxyBypass; } INTERNET_PROXY_INFOA,* LPINTERNET_PROXY_INFOA; typedef struct { DWORD dwAccessType; LPCWSTR lpszProxy; LPCWSTR lpszProxyBypass; } INTERNET_PROXY_INFOW,* LPINTERNET_PROXY_INFOW; DECL_WINELIB_TYPE_AW(INTERNET_PROXY_INFO) DECL_WINELIB_TYPE_AW(LPINTERNET_PROXY_INFO) typedef struct { DWORD dwMajorVersion; DWORD dwMinorVersion; } INTERNET_VERSION_INFO,* LPINTERNET_VERSION_INFO; typedef struct { DWORD dwMajorVersion; DWORD dwMinorVersion; } HTTP_VERSION_INFO,* LPHTTP_VERSION_INFO; typedef struct { DWORD dwConnectedState; DWORD dwFlags; } INTERNET_CONNECTED_INFO,* LPINTERNET_CONNECTED_INFO; #define ISO_FORCE_DISCONNECTED 0x00000001 typedef struct { DWORD dwStructSize; LPSTR lpszScheme; DWORD dwSchemeLength; INTERNET_SCHEME nScheme; LPSTR lpszHostName; DWORD dwHostNameLength; INTERNET_PORT nPort; LPSTR lpszUserName; DWORD dwUserNameLength; LPSTR lpszPassword; DWORD dwPasswordLength; LPSTR lpszUrlPath; DWORD dwUrlPathLength; LPSTR lpszExtraInfo; DWORD dwExtraInfoLength; } URL_COMPONENTSA,* LPURL_COMPONENTSA; typedef struct { DWORD dwStructSize; LPWSTR lpszScheme; DWORD dwSchemeLength; INTERNET_SCHEME nScheme; LPWSTR lpszHostName; DWORD dwHostNameLength; INTERNET_PORT nPort; LPWSTR lpszUserName; DWORD dwUserNameLength; LPWSTR lpszPassword; DWORD dwPasswordLength; LPWSTR lpszUrlPath; DWORD dwUrlPathLength; LPWSTR lpszExtraInfo; DWORD dwExtraInfoLength; } URL_COMPONENTSW,* LPURL_COMPONENTSW; DECL_WINELIB_TYPE_AW(URL_COMPONENTS) DECL_WINELIB_TYPE_AW(LPURL_COMPONENTS) typedef struct { FILETIME ftExpiry; FILETIME ftStart; LPSTR lpszSubjectInfo; LPSTR lpszIssuerInfo; LPSTR lpszProtocolName; LPSTR lpszSignatureAlgName; LPSTR lpszEncryptionAlgName; DWORD dwKeySize; } INTERNET_CERTIFICATE_INFOA,* LPINTERNET_CERTIFICATE_INFOA; typedef struct { FILETIME ftExpiry; FILETIME ftStart; LPWSTR lpszSubjectInfo; LPWSTR lpszIssuerInfo; LPWSTR lpszProtocolName; LPWSTR lpszSignatureAlgName; LPWSTR lpszEncryptionAlgName; DWORD dwKeySize; } INTERNET_CERTIFICATE_INFOW,* LPINTERNET_CERTIFICATE_INFOW; DECL_WINELIB_TYPE_AW(INTERNET_CERTIFICATE_INFO) DECL_WINELIB_TYPE_AW(LPINTERNET_CERTIFICATE_INFO) typedef struct _INTERNET_BUFFERSA { DWORD dwStructSize; struct _INTERNET_BUFFERSA * Next; LPCSTR lpcszHeader; DWORD dwHeadersLength; DWORD dwHeadersTotal; LPVOID lpvBuffer; DWORD dwBufferLength; DWORD dwBufferTotal; DWORD dwOffsetLow; DWORD dwOffsetHigh; } INTERNET_BUFFERSA,* LPINTERNET_BUFFERSA; typedef struct _INTERNET_BUFFERSW { DWORD dwStructSize; struct _INTERNET_BUFFERSW * Next; LPCWSTR lpcszHeader; DWORD dwHeadersLength; DWORD dwHeadersTotal; LPVOID lpvBuffer; DWORD dwBufferLength; DWORD dwBufferTotal; DWORD dwOffsetLow; DWORD dwOffsetHigh; } INTERNET_BUFFERSW,* LPINTERNET_BUFFERSW; DECL_WINELIB_TYPE_AW(INTERNET_BUFFERS) DECL_WINELIB_TYPE_AW(LPINTERNET_BUFFERS) #define GROUP_OWNER_STORAGE_SIZE 4 #define GROUPNAME_MAX_LENGTH 120 typedef struct _INTERNET_CACHE_GROUP_INFOA { DWORD dwGroupSize; DWORD dwGroupFlags; DWORD dwGroupType; DWORD dwDiskUsage; DWORD dwDiskQuota; DWORD dwOwnerStorage[GROUP_OWNER_STORAGE_SIZE]; CHAR szGroupName[GROUPNAME_MAX_LENGTH]; } INTERNET_CACHE_GROUP_INFOA, * LPINTERNET_CACHE_GROUP_INFOA; typedef struct _INTERNET_CACHE_GROUP_INFOW { DWORD dwGroupSize; DWORD dwGroupFlags; DWORD dwGroupType; DWORD dwDiskUsage; DWORD dwDiskQuota; DWORD dwOwnerStorage[GROUP_OWNER_STORAGE_SIZE]; WCHAR szGroupName[GROUPNAME_MAX_LENGTH]; } INTERNET_CACHE_GROUP_INFOW, *LPINTERNET_CACHE_GROUP_INFOW; DECL_WINELIB_TYPE_AW(INTERNET_CACHE_GROUP_INFO) DECL_WINELIB_TYPE_AW(LPINTERNET_CACHE_GROUP_INFO) typedef struct _INTERNET_PER_CONN_OPTIONA { DWORD dwOption; union { DWORD dwValue; LPSTR pszValue; FILETIME ftValue; } Value; } INTERNET_PER_CONN_OPTIONA, *LPINTERNET_PER_CONN_OPTIONA; typedef struct _INTERNET_PER_CONN_OPTIONW { DWORD dwOption; union { DWORD dwValue; LPWSTR pszValue; FILETIME ftValue; } Value; } INTERNET_PER_CONN_OPTIONW, *LPINTERNET_PER_CONN_OPTIONW; DECL_WINELIB_TYPE_AW(INTERNET_PER_CONN_OPTION) DECL_WINELIB_TYPE_AW(LPINTERNET_PER_CONN_OPTION) #define INTERNET_PER_CONN_FLAGS 1 #define INTERNET_PER_CONN_PROXY_SERVER 2 #define INTERNET_PER_CONN_PROXY_BYPASS 3 #define INTERNET_PER_CONN_AUTOCONFIG_URL 4 #define INTERNET_PER_CONN_AUTODISCOVERY_FLAGS 5 #define INTERNET_PER_CONN_AUTOCONFIG_SECONDARY_URL 6 #define INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS 7 #define INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME 8 #define INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL 9 /* Values for INTERNET_PER_CONN_FLAGS */ #define PROXY_TYPE_DIRECT 0x00000001 #define PROXY_TYPE_PROXY 0x00000002 #define PROXY_TYPE_AUTO_PROXY_URL 0x00000004 #define PROXY_TYPE_AUTO_DETECT 0x00000008 /* Values for INTERNET_PER_CONN_AUTODISCOVERY_FLAGS */ #define AUTO_PROXY_FLAG_USER_SET 0x00000001 #define AUTO_PROXY_FLAG_ALWAYS_DETECT 0x00000002 #define AUTO_PROXY_FLAG_DETECTION_RUN 0x00000004 #define AUTO_PROXY_FLAG_MIGRATED 0x00000008 #define AUTO_PROXY_FLAG_DONT_CACHE_PROXY_RESULT 0x00000010 #define AUTO_PROXY_FLAG_CACHE_INIT_RUN 0x00000020 #define AUTO_PROXY_FLAG_DETECTION_SUSPECT 0x00000040 typedef struct _INTERNET_PER_CONN_OPTION_LISTA { DWORD dwSize; LPSTR pszConnection; DWORD dwOptionCount; DWORD dwOptionError; LPINTERNET_PER_CONN_OPTIONA pOptions; } INTERNET_PER_CONN_OPTION_LISTA, *LPINTERNET_PER_CONN_OPTION_LISTA; typedef struct _INTERNET_PER_CONN_OPTION_LISTW { DWORD dwSize; LPWSTR pszConnection; DWORD dwOptionCount; DWORD dwOptionError; LPINTERNET_PER_CONN_OPTIONW pOptions; } INTERNET_PER_CONN_OPTION_LISTW, *LPINTERNET_PER_CONN_OPTION_LISTW; DECL_WINELIB_TYPE_AW(INTERNET_PER_CONN_OPTION_LIST) DECL_WINELIB_TYPE_AW(LPINTERNET_PER_CONN_OPTION_LIST) typedef struct _INTERNET_DIAGNOSTIC_SOCKET_INFO { DWORD_PTR Socket; DWORD SourcePort; DWORD DestPort; DWORD Flags; } INTERNET_DIAGNOSTIC_SOCKET_INFO, *LPINTERNET_DIAGNOSTIC_SOCKET_INFO; #define IDSI_FLAG_KEEP_ALIVE 0x00000001 #define IDSI_FLAG_SECURE 0x00000002 #define IDSI_FLAG_PROXY 0x00000004 #define IDSI_FLAG_TUNNEL 0x00000008 BOOLAPI InternetTimeFromSystemTimeA(CONST SYSTEMTIME *,DWORD ,LPSTR ,DWORD); BOOLAPI InternetTimeFromSystemTimeW(CONST SYSTEMTIME *,DWORD ,LPWSTR ,DWORD); #define InternetTimeFromSystemTime WINELIB_NAME_AW(InternetTimeFromSystemTime) #define INTERNET_RFC1123_FORMAT 0 #define INTERNET_RFC1123_BUFSIZE 30 BOOLAPI InternetTimeToSystemTimeA(LPCSTR ,SYSTEMTIME *,DWORD); BOOLAPI InternetTimeToSystemTimeW(LPCWSTR ,SYSTEMTIME *,DWORD); #define InternetTimeToSystemTime WINELIB_NAME_AW(InternetTimeToSystemTime) BOOLAPI InternetCrackUrlA(LPCSTR ,DWORD ,DWORD ,LPURL_COMPONENTSA); BOOLAPI InternetCrackUrlW(LPCWSTR ,DWORD ,DWORD ,LPURL_COMPONENTSW); #define InternetCrackUrl WINELIB_NAME_AW(InternetCrackUrl) BOOLAPI InternetCreateUrlA(LPURL_COMPONENTSA ,DWORD ,LPSTR ,LPDWORD); BOOLAPI InternetCreateUrlW(LPURL_COMPONENTSW ,DWORD ,LPWSTR ,LPDWORD); #define InternetCreateUrl WINELIB_NAME_AW(InternetCreateUrl) BOOLAPI InternetCanonicalizeUrlA(LPCSTR ,LPSTR ,LPDWORD ,DWORD); BOOLAPI InternetCanonicalizeUrlW(LPCWSTR ,LPWSTR ,LPDWORD ,DWORD); #define InternetCanonicalizeUrl WINELIB_NAME_AW(InternetCanonicalizeUrl) BOOLAPI InternetCombineUrlA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD ,DWORD); BOOLAPI InternetCombineUrlW(LPCWSTR ,LPCWSTR ,LPWSTR ,LPDWORD ,DWORD); #define InternetCombineUrl WINELIB_NAME_AW(InternetCombineUrl) #define ICU_ESCAPE 0x80000000 #define ICU_USERNAME 0x40000000 #define ICU_NO_ENCODE 0x20000000 #define ICU_DECODE 0x10000000 #define ICU_NO_META 0x08000000 #define ICU_ENCODE_SPACES_ONLY 0x04000000 #define ICU_BROWSER_MODE 0x02000000 INTERNETAPI HINTERNET WINAPI InternetOpenA(LPCSTR ,DWORD ,LPCSTR ,LPCSTR ,DWORD); INTERNETAPI HINTERNET WINAPI InternetOpenW(LPCWSTR ,DWORD ,LPCWSTR ,LPCWSTR ,DWORD); #define InternetOpen WINELIB_NAME_AW(InternetOpen) #define INTERNET_OPEN_TYPE_PRECONFIG 0 #define INTERNET_OPEN_TYPE_DIRECT 1 #define INTERNET_OPEN_TYPE_PROXY 3 #define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 #define PRE_CONFIG_INTERNET_ACCESS INTERNET_OPEN_TYPE_PRECONFIG #define LOCAL_INTERNET_ACCESS INTERNET_OPEN_TYPE_DIRECT #define CERN_PROXY_INTERNET_ACCESS INTERNET_OPEN_TYPE_PROXY BOOLAPI InternetCloseHandle(HINTERNET); INTERNETAPI HINTERNET WINAPI InternetConnectA(HINTERNET ,LPCSTR ,INTERNET_PORT , LPCSTR ,LPCSTR ,DWORD ,DWORD ,DWORD_PTR ); INTERNETAPI HINTERNET WINAPI InternetConnectW(HINTERNET ,LPCWSTR ,INTERNET_PORT , LPCWSTR ,LPCWSTR ,DWORD ,DWORD ,DWORD_PTR ); #define InternetConnect WINELIB_NAME_AW(InternetConnect) #define INTERNET_SERVICE_URL 0 #define INTERNET_SERVICE_FTP 1 #define INTERNET_SERVICE_GOPHER 2 #define INTERNET_SERVICE_HTTP 3 #define InternetConnectUrl(hInternet,lpszUrl,dwFlags,dwContext) \ InternetConnect(hInternet,\ lpszUrl,\ INTERNET_INVALID_PORT_NUMBER,\ NULL,\ NULL,\ INTERNET_SERVICE_URL,\ dwFlags,\ dwContext \ ) INTERNETAPI HINTERNET WINAPI InternetOpenUrlA(HINTERNET ,LPCSTR ,LPCSTR ,DWORD ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI InternetOpenUrlW(HINTERNET ,LPCWSTR ,LPCWSTR ,DWORD ,DWORD ,DWORD_PTR); #define InternetOpenUrl WINELIB_NAME_AW(InternetOpenUrl) BOOLAPI InternetReadFile( HINTERNET ,LPVOID ,DWORD ,LPDWORD ); INTERNETAPI BOOL WINAPI InternetReadFileExA( HINTERNET ,LPINTERNET_BUFFERSA ,DWORD ,DWORD_PTR ); INTERNETAPI BOOL WINAPI InternetReadFileExW( HINTERNET ,LPINTERNET_BUFFERSW ,DWORD ,DWORD_PTR ); #define InternetReadFileEx WINELIB_NAME_AW(InternetReadFileEx) #define IRF_ASYNC WININET_API_FLAG_ASYNC #define IRF_SYNC WININET_API_FLAG_SYNC #define IRF_USE_CONTEXT WININET_API_FLAG_USE_CONTEXT #define IRF_NO_WAIT 0x00000008 INTERNETAPI DWORD WINAPI InternetSetFilePointer(HINTERNET ,LONG ,PVOID ,DWORD ,DWORD_PTR); BOOLAPI InternetWriteFile(HINTERNET ,LPCVOID ,DWORD ,LPDWORD); BOOLAPI InternetQueryDataAvailable(HINTERNET ,LPDWORD ,DWORD ,DWORD_PTR); BOOLAPI InternetFindNextFileA(HINTERNET ,LPVOID); BOOLAPI InternetFindNextFileW(HINTERNET ,LPVOID); #define InternetFindNextFile WINELIB_NAME_AW(InternetFindNextFile) BOOLAPI InternetQueryOptionA(HINTERNET ,DWORD ,LPVOID ,LPDWORD); BOOLAPI InternetQueryOptionW(HINTERNET ,DWORD ,LPVOID ,LPDWORD); #define InternetQueryOption WINELIB_NAME_AW(InternetQueryOption) BOOLAPI InternetSetOptionA(HINTERNET ,DWORD ,LPVOID ,DWORD); BOOLAPI InternetSetOptionW(HINTERNET ,DWORD ,LPVOID ,DWORD); #define InternetSetOption WINELIB_NAME_AW(InternetSetOption) BOOLAPI InternetSetOptionExA(HINTERNET ,DWORD ,LPVOID ,DWORD ,DWORD); BOOLAPI InternetSetOptionExW(HINTERNET ,DWORD ,LPVOID ,DWORD ,DWORD); #define InternetSetOptionEx WINELIB_NAME_AW(InternetSetOptionEx) BOOLAPI InternetLockRequestFile(HINTERNET ,HANDLE *); BOOLAPI InternetUnlockRequestFile(HANDLE); #define ISO_GLOBAL 0x00000001 #define ISO_REGISTRY 0x00000002 #define ISO_VALID_FLAGS (ISO_GLOBAL | ISO_REGISTRY) #define INTERNET_OPTION_CALLBACK 1 #define INTERNET_OPTION_CONNECT_TIMEOUT 2 #define INTERNET_OPTION_CONNECT_RETRIES 3 #define INTERNET_OPTION_CONNECT_BACKOFF 4 #define INTERNET_OPTION_SEND_TIMEOUT 5 #define INTERNET_OPTION_CONTROL_SEND_TIMEOUT INTERNET_OPTION_SEND_TIMEOUT #define INTERNET_OPTION_RECEIVE_TIMEOUT 6 #define INTERNET_OPTION_CONTROL_RECEIVE_TIMEOUT INTERNET_OPTION_RECEIVE_TIMEOUT #define INTERNET_OPTION_DATA_SEND_TIMEOUT 7 #define INTERNET_OPTION_DATA_RECEIVE_TIMEOUT 8 #define INTERNET_OPTION_HANDLE_TYPE 9 #define INTERNET_OPTION_LISTEN_TIMEOUT 11 #define INTERNET_OPTION_READ_BUFFER_SIZE 12 #define INTERNET_OPTION_WRITE_BUFFER_SIZE 13 #define INTERNET_OPTION_ASYNC_ID 15 #define INTERNET_OPTION_ASYNC_PRIORITY 16 #define INTERNET_OPTION_PARENT_HANDLE 21 #define INTERNET_OPTION_KEEP_CONNECTION 22 #define INTERNET_OPTION_REQUEST_FLAGS 23 #define INTERNET_OPTION_EXTENDED_ERROR 24 #define INTERNET_OPTION_OFFLINE_MODE 26 #define INTERNET_OPTION_CACHE_STREAM_HANDLE 27 #define INTERNET_OPTION_USERNAME 28 #define INTERNET_OPTION_PASSWORD 29 #define INTERNET_OPTION_ASYNC 30 #define INTERNET_OPTION_SECURITY_FLAGS 31 #define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT 32 #define INTERNET_OPTION_DATAFILE_NAME 33 #define INTERNET_OPTION_URL 34 #define INTERNET_OPTION_SECURITY_CERTIFICATE 35 #define INTERNET_OPTION_SECURITY_KEY_BITNESS 36 #define INTERNET_OPTION_REFRESH 37 #define INTERNET_OPTION_PROXY 38 #define INTERNET_OPTION_SETTINGS_CHANGED 39 #define INTERNET_OPTION_VERSION 40 #define INTERNET_OPTION_USER_AGENT 41 #define INTERNET_OPTION_END_BROWSER_SESSION 42 #define INTERNET_OPTION_PROXY_USERNAME 43 #define INTERNET_OPTION_PROXY_PASSWORD 44 #define INTERNET_OPTION_CONTEXT_VALUE 45 #define INTERNET_OPTION_CONNECT_LIMIT 46 #define INTERNET_OPTION_SECURITY_SELECT_CLIENT_CERT 47 #define INTERNET_OPTION_POLICY 48 #define INTERNET_OPTION_DISCONNECTED_TIMEOUT 49 #define INTERNET_OPTION_CONNECTED_STATE 50 #define INTERNET_OPTION_IDLE_STATE 51 #define INTERNET_OPTION_OFFLINE_SEMANTICS 52 #define INTERNET_OPTION_SECONDARY_CACHE_KEY 53 #define INTERNET_OPTION_CALLBACK_FILTER 54 #define INTERNET_OPTION_CONNECT_TIME 55 #define INTERNET_OPTION_SEND_THROUGHPUT 56 #define INTERNET_OPTION_RECEIVE_THROUGHPUT 57 #define INTERNET_OPTION_REQUEST_PRIORITY 58 #define INTERNET_OPTION_HTTP_VERSION 59 #define INTERNET_OPTION_RESET_URLCACHE_SESSION 60 #define INTERNET_OPTION_ERROR_MASK 62 #define INTERNET_OPTION_FROM_CACHE_TIMEOUT 63 #define INTERNET_OPTION_BYPASS_EDITED_ENTRY 64 #define INTERNET_OPTION_HTTP_DECODING 65 #define INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO 67 #define INTERNET_OPTION_CODEPAGE 68 #define INTERNET_OPTION_CACHE_TIMESTAMPS 69 #define INTERNET_OPTION_DISABLE_AUTODIAL 70 #define INTERNET_OPTION_MAX_CONNS_PER_SERVER 73 #define INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER 74 #define INTERNET_OPTION_PER_CONNECTION_OPTION 75 #define INTERNET_OPTION_DIGEST_AUTH_UNLOAD 76 #define INTERNET_OPTION_IGNORE_OFFLINE 77 #define INTERNET_OPTION_IDENTITY 78 #define INTERNET_OPTION_REMOVE_IDENTITY 79 #define INTERNET_OPTION_ALTER_IDENTITY 80 #define INTERNET_OPTION_SUPPRESS_BEHAVIOR 81 #define INTERNET_OPTION_AUTODIAL_MODE 82 #define INTERNET_OPTION_AUTODIAL_CONNECTION 83 #define INTERNET_OPTION_CLIENT_CERT_CONTEXT 84 #define INTERNET_OPTION_AUTH_FLAGS 85 #define INTERNET_OPTION_COOKIES_3RD_PARTY 86 #define INTERNET_OPTION_DISABLE_PASSPORT_AUTH 87 #define INTERNET_OPTION_SEND_UTF8_SERVERNAME_TO_PROXY 88 #define INTERNET_OPTION_EXEMPT_CONNECTION_LIMIT 89 #define INTERNET_OPTION_ENABLE_PASSPORT_AUTH 90 #define INTERNET_OPTION_HIBERNATE_INACTIVE_WORKER_THREADS 91 #define INTERNET_OPTION_ACTIVATE_WORKER_THREADS 92 #define INTERNET_OPTION_RESTORE_WORKER_THREAD_DEFAULTS 93 #define INTERNET_OPTION_SOCKET_SEND_BUFFER_LENGTH 94 #define INTERNET_OPTION_PROXY_SETTINGS_CHANGED 95 #define INTERNET_OPTION_DATAFILE_EXT 96 #define INTERNET_OPTION_CODEPAGE_PATH 100 #define INTERNET_OPTION_CODEPAGE_EXTRA 101 #define INTERNET_OPTION_IDN 102 #define INTERNET_OPTION_MAX_CONNS_PER_PROXY 103 #define INTERNET_OPTION_SUPPRESS_SERVER_AUTH 104 #define INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT 105 #define INTERNET_FIRST_OPTION INTERNET_OPTION_CALLBACK #define INTERNET_LAST_OPTION INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT #define INTERNET_PRIORITY_FOREGROUND 1000 #define INTERNET_HANDLE_TYPE_INTERNET 1 #define INTERNET_HANDLE_TYPE_CONNECT_FTP 2 #define INTERNET_HANDLE_TYPE_CONNECT_GOPHER 3 #define INTERNET_HANDLE_TYPE_CONNECT_HTTP 4 #define INTERNET_HANDLE_TYPE_FTP_FIND 5 #define INTERNET_HANDLE_TYPE_FTP_FIND_HTML 6 #define INTERNET_HANDLE_TYPE_FTP_FILE 7 #define INTERNET_HANDLE_TYPE_FTP_FILE_HTML 8 #define INTERNET_HANDLE_TYPE_GOPHER_FIND 9 #define INTERNET_HANDLE_TYPE_GOPHER_FIND_HTML 10 #define INTERNET_HANDLE_TYPE_GOPHER_FILE 11 #define INTERNET_HANDLE_TYPE_GOPHER_FILE_HTML 12 #define INTERNET_HANDLE_TYPE_HTTP_REQUEST 13 #define SECURITY_FLAG_SECURE 0x00000001 #define SECURITY_FLAG_STRENGTH_WEAK 0x10000000 #define SECURITY_FLAG_STRENGTH_MEDIUM 0x40000000 #define SECURITY_FLAG_STRENGTH_STRONG 0x20000000 #define SECURITY_FLAG_UNKNOWNBIT 0x80000000 #define SECURITY_FLAG_NORMALBITNESS SECURITY_FLAG_STRENGTH_WEAK #define SECURITY_FLAG_SSL 0x00000002 #define SECURITY_FLAG_SSL3 0x00000004 #define SECURITY_FLAG_PCT 0x00000008 #define SECURITY_FLAG_PCT4 0x00000010 #define SECURITY_FLAG_IETFSSL4 0x00000020 #define SECURITY_FLAG_40BIT SECURITY_FLAG_STRENGTH_WEAK #define SECURITY_FLAG_128BIT SECURITY_FLAG_STRENGTH_STRONG #define SECURITY_FLAG_56BIT SECURITY_FLAG_STRENGTH_MEDIUM #define SECURITY_FLAG_IGNORE_REVOCATION 0x00000080 #define SECURITY_FLAG_IGNORE_UNKNOWN_CA 0x00000100 #define SECURITY_FLAG_IGNORE_WRONG_USAGE 0x00000200 #define SECURITY_FLAG_IGNORE_CERT_CN_INVALID INTERNET_FLAG_IGNORE_CERT_CN_INVALID #define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID INTERNET_FLAG_IGNORE_CERT_DATE_INVALID #define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTPS INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS #define SECURITY_FLAG_IGNORE_REDIRECT_TO_HTTP INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP #define SECURITY_SET_MASK (SECURITY_FLAG_IGNORE_REVOCATION |\ SECURITY_FLAG_IGNORE_UNKNOWN_CA |\ SECURITY_FLAG_IGNORE_CERT_CN_INVALID |\ SECURITY_FLAG_IGNORE_CERT_DATE_INVALID |\ SECURITY_FLAG_IGNORE_WRONG_USAGE) BOOLAPI InternetGetLastResponseInfoA(LPDWORD ,LPSTR ,LPDWORD); BOOLAPI InternetGetLastResponseInfoW(LPDWORD ,LPWSTR ,LPDWORD); #define InternetGetLastResponseInfo WINELIB_NAME_AW(InternetGetLastResponseInfo) typedef VOID (CALLBACK *INTERNET_STATUS_CALLBACK)(HINTERNET ,DWORD_PTR ,DWORD , LPVOID ,DWORD); typedef INTERNET_STATUS_CALLBACK * LPINTERNET_STATUS_CALLBACK; INTERNETAPI INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA(HINTERNET ,INTERNET_STATUS_CALLBACK); INTERNETAPI INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(HINTERNET ,INTERNET_STATUS_CALLBACK); #define InternetSetStatusCallback WINELIB_NAME_AW(InternetSetStatusCallback) #define INTERNET_STATUS_RESOLVING_NAME 10 #define INTERNET_STATUS_NAME_RESOLVED 11 #define INTERNET_STATUS_CONNECTING_TO_SERVER 20 #define INTERNET_STATUS_CONNECTED_TO_SERVER 21 #define INTERNET_STATUS_SENDING_REQUEST 30 #define INTERNET_STATUS_REQUEST_SENT 31 #define INTERNET_STATUS_RECEIVING_RESPONSE 40 #define INTERNET_STATUS_RESPONSE_RECEIVED 41 #define INTERNET_STATUS_CTL_RESPONSE_RECEIVED 42 #define INTERNET_STATUS_PREFETCH 43 #define INTERNET_STATUS_CLOSING_CONNECTION 50 #define INTERNET_STATUS_CONNECTION_CLOSED 51 #define INTERNET_STATUS_HANDLE_CREATED 60 #define INTERNET_STATUS_HANDLE_CLOSING 70 #define INTERNET_STATUS_DETECTING_PROXY 80 #define INTERNET_STATUS_REQUEST_COMPLETE 100 #define INTERNET_STATUS_REDIRECT 110 #define INTERNET_STATUS_INTERMEDIATE_RESPONSE 120 #define INTERNET_STATUS_USER_INPUT_REQUIRED 140 #define INTERNET_STATUS_STATE_CHANGE 200 #define INTERNET_STATUS_COOKIE_SENT 320 #define INTERNET_STATUS_COOKIE_RECEIVED 321 #define INTERNET_STATUS_PRIVACY_IMPACTED 324 #define INTERNET_STATUS_P3P_HEADER 325 #define INTERNET_STATUS_P3P_POLICYREF 326 #define INTERNET_STATUS_COOKIE_HISTORY 327 #define INTERNET_STATE_CONNECTED 0x00000001 #define INTERNET_STATE_DISCONNECTED 0x00000002 #define INTERNET_STATE_DISCONNECTED_BY_USER 0x00000010 #define INTERNET_STATE_IDLE 0x00000100 #define INTERNET_STATE_BUSY 0x00000200 #define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)(-1L)) #define FTP_TRANSFER_TYPE_UNKNOWN 0x00000000 #define FTP_TRANSFER_TYPE_ASCII 0x00000001 #define FTP_TRANSFER_TYPE_BINARY 0x00000002 #define FTP_TRANSFER_TYPE_MASK (FTP_TRANSFER_TYPE_ASCII | FTP_TRANSFER_TYPE_BINARY) BOOLAPI FtpCommandA(HINTERNET, BOOL, DWORD, LPCSTR, DWORD_PTR, HINTERNET *); BOOLAPI FtpCommandW(HINTERNET, BOOL, DWORD, LPCWSTR, DWORD_PTR, HINTERNET *); #define FtpCommand WINELIB_NAME_AW(FtpCommand) INTERNETAPI HINTERNET WINAPI FtpFindFirstFileA(HINTERNET ,LPCSTR , LPWIN32_FIND_DATAA ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI FtpFindFirstFileW(HINTERNET ,LPCWSTR , LPWIN32_FIND_DATAW ,DWORD ,DWORD_PTR); #define FtpFindFirstFile WINELIB_NAME_AW(FtpFindFirstFile) BOOLAPI FtpGetFileA(HINTERNET ,LPCSTR ,LPCSTR ,BOOL ,DWORD ,DWORD ,DWORD_PTR); BOOLAPI FtpGetFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,BOOL ,DWORD ,DWORD ,DWORD_PTR); #define FtpGetFile WINELIB_NAME_AW(FtpGetFile) DWORD WINAPI FtpGetFileSize(HINTERNET, LPDWORD); BOOLAPI FtpPutFileA(HINTERNET ,LPCSTR ,LPCSTR ,DWORD ,DWORD_PTR); BOOLAPI FtpPutFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,DWORD ,DWORD_PTR); #define FtpPutFile WINELIB_NAME_AW(FtpPutFile) BOOLAPI FtpDeleteFileA(HINTERNET ,LPCSTR); BOOLAPI FtpDeleteFileW(HINTERNET ,LPCWSTR); #define FtpDeleteFile WINELIB_NAME_AW(FtpDeleteFile) BOOLAPI FtpRenameFileA(HINTERNET ,LPCSTR ,LPCSTR); BOOLAPI FtpRenameFileW(HINTERNET ,LPCWSTR ,LPCWSTR); #define FtpRenameFile WINELIB_NAME_AW(FtpRenameFile) INTERNETAPI HINTERNET WINAPI FtpOpenFileA(HINTERNET ,LPCSTR ,DWORD ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI FtpOpenFileW(HINTERNET ,LPCWSTR ,DWORD ,DWORD ,DWORD_PTR); #define FtpOpenFile WINELIB_NAME_AW(FtpOpenFile) BOOLAPI FtpCreateDirectoryA(HINTERNET ,LPCSTR); BOOLAPI FtpCreateDirectoryW(HINTERNET ,LPCWSTR); #define FtpCreateDirectory WINELIB_NAME_AW(FtpCreateDirectory) BOOLAPI FtpRemoveDirectoryA(HINTERNET ,LPCSTR); BOOLAPI FtpRemoveDirectoryW(HINTERNET ,LPCWSTR); #define FtpRemoveDirectory WINELIB_NAME_AW(FtpRemoveDirectory) BOOLAPI FtpSetCurrentDirectoryA(HINTERNET ,LPCSTR); BOOLAPI FtpSetCurrentDirectoryW(HINTERNET ,LPCWSTR); #define FtpSetCurrentDirectory WINELIB_NAME_AW(FtpSetCurrentDirectory) BOOLAPI FtpGetCurrentDirectoryA(HINTERNET ,LPSTR ,LPDWORD); BOOLAPI FtpGetCurrentDirectoryW(HINTERNET ,LPWSTR ,LPDWORD); #define FtpGetCurrentDirectory WINELIB_NAME_AW(FtpGetCurrentDirectory) #define MAX_GOPHER_DISPLAY_TEXT 128 #define MAX_GOPHER_SELECTOR_TEXT 256 #define MAX_GOPHER_HOST_NAME INTERNET_MAX_HOST_NAME_LENGTH #define MAX_GOPHER_LOCATOR_LENGTH (1 \ + MAX_GOPHER_DISPLAY_TEXT \ + 1 \ + MAX_GOPHER_SELECTOR_TEXT \ + 1 \ + MAX_GOPHER_HOST_NAME \ + 1 \ + INTERNET_MAX_PORT_NUMBER_LENGTH \ + 1 \ + 1 \ + 2 \ ) typedef struct { CHAR DisplayString[MAX_GOPHER_DISPLAY_TEXT + 1]; DWORD GopherType; DWORD SizeLow; DWORD SizeHigh; FILETIME LastModificationTime; CHAR Locator[MAX_GOPHER_LOCATOR_LENGTH + 1]; } GOPHER_FIND_DATAA,* LPGOPHER_FIND_DATAA; typedef struct { WCHAR DisplayString[MAX_GOPHER_DISPLAY_TEXT + 1]; DWORD GopherType; DWORD SizeLow; DWORD SizeHigh; FILETIME LastModificationTime; WCHAR Locator[MAX_GOPHER_LOCATOR_LENGTH + 1]; } GOPHER_FIND_DATAW,* LPGOPHER_FIND_DATAW; DECL_WINELIB_TYPE_AW(GOPHER_FIND_DATA) DECL_WINELIB_TYPE_AW(LPGOPHER_FIND_DATA) #define GOPHER_TYPE_TEXT_FILE 0x00000001 #define GOPHER_TYPE_DIRECTORY 0x00000002 #define GOPHER_TYPE_CSO 0x00000004 #define GOPHER_TYPE_ERROR 0x00000008 #define GOPHER_TYPE_MAC_BINHEX 0x00000010 #define GOPHER_TYPE_DOS_ARCHIVE 0x00000020 #define GOPHER_TYPE_UNIX_UUENCODED 0x00000040 #define GOPHER_TYPE_INDEX_SERVER 0x00000080 #define GOPHER_TYPE_TELNET 0x00000100 #define GOPHER_TYPE_BINARY 0x00000200 #define GOPHER_TYPE_REDUNDANT 0x00000400 #define GOPHER_TYPE_TN3270 0x00000800 #define GOPHER_TYPE_GIF 0x00001000 #define GOPHER_TYPE_IMAGE 0x00002000 #define GOPHER_TYPE_BITMAP 0x00004000 #define GOPHER_TYPE_MOVIE 0x00008000 #define GOPHER_TYPE_SOUND 0x00010000 #define GOPHER_TYPE_HTML 0x00020000 #define GOPHER_TYPE_PDF 0x00040000 #define GOPHER_TYPE_CALENDAR 0x00080000 #define GOPHER_TYPE_INLINE 0x00100000 #define GOPHER_TYPE_UNKNOWN 0x20000000 #define GOPHER_TYPE_ASK 0x40000000 #define GOPHER_TYPE_GOPHER_PLUS 0x80000000 #define IS_GOPHER_FILE(type) (BOOL)(((type) & GOPHER_TYPE_FILE_MASK) ? TRUE : FALSE) #define IS_GOPHER_DIRECTORY(type) (BOOL)(((type) & GOPHER_TYPE_DIRECTORY) ? TRUE : FALSE) #define IS_GOPHER_PHONE_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_CSO) ? TRUE : FALSE) #define IS_GOPHER_ERROR(type) (BOOL)(((type) & GOPHER_TYPE_ERROR) ? TRUE : FALSE) #define IS_GOPHER_INDEX_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_INDEX_SERVER) ? TRUE : FALSE) #define IS_GOPHER_TELNET_SESSION(type) (BOOL)(((type) & GOPHER_TYPE_TELNET) ? TRUE : FALSE) #define IS_GOPHER_BACKUP_SERVER(type) (BOOL)(((type) & GOPHER_TYPE_REDUNDANT) ? TRUE : FALSE) #define IS_GOPHER_TN3270_SESSION(type) (BOOL)(((type) & GOPHER_TYPE_TN3270) ? TRUE : FALSE) #define IS_GOPHER_ASK(type) (BOOL)(((type) & GOPHER_TYPE_ASK) ? TRUE : FALSE) #define IS_GOPHER_PLUS(type) (BOOL)(((type) & GOPHER_TYPE_GOPHER_PLUS) ? TRUE : FALSE) #define IS_GOPHER_TYPE_KNOWN(type) (BOOL)(((type) & GOPHER_TYPE_UNKNOWN) ? FALSE : TRUE) #define GOPHER_TYPE_FILE_MASK (GOPHER_TYPE_TEXT_FILE \ | GOPHER_TYPE_MAC_BINHEX \ | GOPHER_TYPE_DOS_ARCHIVE \ | GOPHER_TYPE_UNIX_UUENCODED \ | GOPHER_TYPE_BINARY \ | GOPHER_TYPE_GIF \ | GOPHER_TYPE_IMAGE \ | GOPHER_TYPE_BITMAP \ | GOPHER_TYPE_MOVIE \ | GOPHER_TYPE_SOUND \ | GOPHER_TYPE_HTML \ | GOPHER_TYPE_PDF \ | GOPHER_TYPE_CALENDAR \ | GOPHER_TYPE_INLINE \ ) typedef struct { LPCSTR Comment; LPCSTR EmailAddress; } GOPHER_ADMIN_ATTRIBUTE_TYPEA,* LPGOPHER_ADMIN_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR Comment; LPCWSTR EmailAddress; } GOPHER_ADMIN_ATTRIBUTE_TYPEW,* LPGOPHER_ADMIN_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_ADMIN_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_ADMIN_ATTRIBUTE_TYPE) typedef struct { FILETIME DateAndTime; } GOPHER_MOD_DATE_ATTRIBUTE_TYPE,* LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE; typedef struct { DWORD Ttl; } GOPHER_TTL_ATTRIBUTE_TYPE,* LPGOPHER_TTL_ATTRIBUTE_TYPE; typedef struct { INT Score; } GOPHER_SCORE_ATTRIBUTE_TYPE,* LPGOPHER_SCORE_ATTRIBUTE_TYPE; typedef struct { INT LowerBound; INT UpperBound; } GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE,* LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE; typedef struct { LPCSTR Site; } GOPHER_SITE_ATTRIBUTE_TYPEA,* LPGOPHER_SITE_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR Site; } GOPHER_SITE_ATTRIBUTE_TYPEW,* LPGOPHER_SITE_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_SITE_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_SITE_ATTRIBUTE_TYPE) typedef struct { LPCSTR Organization; } GOPHER_ORGANIZATION_ATTRIBUTE_TYPEA,* LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR Organization; } GOPHER_ORGANIZATION_ATTRIBUTE_TYPEW,* LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_ORGANIZATION_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE) typedef struct { LPCSTR Location; } GOPHER_LOCATION_ATTRIBUTE_TYPEA,* LPGOPHER_LOCATION_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR Location; } GOPHER_LOCATION_ATTRIBUTE_TYPEW,* LPGOPHER_LOCATION_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_LOCATION_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_LOCATION_ATTRIBUTE_TYPE) typedef struct { INT DegreesNorth; INT MinutesNorth; INT SecondsNorth; INT DegreesEast; INT MinutesEast; INT SecondsEast; } GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE,* LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE; typedef struct { INT Zone; } GOPHER_TIMEZONE_ATTRIBUTE_TYPE,* LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE; typedef struct { LPCSTR Provider; } GOPHER_PROVIDER_ATTRIBUTE_TYPEA,* LPGOPHER_PROVIDER_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR Provider; } GOPHER_PROVIDER_ATTRIBUTE_TYPEW,* LPGOPHER_PROVIDER_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_PROVIDER_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_PROVIDER_ATTRIBUTE_TYPE) typedef struct { LPCSTR Version; } GOPHER_VERSION_ATTRIBUTE_TYPEA,* LPGOPHER_VERSION_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR Version; } GOPHER_VERSION_ATTRIBUTE_TYPEW,* LPGOPHER_VERSION_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_VERSION_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_VERSION_ATTRIBUTE_TYPE) typedef struct { LPCSTR ShortAbstract; LPCSTR AbstractFile; } GOPHER_ABSTRACT_ATTRIBUTE_TYPEA,* LPGOPHER_ABSTRACT_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR ShortAbstract; LPCWSTR AbstractFile; } GOPHER_ABSTRACT_ATTRIBUTE_TYPEW,* LPGOPHER_ABSTRACT_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_ABSTRACT_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE) typedef struct { LPCSTR ContentType; LPCSTR Language; DWORD Size; } GOPHER_VIEW_ATTRIBUTE_TYPEA,* LPGOPHER_VIEW_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR ContentType; LPCWSTR Language; DWORD Size; } GOPHER_VIEW_ATTRIBUTE_TYPEW,* LPGOPHER_VIEW_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_VIEW_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_VIEW_ATTRIBUTE_TYPE) typedef struct { BOOL TreeWalk; } GOPHER_VERONICA_ATTRIBUTE_TYPE,* LPGOPHER_VERONICA_ATTRIBUTE_TYPE; typedef struct { LPCSTR QuestionType; LPCSTR QuestionText; } GOPHER_ASK_ATTRIBUTE_TYPEA,* LPGOPHER_ASK_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR QuestionType; LPCWSTR QuestionText; } GOPHER_ASK_ATTRIBUTE_TYPEW,* LPGOPHER_ASK_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_ASK_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_ASK_ATTRIBUTE_TYPE) typedef struct { LPCSTR Text; } GOPHER_UNKNOWN_ATTRIBUTE_TYPEA,* LPGOPHER_UNKNOWN_ATTRIBUTE_TYPEA; typedef struct { LPCWSTR Text; } GOPHER_UNKNOWN_ATTRIBUTE_TYPEW,* LPGOPHER_UNKNOWN_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_UNKNOWN_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE) typedef struct { DWORD CategoryId; DWORD AttributeId; union { GOPHER_ADMIN_ATTRIBUTE_TYPEA Admin; GOPHER_MOD_DATE_ATTRIBUTE_TYPE ModDate; GOPHER_TTL_ATTRIBUTE_TYPE Ttl; GOPHER_SCORE_ATTRIBUTE_TYPE Score; GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE ScoreRange; GOPHER_SITE_ATTRIBUTE_TYPEA Site; GOPHER_ORGANIZATION_ATTRIBUTE_TYPEA Organization; GOPHER_LOCATION_ATTRIBUTE_TYPEA Location; GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE GeographicalLocation; GOPHER_TIMEZONE_ATTRIBUTE_TYPE TimeZone; GOPHER_PROVIDER_ATTRIBUTE_TYPEA Provider; GOPHER_VERSION_ATTRIBUTE_TYPEA Version; GOPHER_ABSTRACT_ATTRIBUTE_TYPEA Abstract; GOPHER_VIEW_ATTRIBUTE_TYPEA View; GOPHER_VERONICA_ATTRIBUTE_TYPE Veronica; GOPHER_ASK_ATTRIBUTE_TYPEA Ask; GOPHER_UNKNOWN_ATTRIBUTE_TYPEA Unknown; } AttributeType; } GOPHER_ATTRIBUTE_TYPEA, *LPGOPHER_ATTRIBUTE_TYPEA; typedef struct { DWORD CategoryId; DWORD AttributeId; union { GOPHER_ADMIN_ATTRIBUTE_TYPEW Admin; GOPHER_MOD_DATE_ATTRIBUTE_TYPE ModDate; GOPHER_TTL_ATTRIBUTE_TYPE Ttl; GOPHER_SCORE_ATTRIBUTE_TYPE Score; GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE ScoreRange; GOPHER_SITE_ATTRIBUTE_TYPEW Site; GOPHER_ORGANIZATION_ATTRIBUTE_TYPEW Organization; GOPHER_LOCATION_ATTRIBUTE_TYPEW Location; GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE GeographicalLocation; GOPHER_TIMEZONE_ATTRIBUTE_TYPE TimeZone; GOPHER_PROVIDER_ATTRIBUTE_TYPEW Provider; GOPHER_VERSION_ATTRIBUTE_TYPEW Version; GOPHER_ABSTRACT_ATTRIBUTE_TYPEW Abstract; GOPHER_VIEW_ATTRIBUTE_TYPEW View; GOPHER_VERONICA_ATTRIBUTE_TYPE Veronica; GOPHER_ASK_ATTRIBUTE_TYPEW Ask; GOPHER_UNKNOWN_ATTRIBUTE_TYPEW Unknown; } AttributeType; } GOPHER_ATTRIBUTE_TYPEW, *LPGOPHER_ATTRIBUTE_TYPEW; DECL_WINELIB_TYPE_AW(GOPHER_ATTRIBUTE_TYPE) DECL_WINELIB_TYPE_AW(LPGOPHER_ATTRIBUTE_TYPE) #define MAX_GOPHER_CATEGORY_NAME 128 #define MAX_GOPHER_ATTRIBUTE_NAME 128 #define MIN_GOPHER_ATTRIBUTE_LENGTH 256 #define GOPHER_INFO_CATEGORY TEXT("+INFO") #define GOPHER_ADMIN_CATEGORY TEXT("+ADMIN") #define GOPHER_VIEWS_CATEGORY TEXT("+VIEWS") #define GOPHER_ABSTRACT_CATEGORY TEXT("+ABSTRACT") #define GOPHER_VERONICA_CATEGORY TEXT("+VERONICA") #define GOPHER_ADMIN_ATTRIBUTE TEXT("Admin") #define GOPHER_MOD_DATE_ATTRIBUTE TEXT("Mod-Date") #define GOPHER_TTL_ATTRIBUTE TEXT("TTL") #define GOPHER_SCORE_ATTRIBUTE TEXT("Score") #define GOPHER_RANGE_ATTRIBUTE TEXT("Score-range") #define GOPHER_SITE_ATTRIBUTE TEXT("Site") #define GOPHER_ORG_ATTRIBUTE TEXT("Org") #define GOPHER_LOCATION_ATTRIBUTE TEXT("Loc") #define GOPHER_GEOG_ATTRIBUTE TEXT("Geog") #define GOPHER_TIMEZONE_ATTRIBUTE TEXT("TZ") #define GOPHER_PROVIDER_ATTRIBUTE TEXT("Provider") #define GOPHER_VERSION_ATTRIBUTE TEXT("Version") #define GOPHER_ABSTRACT_ATTRIBUTE TEXT("Abstract") #define GOPHER_VIEW_ATTRIBUTE TEXT("View") #define GOPHER_TREEWALK_ATTRIBUTE TEXT("treewalk") #define GOPHER_ATTRIBUTE_ID_BASE 0xabcccc00 #define GOPHER_CATEGORY_ID_ALL (GOPHER_ATTRIBUTE_ID_BASE + 1) #define GOPHER_CATEGORY_ID_INFO (GOPHER_ATTRIBUTE_ID_BASE + 2) #define GOPHER_CATEGORY_ID_ADMIN (GOPHER_ATTRIBUTE_ID_BASE + 3) #define GOPHER_CATEGORY_ID_VIEWS (GOPHER_ATTRIBUTE_ID_BASE + 4) #define GOPHER_CATEGORY_ID_ABSTRACT (GOPHER_ATTRIBUTE_ID_BASE + 5) #define GOPHER_CATEGORY_ID_VERONICA (GOPHER_ATTRIBUTE_ID_BASE + 6) #define GOPHER_CATEGORY_ID_ASK (GOPHER_ATTRIBUTE_ID_BASE + 7) #define GOPHER_CATEGORY_ID_UNKNOWN (GOPHER_ATTRIBUTE_ID_BASE + 8) #define GOPHER_ATTRIBUTE_ID_ALL (GOPHER_ATTRIBUTE_ID_BASE + 9) #define GOPHER_ATTRIBUTE_ID_ADMIN (GOPHER_ATTRIBUTE_ID_BASE + 10) #define GOPHER_ATTRIBUTE_ID_MOD_DATE (GOPHER_ATTRIBUTE_ID_BASE + 11) #define GOPHER_ATTRIBUTE_ID_TTL (GOPHER_ATTRIBUTE_ID_BASE + 12) #define GOPHER_ATTRIBUTE_ID_SCORE (GOPHER_ATTRIBUTE_ID_BASE + 13) #define GOPHER_ATTRIBUTE_ID_RANGE (GOPHER_ATTRIBUTE_ID_BASE + 14) #define GOPHER_ATTRIBUTE_ID_SITE (GOPHER_ATTRIBUTE_ID_BASE + 15) #define GOPHER_ATTRIBUTE_ID_ORG (GOPHER_ATTRIBUTE_ID_BASE + 16) #define GOPHER_ATTRIBUTE_ID_LOCATION (GOPHER_ATTRIBUTE_ID_BASE + 17) #define GOPHER_ATTRIBUTE_ID_GEOG (GOPHER_ATTRIBUTE_ID_BASE + 18) #define GOPHER_ATTRIBUTE_ID_TIMEZONE (GOPHER_ATTRIBUTE_ID_BASE + 19) #define GOPHER_ATTRIBUTE_ID_PROVIDER (GOPHER_ATTRIBUTE_ID_BASE + 20) #define GOPHER_ATTRIBUTE_ID_VERSION (GOPHER_ATTRIBUTE_ID_BASE + 21) #define GOPHER_ATTRIBUTE_ID_ABSTRACT (GOPHER_ATTRIBUTE_ID_BASE + 22) #define GOPHER_ATTRIBUTE_ID_VIEW (GOPHER_ATTRIBUTE_ID_BASE + 23) #define GOPHER_ATTRIBUTE_ID_TREEWALK (GOPHER_ATTRIBUTE_ID_BASE + 24) #define GOPHER_ATTRIBUTE_ID_UNKNOWN (GOPHER_ATTRIBUTE_ID_BASE + 25) BOOLAPI GopherCreateLocatorA(LPCSTR ,INTERNET_PORT ,LPCSTR , LPCSTR ,DWORD ,LPSTR ,LPDWORD); BOOLAPI GopherCreateLocatorW(LPCWSTR ,INTERNET_PORT ,LPCWSTR , LPCWSTR ,DWORD ,LPWSTR ,LPDWORD); #define GopherCreateLocator WINELIB_NAME_AW(GopherCreateLocator) BOOLAPI GopherGetLocatorTypeA(LPCSTR ,LPDWORD); BOOLAPI GopherGetLocatorTypeW(LPCWSTR ,LPDWORD); #define GopherGetLocatorType WINELIB_NAME_AW(GopherGetLocatorType) INTERNETAPI HINTERNET WINAPI GopherFindFirstFileA(HINTERNET ,LPCSTR , LPCSTR ,LPGOPHER_FIND_DATAA ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI GopherFindFirstFileW(HINTERNET ,LPCWSTR , LPCWSTR ,LPGOPHER_FIND_DATAW ,DWORD ,DWORD_PTR); #define GopherFindFirstFile WINELIB_NAME_AW(GopherFindFirstFile) INTERNETAPI HINTERNET WINAPI GopherOpenFileA(HINTERNET ,LPCSTR ,LPCSTR ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI GopherOpenFileW(HINTERNET ,LPCWSTR ,LPCWSTR ,DWORD ,DWORD_PTR); #define GopherOpenFile WINELIB_NAME_AW(GopherOpenFile) typedef BOOL (CALLBACK *GOPHER_ATTRIBUTE_ENUMERATORA)(LPGOPHER_ATTRIBUTE_TYPEA ,DWORD); typedef BOOL (CALLBACK *GOPHER_ATTRIBUTE_ENUMERATORW)(LPGOPHER_ATTRIBUTE_TYPEW ,DWORD); DECL_WINELIB_TYPE_AW(GOPHER_ATTRIBUTE_ENUMERATOR) BOOLAPI GopherGetAttributeA(HINTERNET ,LPCSTR ,LPCSTR ,LPBYTE , DWORD ,LPDWORD ,GOPHER_ATTRIBUTE_ENUMERATORA ,DWORD_PTR); BOOLAPI GopherGetAttributeW(HINTERNET ,LPCWSTR ,LPCWSTR ,LPBYTE , DWORD ,LPDWORD ,GOPHER_ATTRIBUTE_ENUMERATORW ,DWORD_PTR); #define GopherGetAttribute WINELIB_NAME_AW(GopherGetAttribute) #define HTTP_MAJOR_VERSION 1 #define HTTP_MINOR_VERSION 0 #define HTTP_VERSION TEXT("HTTP/1.0") #define HTTP_QUERY_MIME_VERSION 0 #define HTTP_QUERY_CONTENT_TYPE 1 #define HTTP_QUERY_CONTENT_TRANSFER_ENCODING 2 #define HTTP_QUERY_CONTENT_ID 3 #define HTTP_QUERY_CONTENT_DESCRIPTION 4 #define HTTP_QUERY_CONTENT_LENGTH 5 #define HTTP_QUERY_CONTENT_LANGUAGE 6 #define HTTP_QUERY_ALLOW 7 #define HTTP_QUERY_PUBLIC 8 #define HTTP_QUERY_DATE 9 #define HTTP_QUERY_EXPIRES 10 #define HTTP_QUERY_LAST_MODIFIED 11 #define HTTP_QUERY_MESSAGE_ID 12 #define HTTP_QUERY_URI 13 #define HTTP_QUERY_DERIVED_FROM 14 #define HTTP_QUERY_COST 15 #define HTTP_QUERY_LINK 16 #define HTTP_QUERY_PRAGMA 17 #define HTTP_QUERY_VERSION 18 #define HTTP_QUERY_STATUS_CODE 19 #define HTTP_QUERY_STATUS_TEXT 20 #define HTTP_QUERY_RAW_HEADERS 21 #define HTTP_QUERY_RAW_HEADERS_CRLF 22 #define HTTP_QUERY_CONNECTION 23 #define HTTP_QUERY_ACCEPT 24 #define HTTP_QUERY_ACCEPT_CHARSET 25 #define HTTP_QUERY_ACCEPT_ENCODING 26 #define HTTP_QUERY_ACCEPT_LANGUAGE 27 #define HTTP_QUERY_AUTHORIZATION 28 #define HTTP_QUERY_CONTENT_ENCODING 29 #define HTTP_QUERY_FORWARDED 30 #define HTTP_QUERY_FROM 31 #define HTTP_QUERY_IF_MODIFIED_SINCE 32 #define HTTP_QUERY_LOCATION 33 #define HTTP_QUERY_ORIG_URI 34 #define HTTP_QUERY_REFERER 35 #define HTTP_QUERY_RETRY_AFTER 36 #define HTTP_QUERY_SERVER 37 #define HTTP_QUERY_TITLE 38 #define HTTP_QUERY_USER_AGENT 39 #define HTTP_QUERY_WWW_AUTHENTICATE 40 #define HTTP_QUERY_PROXY_AUTHENTICATE 41 #define HTTP_QUERY_ACCEPT_RANGES 42 #define HTTP_QUERY_SET_COOKIE 43 #define HTTP_QUERY_COOKIE 44 #define HTTP_QUERY_REQUEST_METHOD 45 #define HTTP_QUERY_REFRESH 46 #define HTTP_QUERY_CONTENT_DISPOSITION 47 #define HTTP_QUERY_AGE 48 #define HTTP_QUERY_CACHE_CONTROL 49 #define HTTP_QUERY_CONTENT_BASE 50 #define HTTP_QUERY_CONTENT_LOCATION 51 #define HTTP_QUERY_CONTENT_MD5 52 #define HTTP_QUERY_CONTENT_RANGE 53 #define HTTP_QUERY_ETAG 54 #define HTTP_QUERY_HOST 55 #define HTTP_QUERY_IF_MATCH 56 #define HTTP_QUERY_IF_NONE_MATCH 57 #define HTTP_QUERY_IF_RANGE 58 #define HTTP_QUERY_IF_UNMODIFIED_SINCE 59 #define HTTP_QUERY_MAX_FORWARDS 60 #define HTTP_QUERY_PROXY_AUTHORIZATION 61 #define HTTP_QUERY_RANGE 62 #define HTTP_QUERY_TRANSFER_ENCODING 63 #define HTTP_QUERY_UPGRADE 64 #define HTTP_QUERY_VARY 65 #define HTTP_QUERY_VIA 66 #define HTTP_QUERY_WARNING 67 #define HTTP_QUERY_EXPECT 68 #define HTTP_QUERY_PROXY_CONNECTION 69 #define HTTP_QUERY_UNLESS_MODIFIED_SINCE 70 #define HTTP_QUERY_ECHO_REQUEST 71 #define HTTP_QUERY_ECHO_REPLY 72 #define HTTP_QUERY_ECHO_HEADERS 73 #define HTTP_QUERY_ECHO_HEADERS_CRLF 74 #define HTTP_QUERY_PROXY_SUPPORT 75 #define HTTP_QUERY_AUTHENTICATION_INFO 76 #define HTTP_QUERY_PASSPORT_URLS 77 #define HTTP_QUERY_PASSPORT_CONFIG 78 #define HTTP_QUERY_MAX 78 #define HTTP_QUERY_CUSTOM 65535 #define HTTP_QUERY_FLAG_REQUEST_HEADERS 0x80000000 #define HTTP_QUERY_FLAG_SYSTEMTIME 0x40000000 #define HTTP_QUERY_FLAG_NUMBER 0x20000000 #define HTTP_QUERY_FLAG_COALESCE 0x10000000 #define HTTP_QUERY_MODIFIER_FLAGS_MASK (HTTP_QUERY_FLAG_REQUEST_HEADERS \ | HTTP_QUERY_FLAG_SYSTEMTIME \ | HTTP_QUERY_FLAG_NUMBER \ | HTTP_QUERY_FLAG_COALESCE \ ) #define HTTP_QUERY_HEADER_MASK (~HTTP_QUERY_MODIFIER_FLAGS_MASK) #define HTTP_STATUS_CONTINUE 100 #define HTTP_STATUS_SWITCH_PROTOCOLS 101 #define HTTP_STATUS_OK 200 #define HTTP_STATUS_CREATED 201 #define HTTP_STATUS_ACCEPTED 202 #define HTTP_STATUS_PARTIAL 203 #define HTTP_STATUS_NO_CONTENT 204 #define HTTP_STATUS_RESET_CONTENT 205 #define HTTP_STATUS_PARTIAL_CONTENT 206 #define HTTP_STATUS_AMBIGUOUS 300 #define HTTP_STATUS_MOVED 301 #define HTTP_STATUS_REDIRECT 302 #define HTTP_STATUS_REDIRECT_METHOD 303 #define HTTP_STATUS_NOT_MODIFIED 304 #define HTTP_STATUS_USE_PROXY 305 #define HTTP_STATUS_REDIRECT_KEEP_VERB 307 #define HTTP_STATUS_BAD_REQUEST 400 #define HTTP_STATUS_DENIED 401 #define HTTP_STATUS_PAYMENT_REQ 402 #define HTTP_STATUS_FORBIDDEN 403 #define HTTP_STATUS_NOT_FOUND 404 #define HTTP_STATUS_BAD_METHOD 405 #define HTTP_STATUS_NONE_ACCEPTABLE 406 #define HTTP_STATUS_PROXY_AUTH_REQ 407 #define HTTP_STATUS_REQUEST_TIMEOUT 408 #define HTTP_STATUS_CONFLICT 409 #define HTTP_STATUS_GONE 410 #define HTTP_STATUS_LENGTH_REQUIRED 411 #define HTTP_STATUS_PRECOND_FAILED 412 #define HTTP_STATUS_REQUEST_TOO_LARGE 413 #define HTTP_STATUS_URI_TOO_LONG 414 #define HTTP_STATUS_UNSUPPORTED_MEDIA 415 #define HTTP_STATUS_SERVER_ERROR 500 #define HTTP_STATUS_NOT_SUPPORTED 501 #define HTTP_STATUS_BAD_GATEWAY 502 #define HTTP_STATUS_SERVICE_UNAVAIL 503 #define HTTP_STATUS_GATEWAY_TIMEOUT 504 #define HTTP_STATUS_VERSION_NOT_SUP 505 #define HTTP_STATUS_FIRST HTTP_STATUS_CONTINUE #define HTTP_STATUS_LAST HTTP_STATUS_VERSION_NOT_SUP INTERNETAPI HINTERNET WINAPI HttpOpenRequestA(HINTERNET ,LPCSTR ,LPCSTR ,LPCSTR , LPCSTR ,LPCSTR * ,DWORD ,DWORD_PTR); INTERNETAPI HINTERNET WINAPI HttpOpenRequestW(HINTERNET ,LPCWSTR ,LPCWSTR ,LPCWSTR , LPCWSTR ,LPCWSTR * ,DWORD ,DWORD_PTR); #define HttpOpenRequest WINELIB_NAME_AW(HttpOpenRequest) BOOLAPI HttpAddRequestHeadersA(HINTERNET ,LPCSTR ,DWORD ,DWORD); BOOLAPI HttpAddRequestHeadersW(HINTERNET ,LPCWSTR ,DWORD ,DWORD); #define HttpAddRequestHeaders WINELIB_NAME_AW(HttpAddRequestHeaders) #define HTTP_ADDREQ_INDEX_MASK 0x0000FFFF #define HTTP_ADDREQ_FLAGS_MASK 0xFFFF0000 #define HTTP_ADDREQ_FLAG_ADD_IF_NEW 0x10000000 #define HTTP_ADDREQ_FLAG_ADD 0x20000000 #define HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA 0x40000000 #define HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON 0x01000000 #define HTTP_ADDREQ_FLAG_COALESCE HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA #define HTTP_ADDREQ_FLAG_REPLACE 0x80000000 BOOLAPI HttpSendRequestA(HINTERNET ,LPCSTR ,DWORD ,LPVOID ,DWORD); BOOLAPI HttpSendRequestW(HINTERNET ,LPCWSTR ,DWORD ,LPVOID ,DWORD); #define HttpSendRequest WINELIB_NAME_AW(HttpSendRequest) INTERNETAPI BOOL WINAPI HttpSendRequestExA(HINTERNET ,LPINTERNET_BUFFERSA , LPINTERNET_BUFFERSA ,DWORD ,DWORD_PTR); INTERNETAPI BOOL WINAPI HttpSendRequestExW(HINTERNET ,LPINTERNET_BUFFERSW , LPINTERNET_BUFFERSW ,DWORD ,DWORD_PTR); #define HttpSendRequestEx WINELIB_NAME_AW(HttpSendRequestEx) #define HSR_ASYNC WININET_API_FLAG_ASYNC #define HSR_SYNC WININET_API_FLAG_SYNC #define HSR_USE_CONTEXT WININET_API_FLAG_USE_CONTEXT #define HSR_INITIATE 0x00000008 #define HSR_DOWNLOAD 0x00000010 #define HSR_CHUNKED 0x00000020 INTERNETAPI BOOL WINAPI HttpEndRequestA(HINTERNET ,LPINTERNET_BUFFERSA ,DWORD ,DWORD_PTR); INTERNETAPI BOOL WINAPI HttpEndRequestW(HINTERNET ,LPINTERNET_BUFFERSW ,DWORD ,DWORD_PTR); #define HttpEndRequest WINELIB_NAME_AW(HttpEndRequest) BOOLAPI HttpQueryInfoA(HINTERNET ,DWORD ,LPVOID ,LPDWORD ,LPDWORD); BOOLAPI HttpQueryInfoW(HINTERNET ,DWORD ,LPVOID ,LPDWORD ,LPDWORD); #define HttpQueryInfo WINELIB_NAME_AW(HttpQueryInfo) BOOLAPI InternetClearAllPerSiteCookieDecisions(VOID); BOOLAPI InternetEnumPerSiteCookieDecisionA(LPSTR,ULONG *,ULONG *,ULONG); BOOLAPI InternetEnumPerSiteCookieDecisionW(LPWSTR,ULONG *,ULONG *,ULONG); #define InternetEnumPerSiteCookieDecision WINELIB_NAME_AW(InternetEnumPerSiteCookieDecision) #define INTERNET_COOKIE_IS_SECURE 0x00000001 #define INTERNET_COOKIE_IS_SESSION 0x00000002 #define INTERNET_COOKIE_THIRD_PARTY 0x00000010 #define INTERNET_COOKIE_PROMPT_REQUIRED 0x00000020 #define INTERNET_COOKIE_EVALUATE_P3P 0x00000040 #define INTERNET_COOKIE_APPLY_P3P 0x00000080 #define INTERNET_COOKIE_P3P_ENABLED 0x00000100 #define INTERNET_COOKIE_IS_RESTRICTED 0x00000200 #define INTERNET_COOKIE_IE6 0x00000400 #define INTERNET_COOKIE_IS_LEGACY 0x00000800 BOOLAPI InternetGetCookieExA(LPCSTR,LPCSTR,LPSTR,LPDWORD,DWORD,LPVOID); BOOLAPI InternetGetCookieExW(LPCWSTR,LPCWSTR,LPWSTR,LPDWORD,DWORD,LPVOID); #define InternetGetCookieEx WINELIB_NAME_AW(InternetGetCookieEx) DWORD WINAPI InternetSetCookieExA(LPCSTR,LPCSTR,LPCSTR,DWORD,DWORD_PTR); DWORD WINAPI InternetSetCookieExW(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,DWORD_PTR); #define InternetSetCookieEx WINELIB_NAME_AW(InternetSetCookieEx) BOOLAPI InternetGetPerSiteCookieDecisionA(LPCSTR,ULONG *); BOOLAPI InternetGetPerSiteCookieDecisionW(LPCWSTR,ULONG *); #define InternetGetPerSiteCookieDecision WINELIB_NAME_AW(InternetGetPerSiteCookieDecision) BOOLAPI InternetSetPerSiteCookieDecisionA(LPCSTR,DWORD); BOOLAPI InternetSetPerSiteCookieDecisionW(LPCWSTR,DWORD); #define InternetSetPerSiteCookieDecision WINELIB_NAME_AW(InternetSetPerSiteCookieDecision) BOOLAPI InternetSetCookieA(LPCSTR ,LPCSTR ,LPCSTR); BOOLAPI InternetSetCookieW(LPCWSTR ,LPCWSTR ,LPCWSTR); #define InternetSetCookie WINELIB_NAME_AW(InternetSetCookie) BOOLAPI InternetGetCookieA(LPCSTR ,LPCSTR ,LPSTR ,LPDWORD); BOOLAPI InternetGetCookieW(LPCWSTR ,LPCWSTR ,LPWSTR ,LPDWORD); #define InternetGetCookie WINELIB_NAME_AW(InternetGetCookie) INTERNETAPI DWORD WINAPI InternetAttemptConnect(DWORD); BOOLAPI InternetCheckConnectionA(LPCSTR ,DWORD ,DWORD); BOOLAPI InternetCheckConnectionW(LPCWSTR ,DWORD ,DWORD); #define InternetCheckConnection WINELIB_NAME_AW(InternetCheckConnection) #define FLAG_ICC_FORCE_CONNECTION 0x00000001 #define FLAGS_ERROR_UI_FILTER_FOR_ERRORS 0x01 #define FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS 0x02 #define FLAGS_ERROR_UI_FLAGS_GENERATE_DATA 0x04 #define FLAGS_ERROR_UI_FLAGS_NO_UI 0x08 #define FLAGS_ERROR_UI_SERIALIZE_DIALOGS 0x10 DWORD InternetAuthNotifyCallback ( DWORD_PTR ,DWORD ,LPVOID ); typedef DWORD (CALLBACK *PFN_AUTH_NOTIFY) (DWORD_PTR,DWORD,LPVOID); typedef struct { DWORD cbStruct; DWORD dwOptions; PFN_AUTH_NOTIFY pfnNotify; DWORD_PTR dwContext; } INTERNET_AUTH_NOTIFY_DATA; INTERNETAPI DWORD WINAPI InternetErrorDlg(HWND ,HINTERNET ,DWORD ,DWORD ,LPVOID *); INTERNETAPI DWORD WINAPI InternetConfirmZoneCrossingA(HWND ,LPSTR ,LPSTR ,BOOL); INTERNETAPI DWORD WINAPI InternetConfirmZoneCrossingW(HWND ,LPWSTR ,LPWSTR ,BOOL); #define InternetConfirmZoneCrossing WINELIB_NAME_AW(InternetConfirmZoneCrossing) #define PRIVACY_TEMPLATE_NO_COOKIES 0 #define PRIVACY_TEMPLATE_HIGH 1 #define PRIVACY_TEMPLATE_MEDIUM_HIGH 2 #define PRIVACY_TEMPLATE_MEDIUM 3 #define PRIVACY_TEMPLATE_MEDIUM_LOW 4 #define PRIVACY_TEMPLATE_LOW 5 #define PRIVACY_TEMPLATE_CUSTOM 100 #define PRIVACY_TEMPLATE_ADVANCED 101 #define PRIVACY_TEMPLATE_MAX PRIVACY_TEMPLATE_LOW #define PRIVACY_TYPE_FIRST_PARTY 0 #define PRIVACY_TYPE_THIRD_PARTY 1 INTERNETAPI DWORD WINAPI PrivacySetZonePreferenceW(DWORD,DWORD,DWORD,LPCWSTR); INTERNETAPI DWORD WINAPI PrivacyGetZonePreferenceW(DWORD,DWORD,LPDWORD,LPWSTR,LPDWORD); #define INTERNET_ERROR_BASE 12000 #define ERROR_INTERNET_OUT_OF_HANDLES (INTERNET_ERROR_BASE + 1) #define ERROR_INTERNET_TIMEOUT (INTERNET_ERROR_BASE + 2) #define ERROR_INTERNET_EXTENDED_ERROR (INTERNET_ERROR_BASE + 3) #define ERROR_INTERNET_INTERNAL_ERROR (INTERNET_ERROR_BASE + 4) #define ERROR_INTERNET_INVALID_URL (INTERNET_ERROR_BASE + 5) #define ERROR_INTERNET_UNRECOGNIZED_SCHEME (INTERNET_ERROR_BASE + 6) #define ERROR_INTERNET_NAME_NOT_RESOLVED (INTERNET_ERROR_BASE + 7) #define ERROR_INTERNET_PROTOCOL_NOT_FOUND (INTERNET_ERROR_BASE + 8) #define ERROR_INTERNET_INVALID_OPTION (INTERNET_ERROR_BASE + 9) #define ERROR_INTERNET_BAD_OPTION_LENGTH (INTERNET_ERROR_BASE + 10) #define ERROR_INTERNET_OPTION_NOT_SETTABLE (INTERNET_ERROR_BASE + 11) #define ERROR_INTERNET_SHUTDOWN (INTERNET_ERROR_BASE + 12) #define ERROR_INTERNET_INCORRECT_USER_NAME (INTERNET_ERROR_BASE + 13) #define ERROR_INTERNET_INCORRECT_PASSWORD (INTERNET_ERROR_BASE + 14) #define ERROR_INTERNET_LOGIN_FAILURE (INTERNET_ERROR_BASE + 15) #define ERROR_INTERNET_INVALID_OPERATION (INTERNET_ERROR_BASE + 16) #define ERROR_INTERNET_OPERATION_CANCELLED (INTERNET_ERROR_BASE + 17) #define ERROR_INTERNET_INCORRECT_HANDLE_TYPE (INTERNET_ERROR_BASE + 18) #define ERROR_INTERNET_INCORRECT_HANDLE_STATE (INTERNET_ERROR_BASE + 19) #define ERROR_INTERNET_NOT_PROXY_REQUEST (INTERNET_ERROR_BASE + 20) #define ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND (INTERNET_ERROR_BASE + 21) #define ERROR_INTERNET_BAD_REGISTRY_PARAMETER (INTERNET_ERROR_BASE + 22) #define ERROR_INTERNET_NO_DIRECT_ACCESS (INTERNET_ERROR_BASE + 23) #define ERROR_INTERNET_NO_CONTEXT (INTERNET_ERROR_BASE + 24) #define ERROR_INTERNET_NO_CALLBACK (INTERNET_ERROR_BASE + 25) #define ERROR_INTERNET_REQUEST_PENDING (INTERNET_ERROR_BASE + 26) #define ERROR_INTERNET_INCORRECT_FORMAT (INTERNET_ERROR_BASE + 27) #define ERROR_INTERNET_ITEM_NOT_FOUND (INTERNET_ERROR_BASE + 28) #define ERROR_INTERNET_CANNOT_CONNECT (INTERNET_ERROR_BASE + 29) #define ERROR_INTERNET_CONNECTION_ABORTED (INTERNET_ERROR_BASE + 30) #define ERROR_INTERNET_CONNECTION_RESET (INTERNET_ERROR_BASE + 31) #define ERROR_INTERNET_FORCE_RETRY (INTERNET_ERROR_BASE + 32) #define ERROR_INTERNET_INVALID_PROXY_REQUEST (INTERNET_ERROR_BASE + 33) #define ERROR_INTERNET_NEED_UI (INTERNET_ERROR_BASE + 34) #define ERROR_INTERNET_HANDLE_EXISTS (INTERNET_ERROR_BASE + 36) #define ERROR_INTERNET_SEC_CERT_DATE_INVALID (INTERNET_ERROR_BASE + 37) #define ERROR_INTERNET_SEC_CERT_CN_INVALID (INTERNET_ERROR_BASE + 38) #define ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR (INTERNET_ERROR_BASE + 39) #define ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR (INTERNET_ERROR_BASE + 40) #define ERROR_INTERNET_MIXED_SECURITY (INTERNET_ERROR_BASE + 41) #define ERROR_INTERNET_CHG_POST_IS_NON_SECURE (INTERNET_ERROR_BASE + 42) #define ERROR_INTERNET_POST_IS_NON_SECURE (INTERNET_ERROR_BASE + 43) #define ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED (INTERNET_ERROR_BASE + 44) #define ERROR_INTERNET_INVALID_CA (INTERNET_ERROR_BASE + 45) #define ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP (INTERNET_ERROR_BASE + 46) #define ERROR_INTERNET_ASYNC_THREAD_FAILED (INTERNET_ERROR_BASE + 47) #define ERROR_INTERNET_REDIRECT_SCHEME_CHANGE (INTERNET_ERROR_BASE + 48) #define ERROR_INTERNET_DIALOG_PENDING (INTERNET_ERROR_BASE + 49) #define ERROR_INTERNET_RETRY_DIALOG (INTERNET_ERROR_BASE + 50) #define ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR (INTERNET_ERROR_BASE + 52) #define ERROR_INTERNET_INSERT_CDROM (INTERNET_ERROR_BASE + 53) #define ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED (INTERNET_ERROR_BASE + 54) #define ERROR_INTERNET_SEC_CERT_ERRORS (INTERNET_ERROR_BASE + 55) #define ERROR_INTERNET_SEC_CERT_NO_REV (INTERNET_ERROR_BASE + 56) #define ERROR_INTERNET_SEC_CERT_REV_FAILED (INTERNET_ERROR_BASE + 57) #define ERROR_FTP_TRANSFER_IN_PROGRESS (INTERNET_ERROR_BASE + 110) #define ERROR_FTP_DROPPED (INTERNET_ERROR_BASE + 111) #define ERROR_FTP_NO_PASSIVE_MODE (INTERNET_ERROR_BASE + 112) #define ERROR_GOPHER_PROTOCOL_ERROR (INTERNET_ERROR_BASE + 130) #define ERROR_GOPHER_NOT_FILE (INTERNET_ERROR_BASE + 131) #define ERROR_GOPHER_DATA_ERROR (INTERNET_ERROR_BASE + 132) #define ERROR_GOPHER_END_OF_DATA (INTERNET_ERROR_BASE + 133) #define ERROR_GOPHER_INVALID_LOCATOR (INTERNET_ERROR_BASE + 134) #define ERROR_GOPHER_INCORRECT_LOCATOR_TYPE (INTERNET_ERROR_BASE + 135) #define ERROR_GOPHER_NOT_GOPHER_PLUS (INTERNET_ERROR_BASE + 136) #define ERROR_GOPHER_ATTRIBUTE_NOT_FOUND (INTERNET_ERROR_BASE + 137) #define ERROR_GOPHER_UNKNOWN_LOCATOR (INTERNET_ERROR_BASE + 138) #define ERROR_HTTP_HEADER_NOT_FOUND (INTERNET_ERROR_BASE + 150) #define ERROR_HTTP_DOWNLEVEL_SERVER (INTERNET_ERROR_BASE + 151) #define ERROR_HTTP_INVALID_SERVER_RESPONSE (INTERNET_ERROR_BASE + 152) #define ERROR_HTTP_INVALID_HEADER (INTERNET_ERROR_BASE + 153) #define ERROR_HTTP_INVALID_QUERY_REQUEST (INTERNET_ERROR_BASE + 154) #define ERROR_HTTP_HEADER_ALREADY_EXISTS (INTERNET_ERROR_BASE + 155) #define ERROR_HTTP_REDIRECT_FAILED (INTERNET_ERROR_BASE + 156) #define ERROR_HTTP_NOT_REDIRECTED (INTERNET_ERROR_BASE + 160) #define ERROR_HTTP_COOKIE_NEEDS_CONFIRMATION (INTERNET_ERROR_BASE + 161) #define ERROR_HTTP_COOKIE_DECLINED (INTERNET_ERROR_BASE + 162) #define ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION (INTERNET_ERROR_BASE + 168) #define ERROR_INTERNET_SECURITY_CHANNEL_ERROR (INTERNET_ERROR_BASE + 157) #define ERROR_INTERNET_UNABLE_TO_CACHE_FILE (INTERNET_ERROR_BASE + 158) #define ERROR_INTERNET_TCPIP_NOT_INSTALLED (INTERNET_ERROR_BASE + 159) #define ERROR_INTERNET_DISCONNECTED (INTERNET_ERROR_BASE + 163) #define ERROR_INTERNET_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 164) #define ERROR_INTERNET_PROXY_SERVER_UNREACHABLE (INTERNET_ERROR_BASE + 165) #define ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT (INTERNET_ERROR_BASE + 166) #define ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT (INTERNET_ERROR_BASE + 167) #define ERROR_INTERNET_SEC_INVALID_CERT (INTERNET_ERROR_BASE + 169) #define ERROR_INTERNET_SEC_CERT_REVOKED (INTERNET_ERROR_BASE + 170) #define ERROR_INTERNET_FAILED_DUETOSECURITYCHECK (INTERNET_ERROR_BASE + 171) #define ERROR_INTERNET_NOT_INITIALIZED (INTERNET_ERROR_BASE + 172) #define ERROR_INTERNET_NEED_MSN_SSPI_PKG (INTERNET_ERROR_BASE + 173) #define ERROR_INTERNET_LOGIN_FAILURE_DISPLAY_ENTITY_BODY (INTERNET_ERROR_BASE + 174) #define ERROR_INTERNET_DECODING_FAILED (INTERNET_ERROR_BASE + 175) #define INTERNET_ERROR_LAST ERROR_INTERNET_DECODING_FAILED #define NORMAL_CACHE_ENTRY 0x00000001 #define STICKY_CACHE_ENTRY 0x00000004 #define EDITED_CACHE_ENTRY 0x00000008 #define COOKIE_CACHE_ENTRY 0x00100000 #define URLHISTORY_CACHE_ENTRY 0x00200000 #define TRACK_OFFLINE_CACHE_ENTRY 0x00000010 #define TRACK_ONLINE_CACHE_ENTRY 0x00000020 #define SPARSE_CACHE_ENTRY 0x00010000 #define URLCACHE_FIND_DEFAULT_FILTER NORMAL_CACHE_ENTRY \ | COOKIE_CACHE_ENTRY \ | URLHISTORY_CACHE_ENTRY \ | TRACK_OFFLINE_CACHE_ENTRY \ | TRACK_ONLINE_CACHE_ENTRY \ | STICKY_CACHE_ENTRY typedef struct _INTERNET_CACHE_ENTRY_INFOA { DWORD dwStructSize; LPSTR lpszSourceUrlName; LPSTR lpszLocalFileName; DWORD CacheEntryType; DWORD dwUseCount; DWORD dwHitRate; DWORD dwSizeLow; DWORD dwSizeHigh; FILETIME LastModifiedTime; FILETIME ExpireTime; FILETIME LastAccessTime; FILETIME LastSyncTime; LPBYTE lpHeaderInfo; DWORD dwHeaderInfoSize; LPSTR lpszFileExtension; union { DWORD dwReserved; DWORD dwExemptDelta; } DUMMYUNIONNAME; } INTERNET_CACHE_ENTRY_INFOA,* LPINTERNET_CACHE_ENTRY_INFOA; typedef struct _INTERNET_CACHE_ENTRY_INFOW { DWORD dwStructSize; LPWSTR lpszSourceUrlName; LPWSTR lpszLocalFileName; DWORD CacheEntryType; DWORD dwUseCount; DWORD dwHitRate; DWORD dwSizeLow; DWORD dwSizeHigh; FILETIME LastModifiedTime; FILETIME ExpireTime; FILETIME LastAccessTime; FILETIME LastSyncTime; LPBYTE lpHeaderInfo; DWORD dwHeaderInfoSize; LPWSTR lpszFileExtension; union { DWORD dwReserved; DWORD dwExemptDelta; } DUMMYUNIONNAME; } INTERNET_CACHE_ENTRY_INFOW,* LPINTERNET_CACHE_ENTRY_INFOW; DECL_WINELIB_TYPE_AW(INTERNET_CACHE_ENTRY_INFO) DECL_WINELIB_TYPE_AW(LPINTERNET_CACHE_ENTRY_INFO) typedef struct _INTERNET_CACHE_TIMESTAMPS { FILETIME ftExpires; FILETIME ftLastModified; } INTERNET_CACHE_TIMESTAMPS, *LPINTERNET_CACHE_TIMESTAMPS; BOOLAPI CreateUrlCacheEntryA(LPCSTR ,DWORD ,LPCSTR ,LPSTR ,DWORD); BOOLAPI CreateUrlCacheEntryW(LPCWSTR ,DWORD ,LPCWSTR ,LPWSTR ,DWORD); #define CreateUrlCacheEntry WINELIB_NAME_AW(CreateUrlCacheEntry) BOOLAPI CommitUrlCacheEntryA(LPCSTR,LPCSTR,FILETIME,FILETIME,DWORD,LPBYTE,DWORD,LPCSTR,LPCSTR); BOOLAPI CommitUrlCacheEntryW(LPCWSTR,LPCWSTR,FILETIME,FILETIME,DWORD,LPWSTR,DWORD,LPCWSTR,LPCWSTR); #define CommitUrlCacheEntry WINELIB_NAME_AW(CommitUrlCacheEntry) BOOLAPI ResumeSuspendedDownload(HINTERNET, DWORD); BOOLAPI RetrieveUrlCacheEntryFileA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,DWORD); BOOLAPI RetrieveUrlCacheEntryFileW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,DWORD); #define RetrieveUrlCacheEntryFile WINELIB_NAME_AW(RetrieveUrlCacheEntryFile) BOOLAPI UnlockUrlCacheEntryFileA(LPCSTR ,DWORD); BOOLAPI UnlockUrlCacheEntryFileW(LPCWSTR ,DWORD); #define UnlockUrlCacheEntryFile WINELIB_NAME_AW(UnlockUrlCacheEntryFile) INTERNETAPI HANDLE WINAPI RetrieveUrlCacheEntryStreamA(LPCSTR , LPINTERNET_CACHE_ENTRY_INFOA , LPDWORD ,BOOL ,DWORD); INTERNETAPI HANDLE WINAPI RetrieveUrlCacheEntryStreamW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW , LPDWORD ,BOOL ,DWORD); #define RetrieveUrlCacheEntryStream WINELIB_NAME_AW(RetrieveUrlCacheEntryStream) BOOLAPI ReadUrlCacheEntryStream( HANDLE ,DWORD ,LPVOID ,LPDWORD ,DWORD ); BOOLAPI UnlockUrlCacheEntryStream( HANDLE ,DWORD ); BOOLAPI GetUrlCacheEntryInfoA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD); BOOLAPI GetUrlCacheEntryInfoW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD); #define GetUrlCacheEntryInfo WINELIB_NAME_AW(GetUrlCacheEntryInfo) BOOLAPI GetUrlCacheEntryInfoExA( LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPSTR ,LPDWORD ,LPVOID ,DWORD); BOOLAPI GetUrlCacheEntryInfoExW( LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPWSTR ,LPDWORD ,LPVOID ,DWORD); #define GetUrlCacheEntryInfoEx WINELIB_NAME_AW(GetUrlCacheEntryInfoEx) #define CACHE_ENTRY_ATTRIBUTE_FC 0x00000004 #define CACHE_ENTRY_HITRATE_FC 0x00000010 #define CACHE_ENTRY_MODTIME_FC 0x00000040 #define CACHE_ENTRY_EXPTIME_FC 0x00000080 #define CACHE_ENTRY_ACCTIME_FC 0x00000100 #define CACHE_ENTRY_SYNCTIME_FC 0x00000200 #define CACHE_ENTRY_HEADERINFO_FC 0x00000400 #define CACHE_ENTRY_EXEMPT_DELTA_FC 0x00000800 BOOLAPI SetUrlCacheEntryInfoA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,DWORD); BOOLAPI SetUrlCacheEntryInfoW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,DWORD); #define SetUrlCacheEntryInfo WINELIB_NAME_AW(SetUrlCacheEntryInfo) typedef LONGLONG GROUPID; INTERNETAPI GROUPID WINAPI CreateUrlCacheGroup(DWORD,LPVOID); BOOLAPI DeleteUrlCacheGroup(GROUPID ,DWORD ,LPVOID); INTERNETAPI HANDLE WINAPI FindFirstUrlCacheGroup(DWORD,DWORD,LPVOID,DWORD,GROUPID*,LPVOID); BOOLAPI FindNextUrlCacheGroup(HANDLE,GROUPID*,LPVOID); BOOLAPI GetUrlCacheGroupAttributeA(GROUPID,DWORD,DWORD,LPINTERNET_CACHE_GROUP_INFOA,LPDWORD,LPVOID); BOOLAPI GetUrlCacheGroupAttributeW(GROUPID,DWORD,DWORD,LPINTERNET_CACHE_GROUP_INFOW,LPDWORD,LPVOID); #define GetUrlCacheGroupAttribute WINELIB_NAME_AW(GetUrlCacheGroupAttribute) #define INTERNET_CACHE_GROUP_ADD 0 #define INTERNET_CACHE_GROUP_REMOVE 1 BOOLAPI SetUrlCacheEntryGroupA(LPCSTR,DWORD,GROUPID,LPBYTE,DWORD,LPVOID); BOOLAPI SetUrlCacheEntryGroupW(LPCWSTR,DWORD,GROUPID,LPBYTE,DWORD,LPVOID); #define SetUrlCacheEntryGroup WINELIB_NAME_AW(SetUrlCacheEntryGroup) BOOLAPI SetUrlCacheGroupAttributeA(GROUPID,DWORD,DWORD,LPINTERNET_CACHE_GROUP_INFOA,LPVOID); BOOLAPI SetUrlCacheGroupAttributeW(GROUPID,DWORD,DWORD,LPINTERNET_CACHE_GROUP_INFOW,LPVOID); #define SetUrlCacheGroupAttribute WINELIB_NAME_AW(SetUrlCacheGroupAttribute) INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryExA( LPCSTR ,DWORD ,DWORD ,GROUPID ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID ); INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryExW( LPCWSTR ,DWORD ,DWORD ,GROUPID ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID ); #define FindFirstUrlCacheEntryEx WINELIB_NAME_AW(FindFirstUrlCacheEntryEx) BOOLAPI FindNextUrlCacheEntryExA(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID); BOOLAPI FindNextUrlCacheEntryExW(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD ,LPVOID ,LPDWORD ,LPVOID); #define FindNextUrlCacheEntryEx WINELIB_NAME_AW(FindNextUrlCacheEntryEx) INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD); INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD); #define FindFirstUrlCacheEntry WINELIB_NAME_AW(FindFirstUrlCacheEntry) BOOLAPI FindNextUrlCacheEntryA(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOA ,LPDWORD); BOOLAPI FindNextUrlCacheEntryW(HANDLE ,LPINTERNET_CACHE_ENTRY_INFOW ,LPDWORD); #define FindNextUrlCacheEntry WINELIB_NAME_AW(FindNextUrlCacheEntry) BOOLAPI FindCloseUrlCache(HANDLE); BOOLAPI DeleteUrlCacheEntryA(LPCSTR); BOOLAPI DeleteUrlCacheEntryW(LPCWSTR); #define DeleteUrlCacheEntry WINELIB_NAME_AW(DeleteUrlCacheEntry) /* FCS_ flags and FreeUrlCacheSpace are no longer documented */ #define FCS_PERCENT_CACHE_SPACE 0 /* guessed value */ #define FCS_PERCENT_DISK_SPACE 1 /* guessed value */ #define FCS_ABSOLUTE_SIZE 2 /* guessed value */ BOOLAPI FreeUrlCacheSpaceA(LPCSTR ,DWORD ,DWORD); BOOLAPI FreeUrlCacheSpaceW(LPCWSTR ,DWORD ,DWORD); #define FreeUrlCacheSpace WINELIB_NAME_AW(FreeUrlCacheSpace) INTERNETAPI DWORD WINAPI InternetDialA(HWND ,LPSTR ,DWORD ,DWORD_PTR* ,DWORD); INTERNETAPI DWORD WINAPI InternetDialW(HWND ,LPWSTR ,DWORD ,DWORD_PTR* ,DWORD); #define InternetDial WINELIB_NAME_AW(InternetDial) #define INTERNET_DIAL_UNATTENDED 0x8000 INTERNETAPI DWORD WINAPI InternetHangUp(DWORD_PTR ,DWORD); BOOLAPI CreateMD5SSOHash(PWSTR,PWSTR,PWSTR,PBYTE); #define INTERENT_GOONLINE_REFRESH 0x00000001 #define INTERENT_GOONLINE_MASK 0x00000001 INTERNETAPI BOOL WINAPI InternetGoOnlineA(LPSTR ,HWND ,DWORD); INTERNETAPI BOOL WINAPI InternetGoOnlineW(LPWSTR ,HWND ,DWORD); #define InternetGoOnline WINELIB_NAME_AW(InternetGoOnline) INTERNETAPI BOOL WINAPI InternetAutodial(DWORD,HWND); #define INTERNET_AUTODIAL_FORCE_ONLINE 1 #define INTERNET_AUTODIAL_FORCE_UNATTENDED 2 #define INTERNET_AUTODIAL_FAILIFSECURITYCHECK 4 #define INTERNET_AUTODIAL_FLAGS_MASK (INTERNET_AUTODIAL_FORCE_ONLINE | INTERNET_AUTODIAL_FORCE_UNATTENDED | INTERNET_AUTODIAL_FAILIFSECURITYCHECK) INTERNETAPI BOOL WINAPI InternetAutodialHangup(DWORD); INTERNETAPI BOOL WINAPI InternetGetConnectedState(LPDWORD ,DWORD); #define INTERNET_CONNECTION_MODEM 1 #define INTERNET_CONNECTION_LAN 2 #define INTERNET_CONNECTION_PROXY 4 #define INTERNET_CONNECTION_MODEM_BUSY 8 typedef DWORD (CALLBACK *PFN_DIAL_HANDLER) (HWND,LPCSTR,DWORD,LPDWORD); #define INTERNET_CUSTOMDIAL_CONNECT 0 #define INTERNET_CUSTOMDIAL_UNATTENDED 1 #define INTERNET_CUSTOMDIAL_DISCONNECT 2 #define INTERNET_CUSTOMDIAL_SHOWOFFLINE 4 #define INTERNET_CUSTOMDIAL_SAFE_FOR_UNATTENDED 1 #define INTERNET_CUSTOMDIAL_WILL_SUPPLY_STATE 2 #define INTERNET_CUSTOMDIAL_CAN_HANGUP 4 INTERNETAPI BOOL WINAPI InternetSetDialStateA(LPCSTR ,DWORD ,DWORD); INTERNETAPI BOOL WINAPI InternetSetDialStateW(LPCWSTR ,DWORD ,DWORD); #define InternetSetDialState WINELIB_NAME_AW(InternetSetDialState) #define INTERNET_DIALSTATE_DISCONNECTED 1 BOOL WINAPI InternetGetConnectedStateExA(LPDWORD, LPSTR, DWORD, DWORD); BOOL WINAPI InternetGetConnectedStateExW(LPDWORD, LPWSTR, DWORD, DWORD); #define InternetGetConnectedStateEx WINELIB_NAME_AW(InternetGetConnectedStateEx) BOOL WINAPI InternetInitializeAutoProxyDll(DWORD); BOOL WINAPI DetectAutoProxyUrl(LPSTR, DWORD, DWORD); #ifdef __cplusplus } #endif #endif
Java
/* Core Hardware driver for Hx4700 (ASIC3, EGPIOs) * * Copyright (c) 2005 SDG Systems, LLC * * 2005-03-29 Todd Blumer Converted basic structure to support hx4700 * 2005-04-30 Todd Blumer Add IRDA code from H2200 */ #include <linux/module.h> #include <linux/version.h> #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/delay.h> #include <linux/pm.h> #include <linux/dpm.h> #include <asm/irq.h> #include <asm/io.h> #include <asm/mach/irq.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/pxa-pm_ll.h> #include <asm/arch/hx4700-gpio.h> #include <asm/arch/hx4700-asic.h> #include <asm/arch/hx4700-core.h> #include <linux/mfd/asic3_base.h> #include <asm/hardware/ipaq-asic3.h> #define EGPIO_OFFSET 0 #define EGPIO_BASE (PXA_CS5_PHYS+EGPIO_OFFSET) volatile u_int16_t *egpios; u_int16_t egpio_reg; static int htc_bootloader = 0; /* Is the stock HTC bootloader installed? */ static u32 save[4]; static u32 save2[13]; /* * may make sense to put egpios elsewhere, but they're here now * since they share some of the same address space with the TI WLAN * * EGPIO register is write-only */ void hx4700_egpio_enable( u_int16_t bits ) { unsigned long flags; local_irq_save(flags); egpio_reg |= bits; *egpios = egpio_reg; local_irq_restore(flags); } EXPORT_SYMBOL(hx4700_egpio_enable); void hx4700_egpio_disable( u_int16_t bits ) { unsigned long flags; local_irq_save(flags); egpio_reg &= ~bits; *egpios = egpio_reg; local_irq_restore(flags); } EXPORT_SYMBOL(hx4700_egpio_disable); #ifdef CONFIG_PM static int hx4700_suspend(struct platform_device *pdev, pm_message_t state) { /* Turn off external clocks here, because hx4700_power and asic3_mmc * scared to do so to not hurt each other. (-5 mA) */ #if 0 asic3_set_clock_cdex(&hx4700_asic3.dev, CLOCK_CDEX_EX0 | CLOCK_CDEX_EX1, 0 | 0); #endif /* 0x20c2 is HTC clock value * CLOCK_CDEX_SOURCE 2 * CLOCK_CDEX_SPI 0 * CLOCK_CDEX_OWM 0 * * CLOCK_CDEX_PWM0 0 * CLOCK_CDEX_PWM1 0 * CLOCK_CDEX_LED0 1 * CLOCK_CDEX_LED1 1 * * CLOCK_CDEX_LED2 0 * CLOCK_CDEX_SD_HOST 0 * CLOCK_CDEX_SD_BUS 0 * CLOCK_CDEX_SMBUS 0 * * CLOCK_CDEX_CONTROL_CX 0 * CLOCK_CDEX_EX0 1 * CLOCK_CDEX_EX1 0 * */ asic3_set_clock_cdex(&hx4700_asic3.dev, 0xffff, 0x21c2); *egpios = 0; /* turn off all egpio power */ /* * Note that WEP1 wake up event is used by bootldr to set the * LEDS when power is applied/removed for charging. */ PWER = PWER_RTC | PWER_GPIO0 | PWER_GPIO1 | PWER_GPIO12 | PWER_WEP1; // rtc + power + reset + asic3 + wep1 PFER = PWER_GPIO1; // Falling Edge Detect PRER = PWER_GPIO0 | PWER_GPIO12; // Rising Edge Detect PGSR0 = 0x080DC01C; PGSR1 = 0x34CF0002; PGSR2 = 0x0123C18C; /* PGSR3 = 0x00104202; */ PGSR3 = 0x00100202; /* These next checks are specifically for charging. We want to enable * it if it is already enabled */ /* Check for charge enable, GPIO 72 */ if(GPLR2 & (1 << 8)) { /* Set it */ PGSR2 |= (1U << 8); } else { /* Clear it */ PGSR2 &= ~(1U << 8); } /* Check for USB_CHARGE_RATE, GPIO 96 */ if(GPLR3 & (1 << 0)) { /* Set it */ PGSR3 |= (1U << 0); } else { /* Clear it */ PGSR3 &= ~(1U << 0); } PCFR = PCFR_GPROD|PCFR_DC_EN|PCFR_GPR_EN|PCFR_OPDE |PCFR_FP|PCFR_PI2CEN; /* was 0x1091; */ /* The 2<<2 below turns on the Power Island state preservation * and counters. This allows us to wake up bootldr after a * period of time, and it can set the LEDs correctly based on * the power state. The bootldr turns it off when it's * charged. */ PSLR=0xc8000000 | (2 << 2); /* * If we're using bootldr and not the stock HTC bootloader, * we want to wake up periodically to see if the charge is full while * it is suspended. We do this with the OS timer 4 in the pxa270. */ if (!htc_bootloader) { OMCR4 = 0x4b; /* Periodic, self-resetting, 1-second timer */ OSMR4 = 5; /* Wake up bootldr after x seconds so it can figure out what to do with the LEDs. */ OIER |= 0x10; /* Enable interrupt source for Timer 4 */ OSCR4 = 0; /* This starts the timer */ } asic3_set_extcf_select(&hx4700_asic3.dev, ASIC3_EXTCF_OWM_EN, 0); return 0; } static int hx4700_resume(struct platform_device *pdev) { hx4700_egpio_enable(0); return 0; } #else # define hx4700_suspend NULL # define hx4700_resume NULL #endif static void hx4700_pxa_ll_pm_suspend(unsigned long resume_addr) { int i; u32 csum, tmp, *p; /* Save the 13 words at 0xa0038000. */ for (p = phys_to_virt(0xa0038000), i = 0; i < 13; i++) save2[i] = p[i]; /* Save the first four words at 0xa0000000. */ for (p = phys_to_virt(0xa0000000), i = 0; i < 4; i++) save[i] = p[i]; /* Set the first four words at 0xa0000000 to: * resume address; MMU control; TLB base addr; domain id */ p[0] = resume_addr; asm( "mrc\tp15, 0, %0, c1, c0, 0" : "=r" (tmp) ); p[1] = tmp & ~(0x3987); /* mmu off */ asm( "mrc\tp15, 0, %0, c2, c0, 0" : "=r" (tmp) ); p[2] = tmp; /* Shouldn't matter, since MMU will be off. */ asm( "mrc\tp15, 0, %0, c3, c0, 0" : "=r" (tmp) ); p[3] = tmp; /* Shouldn't matter, since MMU will be off. */ /* Set PSPR to the checksum the HTC bootloader wants to see. */ for (csum = 0, i = 0; i < 52; i++) { tmp = p[i] & 0x1; tmp = tmp << 31; tmp |= tmp >> 1; csum += tmp; } PSPR = csum; } static void hx4700_pxa_ll_pm_resume(void) { int i; u32 *p; /* Restore the first four words at 0xa0000000. */ for (p = phys_to_virt(0xa0000000), i = 0; i < 4; i++) p[i] = save[i]; /* Restore the 13 words at 0xa0038000. */ for (p = phys_to_virt(0xa0038000), i = 0; i < 13; i++) p[i] = save2[i]; /* XXX Do we need to flush the cache? */ } struct pxa_ll_pm_ops hx4700_ll_pm_ops = { .suspend = hx4700_pxa_ll_pm_suspend, .resume = hx4700_pxa_ll_pm_resume, }; /* automatic backlight brightness control */ static ssize_t auto_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", GET_HX4700_GPIO(AUTO_SENSE) ? 1 : 0); } static ssize_t auto_brightness_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int auto_brightness = simple_strtoul(buf, NULL, 10) ? 1 : 0; SET_HX4700_GPIO(AUTO_SENSE, auto_brightness); return count; } static DEVICE_ATTR(auto_brightness, 0644, auto_brightness_show, auto_brightness_store); static int hx4700_core_probe( struct platform_device *pdev ) { u32 *bootldr; int i; int ret = 0; printk( KERN_NOTICE "hx4700 Core Hardware Driver\n" ); egpios = (volatile u_int16_t *)ioremap_nocache( EGPIO_BASE, sizeof *egpios ); if (!egpios) return -ENODEV; /* Is the stock HTC bootloader installed? */ bootldr = (u32 *) ioremap(PXA_CS0_PHYS, 1024 * 1024); /* Windows Mobile 2003 Second Edition v. 4.21.1088 Build 15045.2.6.0 * ROM date 4/13/05, rev 1.10.08 ENG, bootloader 1.01, * XIP v4.21.15045.0 */ i = 0x000414dc / 4; if (bootldr[i] == 0xe59f1360 && /* ldr r1, [pc, #864] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2003 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } /* XXX Which version of WM2005 is this? */ i = 0x00041d68 / 4; if (bootldr[i] == 0xe59f1354 && /* ldr r1, [pc, #852] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2005 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } /* WM 5.0 OS 5.1.70 Build 14406.1.1.1 */ i = 0x00041340 / 4; if (bootldr[i] == 0xe59f1354 && /* ldr r1, [pc, #852] ; power base */ bootldr[i+1] == 0xe5914008 && /* ldr r4, [r1, #8] ; PSPR */ bootldr[i+2] == 0xe1320004) { /* teq r2, r4 */ printk("Stock HTC WM2005 bootloader detected\n"); htc_bootloader = 1; pxa_pm_set_ll_ops(&hx4700_ll_pm_ops); } iounmap(bootldr); ret = device_create_file(&pdev->dev, &dev_attr_auto_brightness); if (ret) iounmap(egpios); return ret; } static int hx4700_core_remove( struct platform_device *pdev ) { struct hx4700_core_funcs *funcs = pdev->dev.platform_data; device_remove_file(&pdev->dev, &dev_attr_auto_brightness); if (egpios != NULL) iounmap( (void *)egpios ); funcs->udc_detect = NULL; return 0; } static struct platform_driver hx4700_core_driver = { .driver = { .name = "hx4700-core", }, .probe = hx4700_core_probe, .remove = hx4700_core_remove, .suspend = hx4700_suspend, .resume = hx4700_resume, }; static int __init hx4700_core_init( void ) { return platform_driver_register( &hx4700_core_driver ); } static void __exit hx4700_core_exit( void ) { platform_driver_unregister( &hx4700_core_driver ); } module_init( hx4700_core_init ); module_exit( hx4700_core_exit ); MODULE_AUTHOR("Todd Blumer, SDG Systems, LLC"); MODULE_DESCRIPTION("hx4700 Core Hardware Driver"); MODULE_LICENSE("GPL"); /* vim600: set noexpandtab sw=8 ts=8 :*/
Java
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.13"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>CoreGTKGen: CGTKRevealer Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">CoreGTKGen &#160;<span id="projectnumber">3.22.0</span> </div> <div id="projectbrief">CoreGTKGen is a utility that generates Objective-C language bindings for CoreGTK using GObject Introspection</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.13 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); </script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Instance Methods</a> &#124; <a href="interfaceCGTKRevealer-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">CGTKRevealer Class Reference</div> </div> </div><!--header--> <div class="contents"> <div class="dynheader"> Inheritance diagram for CGTKRevealer:</div> <div class="dyncontent"> <div class="center"> <img src="interfaceCGTKRevealer.png" usemap="#CGTKRevealer_map" alt=""/> <map id="CGTKRevealer_map" name="CGTKRevealer_map"> <area href="interfaceCGTKBin.html" alt="CGTKBin" shape="rect" coords="55,224,155,248"/> <area href="interfaceCGTKContainer.html" alt="CGTKContainer" shape="rect" coords="55,168,155,192"/> <area href="interfaceCGTKWidget.html" alt="CGTKWidget" shape="rect" coords="55,112,155,136"/> <area href="interfaceCGTKBase.html" alt="CGTKBase" shape="rect" coords="55,56,155,80"/> </map> </div></div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Instance Methods</h2></td></tr> <tr class="memitem:a53d34850b0873611933656a93238a872"><td class="memItemLeft" align="right" valign="top">(id)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#a53d34850b0873611933656a93238a872">init</a></td></tr> <tr class="separator:a53d34850b0873611933656a93238a872"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a493772f0d7580e575fb6c4d40fbefd98"><td class="memItemLeft" align="right" valign="top">(GtkRevealer *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#a493772f0d7580e575fb6c4d40fbefd98">REVEALER</a></td></tr> <tr class="separator:a493772f0d7580e575fb6c4d40fbefd98"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac2faf6efc0b4e086eff9e31759ce73b7"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#ac2faf6efc0b4e086eff9e31759ce73b7">getChildRevealed</a></td></tr> <tr class="separator:ac2faf6efc0b4e086eff9e31759ce73b7"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae8727fa7f9007c48228da543cb52386c"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#ae8727fa7f9007c48228da543cb52386c">getRevealChild</a></td></tr> <tr class="separator:ae8727fa7f9007c48228da543cb52386c"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aae97d87143cb987f0f01d7161fc274a8"><td class="memItemLeft" align="right" valign="top">(guint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#aae97d87143cb987f0f01d7161fc274a8">getTransitionDuration</a></td></tr> <tr class="separator:aae97d87143cb987f0f01d7161fc274a8"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a505c7081e5524dcab1fcbf023566c83a"><td class="memItemLeft" align="right" valign="top">(GtkRevealerTransitionType)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#a505c7081e5524dcab1fcbf023566c83a">getTransitionType</a></td></tr> <tr class="separator:a505c7081e5524dcab1fcbf023566c83a"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a025227948311c65d5e514304295e6008"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#a025227948311c65d5e514304295e6008">setRevealChild:</a></td></tr> <tr class="separator:a025227948311c65d5e514304295e6008"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab493ca7b7c28cc610a5be0a91bab74aa"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#ab493ca7b7c28cc610a5be0a91bab74aa">setTransitionDuration:</a></td></tr> <tr class="separator:ab493ca7b7c28cc610a5be0a91bab74aa"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aea4f2ff04ef2a003304abf3a39b740c4"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKRevealer.html#aea4f2ff04ef2a003304abf3a39b740c4">setTransitionType:</a></td></tr> <tr class="separator:aea4f2ff04ef2a003304abf3a39b740c4"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header pub_methods_interfaceCGTKBin"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_interfaceCGTKBin')"><img src="closed.png" alt="-"/>&#160;Instance Methods inherited from <a class="el" href="interfaceCGTKBin.html">CGTKBin</a></td></tr> <tr class="memitem:a139c8efb261a93c81aff2d0a6bb9da8b inherit pub_methods_interfaceCGTKBin"><td class="memItemLeft" align="right" valign="top">(GtkBin *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBin.html#a139c8efb261a93c81aff2d0a6bb9da8b">BIN</a></td></tr> <tr class="separator:a139c8efb261a93c81aff2d0a6bb9da8b inherit pub_methods_interfaceCGTKBin"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae93993d5d24e9f74db4e37928582cae6 inherit pub_methods_interfaceCGTKBin"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBin.html#ae93993d5d24e9f74db4e37928582cae6">getChild</a></td></tr> <tr class="separator:ae93993d5d24e9f74db4e37928582cae6 inherit pub_methods_interfaceCGTKBin"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header pub_methods_interfaceCGTKContainer"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_interfaceCGTKContainer')"><img src="closed.png" alt="-"/>&#160;Instance Methods inherited from <a class="el" href="interfaceCGTKContainer.html">CGTKContainer</a></td></tr> <tr class="memitem:a98e333e97df13e34afbc8b908ed6e775 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(GtkContainer *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a98e333e97df13e34afbc8b908ed6e775">CONTAINER</a></td></tr> <tr class="separator:a98e333e97df13e34afbc8b908ed6e775 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a29dcd7dc80c80a401a4e5e6fb9b8cd53 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top"><a id="a29dcd7dc80c80a401a4e5e6fb9b8cd53"></a> (void)&#160;</td><td class="memItemRight" valign="bottom">- <b>addWidget:withProperties:</b></td></tr> <tr class="separator:a29dcd7dc80c80a401a4e5e6fb9b8cd53 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae5772097dbf633d6f732ffd596a49b80 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#ae5772097dbf633d6f732ffd596a49b80">add:</a></td></tr> <tr class="separator:ae5772097dbf633d6f732ffd596a49b80 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7a5896cf03751c4bb21d32716d30e721 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a7a5896cf03751c4bb21d32716d30e721">checkResize</a></td></tr> <tr class="separator:a7a5896cf03751c4bb21d32716d30e721 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa1d50711ed5a4bb450fd5f787c159cda inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#aa1d50711ed5a4bb450fd5f787c159cda">childGetPropertyWithChild:andPropertyName:andValue:</a></td></tr> <tr class="separator:aa1d50711ed5a4bb450fd5f787c159cda inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a600fae87d9fde4f8c12874ee4d732b88 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a600fae87d9fde4f8c12874ee4d732b88">childGetValistWithChild:andFirstPropertyName:andVarArgs:</a></td></tr> <tr class="separator:a600fae87d9fde4f8c12874ee4d732b88 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a259aab1cd0628e5d93525652fd9937a6 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a259aab1cd0628e5d93525652fd9937a6">childNotifyWithChild:andChildProperty:</a></td></tr> <tr class="separator:a259aab1cd0628e5d93525652fd9937a6 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:acc046a53ae9b9ef345e2f3641333d5e0 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#acc046a53ae9b9ef345e2f3641333d5e0">childNotifyByPspecWithChild:andPspec:</a></td></tr> <tr class="separator:acc046a53ae9b9ef345e2f3641333d5e0 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8506bb339e164d2591b2a1898931638c inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a8506bb339e164d2591b2a1898931638c">childSetPropertyWithChild:andPropertyName:andValue:</a></td></tr> <tr class="separator:a8506bb339e164d2591b2a1898931638c inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af078de1afd1d0e37520c2fe713480149 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#af078de1afd1d0e37520c2fe713480149">childSetValistWithChild:andFirstPropertyName:andVarArgs:</a></td></tr> <tr class="separator:af078de1afd1d0e37520c2fe713480149 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1f88579a752aadb34893fa10ca2e5964 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(GType)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a1f88579a752aadb34893fa10ca2e5964">childType</a></td></tr> <tr class="separator:a1f88579a752aadb34893fa10ca2e5964 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac161ea26099366ab1d490f901e3a4d4e inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#ac161ea26099366ab1d490f901e3a4d4e">forallWithCallback:andCallbackData:</a></td></tr> <tr class="separator:ac161ea26099366ab1d490f901e3a4d4e inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2d6991785cf42b2c2db4f8b3120b8208 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a2d6991785cf42b2c2db4f8b3120b8208">foreachWithCallback:andCallbackData:</a></td></tr> <tr class="separator:a2d6991785cf42b2c2db4f8b3120b8208 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aaca6da18a53faa4969ee686acb167f9a inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(guint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#aaca6da18a53faa4969ee686acb167f9a">getBorderWidth</a></td></tr> <tr class="separator:aaca6da18a53faa4969ee686acb167f9a inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae0fcd6a6284b53d62338cdb3b96ba441 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(GList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#ae0fcd6a6284b53d62338cdb3b96ba441">getChildren</a></td></tr> <tr class="separator:ae0fcd6a6284b53d62338cdb3b96ba441 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a75882742352f84775e73de737d50bdb1 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a75882742352f84775e73de737d50bdb1">getFocusChain:</a></td></tr> <tr class="separator:a75882742352f84775e73de737d50bdb1 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a15a01ee3b65868c4be3a63ddec589e6b inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a15a01ee3b65868c4be3a63ddec589e6b">getFocusChild</a></td></tr> <tr class="separator:a15a01ee3b65868c4be3a63ddec589e6b inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa5095439c14fdecd8fd4c203393d73ec inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(GtkAdjustment *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#aa5095439c14fdecd8fd4c203393d73ec">getFocusHadjustment</a></td></tr> <tr class="separator:aa5095439c14fdecd8fd4c203393d73ec inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3c23d2260713442526e7a07b7a49868b inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(GtkAdjustment *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a3c23d2260713442526e7a07b7a49868b">getFocusVadjustment</a></td></tr> <tr class="separator:a3c23d2260713442526e7a07b7a49868b inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad917cf5d20756601d1302e8a83f2a92b inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(GtkWidgetPath *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#ad917cf5d20756601d1302e8a83f2a92b">getPathForChild:</a></td></tr> <tr class="separator:ad917cf5d20756601d1302e8a83f2a92b inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a13a5cc4f8e0342162c383c163a36daab inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(GtkResizeMode)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a13a5cc4f8e0342162c383c163a36daab">getResizeMode</a></td></tr> <tr class="separator:a13a5cc4f8e0342162c383c163a36daab inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a9f0130ba08482ce712c5d4b62dde92d4 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a9f0130ba08482ce712c5d4b62dde92d4">propagateDrawWithChild:andCr:</a></td></tr> <tr class="separator:a9f0130ba08482ce712c5d4b62dde92d4 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a538934d688fa4e3f5231b1a1e0886286 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a538934d688fa4e3f5231b1a1e0886286">remove:</a></td></tr> <tr class="separator:a538934d688fa4e3f5231b1a1e0886286 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a9a15a9b064392ebc86e9db253065b27f inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a9a15a9b064392ebc86e9db253065b27f">resizeChildren</a></td></tr> <tr class="separator:a9a15a9b064392ebc86e9db253065b27f inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af0a135c2d6db989603d35320d077f704 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#af0a135c2d6db989603d35320d077f704">setBorderWidth:</a></td></tr> <tr class="separator:af0a135c2d6db989603d35320d077f704 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a181efda342f41d2dc9b08e443fabf886 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a181efda342f41d2dc9b08e443fabf886">setFocusChain:</a></td></tr> <tr class="separator:a181efda342f41d2dc9b08e443fabf886 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2d9ad233faf0179668cb3225c22120fc inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a2d9ad233faf0179668cb3225c22120fc">setFocusChild:</a></td></tr> <tr class="separator:a2d9ad233faf0179668cb3225c22120fc inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa60aa530e405eb768f86733741448e34 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#aa60aa530e405eb768f86733741448e34">setFocusHadjustment:</a></td></tr> <tr class="separator:aa60aa530e405eb768f86733741448e34 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab553d0a635fcd9ab733ff9370213ca9d inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#ab553d0a635fcd9ab733ff9370213ca9d">setFocusVadjustment:</a></td></tr> <tr class="separator:ab553d0a635fcd9ab733ff9370213ca9d inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac1bdcd3e23d2b5d528133ede78b8483a inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#ac1bdcd3e23d2b5d528133ede78b8483a">setReallocateRedraws:</a></td></tr> <tr class="separator:ac1bdcd3e23d2b5d528133ede78b8483a inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6b2a1de63f347b7d7d5c8cd3008d15d5 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#a6b2a1de63f347b7d7d5c8cd3008d15d5">setResizeMode:</a></td></tr> <tr class="separator:a6b2a1de63f347b7d7d5c8cd3008d15d5 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:acd66f3ec6b282e887e80179096ba1d67 inherit pub_methods_interfaceCGTKContainer"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKContainer.html#acd66f3ec6b282e887e80179096ba1d67">unsetFocusChain</a></td></tr> <tr class="separator:acd66f3ec6b282e887e80179096ba1d67 inherit pub_methods_interfaceCGTKContainer"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header pub_methods_interfaceCGTKWidget"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_interfaceCGTKWidget')"><img src="closed.png" alt="-"/>&#160;Instance Methods inherited from <a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a></td></tr> <tr class="memitem:a899a518b9a942b9e1ef8f101067a1797 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkWidget *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a899a518b9a942b9e1ef8f101067a1797">WIDGET</a></td></tr> <tr class="separator:a899a518b9a942b9e1ef8f101067a1797 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4fd98a02fc5038a70b7b231588855753 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4fd98a02fc5038a70b7b231588855753">activate</a></td></tr> <tr class="separator:a4fd98a02fc5038a70b7b231588855753 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2c55e8488ef0a80f9b3ebcccb7a127bb inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a2c55e8488ef0a80f9b3ebcccb7a127bb">addAcceleratorWithAccelSignal:andAccelGroup:andAccelKey:andAccelMods:andAccelFlags:</a></td></tr> <tr class="separator:a2c55e8488ef0a80f9b3ebcccb7a127bb inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a598b3c4a826b0f5ffd272d9c9dbf1449 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a598b3c4a826b0f5ffd272d9c9dbf1449">addDeviceEventsWithDevice:andEvents:</a></td></tr> <tr class="separator:a598b3c4a826b0f5ffd272d9c9dbf1449 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6e4136aa2c462751566aaefc338c203d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6e4136aa2c462751566aaefc338c203d">addEvents:</a></td></tr> <tr class="separator:a6e4136aa2c462751566aaefc338c203d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8a98957f7086a47326b6f87165d1076c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a8a98957f7086a47326b6f87165d1076c">addMnemonicLabel:</a></td></tr> <tr class="separator:a8a98957f7086a47326b6f87165d1076c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abd73849da3a9a5f0218a604d6f1692cc inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(guint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#abd73849da3a9a5f0218a604d6f1692cc">addTickCallbackWithCallback:andUserData:andNotify:</a></td></tr> <tr class="separator:abd73849da3a9a5f0218a604d6f1692cc inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a14de6dd293c096ff29e30d59b873fb85 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a14de6dd293c096ff29e30d59b873fb85">canActivateAccel:</a></td></tr> <tr class="separator:a14de6dd293c096ff29e30d59b873fb85 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1bf2f9f41c60a287308a7f4058bbfcf5 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1bf2f9f41c60a287308a7f4058bbfcf5">childFocus:</a></td></tr> <tr class="separator:a1bf2f9f41c60a287308a7f4058bbfcf5 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a22c17c2ae602da5fb17587bd947fb77f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a22c17c2ae602da5fb17587bd947fb77f">childNotify:</a></td></tr> <tr class="separator:a22c17c2ae602da5fb17587bd947fb77f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7e04ba2a57897a511429a6e76011d381 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7e04ba2a57897a511429a6e76011d381">classPathWithPathLength:andPath:andPathReversed:</a></td></tr> <tr class="separator:a7e04ba2a57897a511429a6e76011d381 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ace88057ed514e62acb6c2e9ef89a1820 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ace88057ed514e62acb6c2e9ef89a1820">computeExpand:</a></td></tr> <tr class="separator:ace88057ed514e62acb6c2e9ef89a1820 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aed7a0ddf38e1144905974a78b2853e64 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(PangoContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aed7a0ddf38e1144905974a78b2853e64">createPangoContext</a></td></tr> <tr class="separator:aed7a0ddf38e1144905974a78b2853e64 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a65aab48d716c479f90ecb990b9d34218 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(PangoLayout *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a65aab48d716c479f90ecb990b9d34218">createPangoLayout:</a></td></tr> <tr class="separator:a65aab48d716c479f90ecb990b9d34218 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a49abc58113965b5df9d5ac9262ea7a66 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a49abc58113965b5df9d5ac9262ea7a66">destroy</a></td></tr> <tr class="separator:a49abc58113965b5df9d5ac9262ea7a66 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a44ea770795efa1fbfdfd1b70c7d50898 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a44ea770795efa1fbfdfd1b70c7d50898">destroyed:</a></td></tr> <tr class="separator:a44ea770795efa1fbfdfd1b70c7d50898 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae3096b5e9f8bfee5ef4638ea1ece57e6 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae3096b5e9f8bfee5ef4638ea1ece57e6">deviceIsShadowed:</a></td></tr> <tr class="separator:ae3096b5e9f8bfee5ef4638ea1ece57e6 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:acff583914ec9e84a9e47fa629be693c9 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkDragContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#acff583914ec9e84a9e47fa629be693c9">gtkDragBeginWithTargets:andActions:andButton:andEvent:</a></td></tr> <tr class="separator:acff583914ec9e84a9e47fa629be693c9 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a28659f0dda6d0800d6f62efce5c7650c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkDragContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a28659f0dda6d0800d6f62efce5c7650c">gtkDragBeginWithCoordinatesWithTargets:andActions:andButton:andEvent:andX:andY:</a></td></tr> <tr class="separator:a28659f0dda6d0800d6f62efce5c7650c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af1e61de2c3b0dfb54c1496b0c3f6d54d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af1e61de2c3b0dfb54c1496b0c3f6d54d">gtkDragCheckThresholdWithStartX:andStartY:andCurrentX:andCurrentY:</a></td></tr> <tr class="separator:af1e61de2c3b0dfb54c1496b0c3f6d54d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a99a555320ff8917b74662a3eec265d68 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a99a555320ff8917b74662a3eec265d68">gtkDragDestAddImageTargets</a></td></tr> <tr class="separator:a99a555320ff8917b74662a3eec265d68 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4251606c07625e0aa42df01371483aac inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4251606c07625e0aa42df01371483aac">gtkDragDestAddTextTargets</a></td></tr> <tr class="separator:a4251606c07625e0aa42df01371483aac inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a48d4a65675d22144d5af82785d125571 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a48d4a65675d22144d5af82785d125571">gtkDragDestAddUriTargets</a></td></tr> <tr class="separator:a48d4a65675d22144d5af82785d125571 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6e48f41eb6368df75fdd94c1c83f39a7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkAtom)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6e48f41eb6368df75fdd94c1c83f39a7">gtkDragDestFindTargetWithContext:andTargetList:</a></td></tr> <tr class="separator:a6e48f41eb6368df75fdd94c1c83f39a7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a664f7bd6a18963c96b3e36c959f788b6 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkTargetList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a664f7bd6a18963c96b3e36c959f788b6">gtkDragDestGetTargetList</a></td></tr> <tr class="separator:a664f7bd6a18963c96b3e36c959f788b6 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab336da4298ffe5279e097ea7e567ff1d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab336da4298ffe5279e097ea7e567ff1d">gtkDragDestGetTrackMotion</a></td></tr> <tr class="separator:ab336da4298ffe5279e097ea7e567ff1d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a5611b3d9fc3fbc57d152b20f579b2831 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a5611b3d9fc3fbc57d152b20f579b2831">gtkDragDestSetWithFlags:andTargets:andNtargets:andActions:</a></td></tr> <tr class="separator:a5611b3d9fc3fbc57d152b20f579b2831 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a56fe349f2649a880654b079568f57f04 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a56fe349f2649a880654b079568f57f04">gtkDragDestSetProxyWithProxyWindow:andProtocol:andUseCoordinates:</a></td></tr> <tr class="separator:a56fe349f2649a880654b079568f57f04 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa4a516012bd12167e72ff09f50976dfe inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa4a516012bd12167e72ff09f50976dfe">gtkDragDestSetTargetList:</a></td></tr> <tr class="separator:aa4a516012bd12167e72ff09f50976dfe inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aadb9048643d8538c19b6a5372682d3a6 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aadb9048643d8538c19b6a5372682d3a6">gtkDragDestSetTrackMotion:</a></td></tr> <tr class="separator:aadb9048643d8538c19b6a5372682d3a6 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1fd99e7021e007b2b5981f472f408d95 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1fd99e7021e007b2b5981f472f408d95">gtkDragDestUnset</a></td></tr> <tr class="separator:a1fd99e7021e007b2b5981f472f408d95 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a83031eff8e872125b6d25172282269a0 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a83031eff8e872125b6d25172282269a0">gtkDragGetDataWithContext:andTarget:andTime:</a></td></tr> <tr class="separator:a83031eff8e872125b6d25172282269a0 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4a408aebae1bd4d32d4d298773e0c722 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4a408aebae1bd4d32d4d298773e0c722">gtkDragHighlight</a></td></tr> <tr class="separator:a4a408aebae1bd4d32d4d298773e0c722 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6b62c2ba2c9fc0698e9a81372cd65f18 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6b62c2ba2c9fc0698e9a81372cd65f18">gtkDragSourceAddImageTargets</a></td></tr> <tr class="separator:a6b62c2ba2c9fc0698e9a81372cd65f18 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa84fa411fbfa01698e0d46076c521d41 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa84fa411fbfa01698e0d46076c521d41">gtkDragSourceAddTextTargets</a></td></tr> <tr class="separator:aa84fa411fbfa01698e0d46076c521d41 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad39ec50ff4b5c6d4bf8118d1fc6538c5 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ad39ec50ff4b5c6d4bf8118d1fc6538c5">gtkDragSourceAddUriTargets</a></td></tr> <tr class="separator:ad39ec50ff4b5c6d4bf8118d1fc6538c5 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:acbb0a8df7ffcef0e5d6f4730c0f4d7e7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkTargetList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#acbb0a8df7ffcef0e5d6f4730c0f4d7e7">gtkDragSourceGetTargetList</a></td></tr> <tr class="separator:acbb0a8df7ffcef0e5d6f4730c0f4d7e7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aafd48e8eb58ace1682a353bdb9ce9e2a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aafd48e8eb58ace1682a353bdb9ce9e2a">gtkDragSourceSetWithStartButtonMask:andTargets:andNtargets:andActions:</a></td></tr> <tr class="separator:aafd48e8eb58ace1682a353bdb9ce9e2a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a68f6b1274423e4b24d50a1a012a489b1 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a68f6b1274423e4b24d50a1a012a489b1">gtkDragSourceSetIconGicon:</a></td></tr> <tr class="separator:a68f6b1274423e4b24d50a1a012a489b1 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8aedf329170784cf45f38a0648923f53 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a8aedf329170784cf45f38a0648923f53">gtkDragSourceSetIconName:</a></td></tr> <tr class="separator:a8aedf329170784cf45f38a0648923f53 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6cef284bfc1e736c4bfb55a0b1a83b29 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6cef284bfc1e736c4bfb55a0b1a83b29">gtkDragSourceSetIconPixbuf:</a></td></tr> <tr class="separator:a6cef284bfc1e736c4bfb55a0b1a83b29 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aaaff676ee3e74fb966523b089b9bc960 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aaaff676ee3e74fb966523b089b9bc960">gtkDragSourceSetIconStock:</a></td></tr> <tr class="separator:aaaff676ee3e74fb966523b089b9bc960 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a52e5751ec81f60558718659f033774c0 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a52e5751ec81f60558718659f033774c0">gtkDragSourceSetTargetList:</a></td></tr> <tr class="separator:a52e5751ec81f60558718659f033774c0 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab338bbfa4c11d07a6aed977b35ad4301 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab338bbfa4c11d07a6aed977b35ad4301">gtkDragSourceUnset</a></td></tr> <tr class="separator:ab338bbfa4c11d07a6aed977b35ad4301 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2c670c0971ceffa3f5d6d3a504a610d2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a2c670c0971ceffa3f5d6d3a504a610d2">gtkDragUnhighlight</a></td></tr> <tr class="separator:a2c670c0971ceffa3f5d6d3a504a610d2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1d810e3e873ba9c627c5a4cd7f494dd0 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1d810e3e873ba9c627c5a4cd7f494dd0">draw:</a></td></tr> <tr class="separator:a1d810e3e873ba9c627c5a4cd7f494dd0 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8b2ec87d85e38b93f9967b2bc6c97654 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a8b2ec87d85e38b93f9967b2bc6c97654">ensureStyle</a></td></tr> <tr class="separator:a8b2ec87d85e38b93f9967b2bc6c97654 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:acc695bd0aa1492eaa06e7578e9856a47 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#acc695bd0aa1492eaa06e7578e9856a47">errorBell</a></td></tr> <tr class="separator:acc695bd0aa1492eaa06e7578e9856a47 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a82a32d0f60474b95112dfdbbd5524d76 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a82a32d0f60474b95112dfdbbd5524d76">event:</a></td></tr> <tr class="separator:a82a32d0f60474b95112dfdbbd5524d76 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7d5123c49edd866aa41658e58d81f082 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7d5123c49edd866aa41658e58d81f082">freezeChildNotify</a></td></tr> <tr class="separator:a7d5123c49edd866aa41658e58d81f082 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a52354f6322f9663100bb96372fe34afa inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(AtkObject *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a52354f6322f9663100bb96372fe34afa">getAccessible</a></td></tr> <tr class="separator:a52354f6322f9663100bb96372fe34afa inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af26ce0fb7c8fd2a890319b6ab1df0062 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GActionGroup *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af26ce0fb7c8fd2a890319b6ab1df0062">getActionGroup:</a></td></tr> <tr class="separator:af26ce0fb7c8fd2a890319b6ab1df0062 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aae4f7a57d8de1aae648836acd06b2937 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(int)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aae4f7a57d8de1aae648836acd06b2937">getAllocatedBaseline</a></td></tr> <tr class="separator:aae4f7a57d8de1aae648836acd06b2937 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af0e7cf2d2801f021ca0dce21c5b2a510 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(int)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af0e7cf2d2801f021ca0dce21c5b2a510">getAllocatedHeight</a></td></tr> <tr class="separator:af0e7cf2d2801f021ca0dce21c5b2a510 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a159d298840809f92c028869ced9ce7e6 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a159d298840809f92c028869ced9ce7e6">getAllocatedSizeWithAllocation:andBaseline:</a></td></tr> <tr class="separator:a159d298840809f92c028869ced9ce7e6 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa298e567e1b87e03f87ee636c4beef23 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(int)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa298e567e1b87e03f87ee636c4beef23">getAllocatedWidth</a></td></tr> <tr class="separator:aa298e567e1b87e03f87ee636c4beef23 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abfadef17f7d5ba42125ea8704b91fb98 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#abfadef17f7d5ba42125ea8704b91fb98">getAllocation:</a></td></tr> <tr class="separator:abfadef17f7d5ba42125ea8704b91fb98 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aff8b651aa05ec8637a0417b0ce3683b3 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aff8b651aa05ec8637a0417b0ce3683b3">getAncestor:</a></td></tr> <tr class="separator:aff8b651aa05ec8637a0417b0ce3683b3 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1b09f7fde5bf8295d44aea416fd803dc inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1b09f7fde5bf8295d44aea416fd803dc">getAppPaintable</a></td></tr> <tr class="separator:a1b09f7fde5bf8295d44aea416fd803dc inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a9f7567616a279ece11f53627410995fc inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a9f7567616a279ece11f53627410995fc">getCanDefault</a></td></tr> <tr class="separator:a9f7567616a279ece11f53627410995fc inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abc938d6b05410e4d21afe5891c8fa95c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#abc938d6b05410e4d21afe5891c8fa95c">getCanFocus</a></td></tr> <tr class="separator:abc938d6b05410e4d21afe5891c8fa95c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab830e3b398e1500263f2fea81b5e33d9 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab830e3b398e1500263f2fea81b5e33d9">getChildRequisition:</a></td></tr> <tr class="separator:ab830e3b398e1500263f2fea81b5e33d9 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a96eb60aa6f7f00ebae204a7fe8c503f2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a96eb60aa6f7f00ebae204a7fe8c503f2">getChildVisible</a></td></tr> <tr class="separator:a96eb60aa6f7f00ebae204a7fe8c503f2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1d8eb45a4b3ecbb353077619d543c792 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1d8eb45a4b3ecbb353077619d543c792">getClip:</a></td></tr> <tr class="separator:a1d8eb45a4b3ecbb353077619d543c792 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1db13d54b2773fe6e1394b04e3733237 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkClipboard *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1db13d54b2773fe6e1394b04e3733237">getClipboard:</a></td></tr> <tr class="separator:a1db13d54b2773fe6e1394b04e3733237 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae3d91521899552010b600fa6bb6d52bb inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(NSString *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae3d91521899552010b600fa6bb6d52bb">getCompositeName</a></td></tr> <tr class="separator:ae3d91521899552010b600fa6bb6d52bb inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a45cc868226236d52182b6f35660f2301 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a45cc868226236d52182b6f35660f2301">getDeviceEnabled:</a></td></tr> <tr class="separator:a45cc868226236d52182b6f35660f2301 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab962098179bacaab44b76ec586f316a4 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkEventMask)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab962098179bacaab44b76ec586f316a4">getDeviceEvents:</a></td></tr> <tr class="separator:ab962098179bacaab44b76ec586f316a4 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3e7856b1725cedc96564fe5b6a89b65b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkTextDirection)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3e7856b1725cedc96564fe5b6a89b65b">getDirection</a></td></tr> <tr class="separator:a3e7856b1725cedc96564fe5b6a89b65b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a116891db25462cf45df26295c6c751e5 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkDisplay *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a116891db25462cf45df26295c6c751e5">getDisplay</a></td></tr> <tr class="separator:a116891db25462cf45df26295c6c751e5 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aae52c231a3686dd25c5d2b414229dbc3 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aae52c231a3686dd25c5d2b414229dbc3">getDoubleBuffered</a></td></tr> <tr class="separator:aae52c231a3686dd25c5d2b414229dbc3 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6886aeff62230c00ba766b30b7aadbd2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6886aeff62230c00ba766b30b7aadbd2">getEvents</a></td></tr> <tr class="separator:a6886aeff62230c00ba766b30b7aadbd2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a473946e844002a5759d11c6ae57efd04 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a473946e844002a5759d11c6ae57efd04">getFocusOnClick</a></td></tr> <tr class="separator:a473946e844002a5759d11c6ae57efd04 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4f3399c75640fb07599e8ac08e5cad67 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(PangoFontMap *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4f3399c75640fb07599e8ac08e5cad67">getFontMap</a></td></tr> <tr class="separator:a4f3399c75640fb07599e8ac08e5cad67 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a05d07791de6a3d04881fe6b4dc84c157 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(const cairo_font_options_t *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a05d07791de6a3d04881fe6b4dc84c157">getFontOptions</a></td></tr> <tr class="separator:a05d07791de6a3d04881fe6b4dc84c157 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4873b3bec01da1f55a00c60514d051a9 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkFrameClock *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4873b3bec01da1f55a00c60514d051a9">getFrameClock</a></td></tr> <tr class="separator:a4873b3bec01da1f55a00c60514d051a9 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad0483caf2c147e429f1ebdc321fb314a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkAlign)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ad0483caf2c147e429f1ebdc321fb314a">getHalign</a></td></tr> <tr class="separator:ad0483caf2c147e429f1ebdc321fb314a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a488b757ea2bc1d49e55845ac1d732c73 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a488b757ea2bc1d49e55845ac1d732c73">getHasTooltip</a></td></tr> <tr class="separator:a488b757ea2bc1d49e55845ac1d732c73 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a0164b500267217201fcb2df4d3650053 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a0164b500267217201fcb2df4d3650053">getHasWindow</a></td></tr> <tr class="separator:a0164b500267217201fcb2df4d3650053 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab63adc91866c8cf2a949c5692d2ce043 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab63adc91866c8cf2a949c5692d2ce043">getHexpand</a></td></tr> <tr class="separator:ab63adc91866c8cf2a949c5692d2ce043 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa4b3342a0c09e4bfd73ae9582b5e31d4 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa4b3342a0c09e4bfd73ae9582b5e31d4">getHexpandSet</a></td></tr> <tr class="separator:aa4b3342a0c09e4bfd73ae9582b5e31d4 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad7425bfc70235c5b52b246ae28c8540b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ad7425bfc70235c5b52b246ae28c8540b">getMapped</a></td></tr> <tr class="separator:ad7425bfc70235c5b52b246ae28c8540b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2876c83a33b041ee22f9dc6a32efd523 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a2876c83a33b041ee22f9dc6a32efd523">getMarginBottom</a></td></tr> <tr class="separator:a2876c83a33b041ee22f9dc6a32efd523 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7504dc7f4f580aea7ce94f38f49e97ec inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7504dc7f4f580aea7ce94f38f49e97ec">getMarginEnd</a></td></tr> <tr class="separator:a7504dc7f4f580aea7ce94f38f49e97ec inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae256e596256df7f072a365a5914a630b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae256e596256df7f072a365a5914a630b">getMarginLeft</a></td></tr> <tr class="separator:ae256e596256df7f072a365a5914a630b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a64152aee63ca9236c44fa7e576e1aed9 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a64152aee63ca9236c44fa7e576e1aed9">getMarginRight</a></td></tr> <tr class="separator:a64152aee63ca9236c44fa7e576e1aed9 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac5fbb05224639d4017c80e0b6ce079b5 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac5fbb05224639d4017c80e0b6ce079b5">getMarginStart</a></td></tr> <tr class="separator:ac5fbb05224639d4017c80e0b6ce079b5 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a5f90aefff6f4825c428a3a1f69ec511d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a5f90aefff6f4825c428a3a1f69ec511d">getMarginTop</a></td></tr> <tr class="separator:a5f90aefff6f4825c428a3a1f69ec511d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa6f3e5de5e21168894a92802aa4c841d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkModifierType)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa6f3e5de5e21168894a92802aa4c841d">getModifierMask:</a></td></tr> <tr class="separator:aa6f3e5de5e21168894a92802aa4c841d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a622a12a9f180259131cf7ad4a5ee1a54 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkRcStyle *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a622a12a9f180259131cf7ad4a5ee1a54">getModifierStyle</a></td></tr> <tr class="separator:a622a12a9f180259131cf7ad4a5ee1a54 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2f4e7f6e2b1e09c4101906972ddaea90 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(NSString *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a2f4e7f6e2b1e09c4101906972ddaea90">getName</a></td></tr> <tr class="separator:a2f4e7f6e2b1e09c4101906972ddaea90 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad2a8b67da114cb4683ebcb1ad3a3eb5a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ad2a8b67da114cb4683ebcb1ad3a3eb5a">getNoShowAll</a></td></tr> <tr class="separator:ad2a8b67da114cb4683ebcb1ad3a3eb5a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae329f13d4777f94d6458fe68694c919e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(double)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae329f13d4777f94d6458fe68694c919e">getOpacity</a></td></tr> <tr class="separator:ae329f13d4777f94d6458fe68694c919e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:adcc8e9dda992afef92ff780166b4a0e0 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(PangoContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#adcc8e9dda992afef92ff780166b4a0e0">getPangoContext</a></td></tr> <tr class="separator:adcc8e9dda992afef92ff780166b4a0e0 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae0c40b0136e5beff824537a9ddd9e00d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae0c40b0136e5beff824537a9ddd9e00d">getParent</a></td></tr> <tr class="separator:ae0c40b0136e5beff824537a9ddd9e00d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a06042b17f8a6e421688d6227fd4d212a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkWindow *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a06042b17f8a6e421688d6227fd4d212a">getParentWindow</a></td></tr> <tr class="separator:a06042b17f8a6e421688d6227fd4d212a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a0e337f5193da0cc8512f546fc4f1af60 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkWidgetPath *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a0e337f5193da0cc8512f546fc4f1af60">getPath</a></td></tr> <tr class="separator:a0e337f5193da0cc8512f546fc4f1af60 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a78aa2a4af9cf27e5adecf64e50f5184d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a78aa2a4af9cf27e5adecf64e50f5184d">getPointerWithX:andY:</a></td></tr> <tr class="separator:a78aa2a4af9cf27e5adecf64e50f5184d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1c1770da319872afa46a776c0af66018 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1c1770da319872afa46a776c0af66018">getPreferredHeightWithMinimumHeight:andNaturalHeight:</a></td></tr> <tr class="separator:a1c1770da319872afa46a776c0af66018 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab9d4ed8eb854e17ea6eed352dbf011a8 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab9d4ed8eb854e17ea6eed352dbf011a8">getPreferredHeightAndBaselineForWidthWithWidth:andMinimumHeight:andNaturalHeight:andMinimumBaseline:andNaturalBaseline:</a></td></tr> <tr class="separator:ab9d4ed8eb854e17ea6eed352dbf011a8 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a272cb4efdd5f09231e70a1bed9ceb8e8 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a272cb4efdd5f09231e70a1bed9ceb8e8">getPreferredHeightForWidthWithWidth:andMinimumHeight:andNaturalHeight:</a></td></tr> <tr class="separator:a272cb4efdd5f09231e70a1bed9ceb8e8 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a9be055ca4e996fc54ad65859a38d78f3 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a9be055ca4e996fc54ad65859a38d78f3">getPreferredSizeWithMinimumSize:andNaturalSize:</a></td></tr> <tr class="separator:a9be055ca4e996fc54ad65859a38d78f3 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7389bdb69ebac9ea01ced704eda50e2c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7389bdb69ebac9ea01ced704eda50e2c">getPreferredWidthWithMinimumWidth:andNaturalWidth:</a></td></tr> <tr class="separator:a7389bdb69ebac9ea01ced704eda50e2c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a89cf36ebbffca23180b1f70bb35da4ab inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a89cf36ebbffca23180b1f70bb35da4ab">getPreferredWidthForHeightWithHeight:andMinimumWidth:andNaturalWidth:</a></td></tr> <tr class="separator:a89cf36ebbffca23180b1f70bb35da4ab inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7a5237f1ca1b96a8e7776b99a0f2c061 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7a5237f1ca1b96a8e7776b99a0f2c061">getRealized</a></td></tr> <tr class="separator:a7a5237f1ca1b96a8e7776b99a0f2c061 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa75738b143ef4f0520b5f257fcd16069 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa75738b143ef4f0520b5f257fcd16069">getReceivesDefault</a></td></tr> <tr class="separator:aa75738b143ef4f0520b5f257fcd16069 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa234f86d75f1ed90e4a97e3dc0d380b5 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkSizeRequestMode)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa234f86d75f1ed90e4a97e3dc0d380b5">getRequestMode</a></td></tr> <tr class="separator:aa234f86d75f1ed90e4a97e3dc0d380b5 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a569c9d224cbd076dfaae5a2a28e9fca6 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a569c9d224cbd076dfaae5a2a28e9fca6">getRequisition:</a></td></tr> <tr class="separator:a569c9d224cbd076dfaae5a2a28e9fca6 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abd14878333cc13c68c6356a90b6709c7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkWindow *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#abd14878333cc13c68c6356a90b6709c7">getRootWindow</a></td></tr> <tr class="separator:abd14878333cc13c68c6356a90b6709c7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a713ff7767f7ca2627eaac4de9f998281 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a713ff7767f7ca2627eaac4de9f998281">getScaleFactor</a></td></tr> <tr class="separator:a713ff7767f7ca2627eaac4de9f998281 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa06a6ab82b79956f7fb6833207d65fd4 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkScreen *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa06a6ab82b79956f7fb6833207d65fd4">getScreen</a></td></tr> <tr class="separator:aa06a6ab82b79956f7fb6833207d65fd4 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:adb1e1d5f08229eb5dd2ce2d1af60880f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#adb1e1d5f08229eb5dd2ce2d1af60880f">getSensitive</a></td></tr> <tr class="separator:adb1e1d5f08229eb5dd2ce2d1af60880f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a30f96536013cb1a940aa355ebe70846f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkSettings *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a30f96536013cb1a940aa355ebe70846f">getSettings</a></td></tr> <tr class="separator:a30f96536013cb1a940aa355ebe70846f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a33ceee8ef4190d2931a08c3b21ce167d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a33ceee8ef4190d2931a08c3b21ce167d">getSizeRequestWithWidth:andHeight:</a></td></tr> <tr class="separator:a33ceee8ef4190d2931a08c3b21ce167d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae6e1b530c246c205d69c59c32903a0ff inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkStateType)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae6e1b530c246c205d69c59c32903a0ff">getState</a></td></tr> <tr class="separator:ae6e1b530c246c205d69c59c32903a0ff inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a60ce210de5e514893aee5abbf8e6b642 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkStateFlags)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a60ce210de5e514893aee5abbf8e6b642">getStateFlags</a></td></tr> <tr class="separator:a60ce210de5e514893aee5abbf8e6b642 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aceba43a6b1874c29c7b54e7f1ef9c46a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkStyle *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aceba43a6b1874c29c7b54e7f1ef9c46a">getStyle</a></td></tr> <tr class="separator:aceba43a6b1874c29c7b54e7f1ef9c46a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8e508612d9471bd30fb57405880e96f5 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkStyleContext *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a8e508612d9471bd30fb57405880e96f5">getStyleContext</a></td></tr> <tr class="separator:a8e508612d9471bd30fb57405880e96f5 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a71db754c15fab2afa5924eebac6c265d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a71db754c15fab2afa5924eebac6c265d">getSupportMultidevice</a></td></tr> <tr class="separator:a71db754c15fab2afa5924eebac6c265d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac1febdea582d988b33e72dc9944b3a06 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GObject *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac1febdea582d988b33e72dc9944b3a06">getTemplateChildWithWidgetType:andName:</a></td></tr> <tr class="separator:ac1febdea582d988b33e72dc9944b3a06 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4c6136e5dee840b37fcd974ab9e1d182 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(NSString *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4c6136e5dee840b37fcd974ab9e1d182">getTooltipMarkup</a></td></tr> <tr class="separator:a4c6136e5dee840b37fcd974ab9e1d182 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af479c66684284371267aa469b8f4f143 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(NSString *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af479c66684284371267aa469b8f4f143">getTooltipText</a></td></tr> <tr class="separator:af479c66684284371267aa469b8f4f143 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6e1ad0fa95e6af179ee2bc1d9c5e0e35 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkWindow *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6e1ad0fa95e6af179ee2bc1d9c5e0e35">getTooltipWindow</a></td></tr> <tr class="separator:a6e1ad0fa95e6af179ee2bc1d9c5e0e35 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a03657df87902931a6eb974623ab234c5 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a> *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a03657df87902931a6eb974623ab234c5">getToplevel</a></td></tr> <tr class="separator:a03657df87902931a6eb974623ab234c5 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a832fcd94fcfab50c3e3f7986ae249c6b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkAlign)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a832fcd94fcfab50c3e3f7986ae249c6b">getValign</a></td></tr> <tr class="separator:a832fcd94fcfab50c3e3f7986ae249c6b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af8323417f59b832c91b7c5cc9dc4e37c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkAlign)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af8323417f59b832c91b7c5cc9dc4e37c">getValignWithBaseline</a></td></tr> <tr class="separator:af8323417f59b832c91b7c5cc9dc4e37c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3767a58021ac0af09c75f46d7dadfd7a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3767a58021ac0af09c75f46d7dadfd7a">getVexpand</a></td></tr> <tr class="separator:a3767a58021ac0af09c75f46d7dadfd7a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a799204ff773b0b41660b7d1d86d2bd2e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a799204ff773b0b41660b7d1d86d2bd2e">getVexpandSet</a></td></tr> <tr class="separator:a799204ff773b0b41660b7d1d86d2bd2e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a19f43e4c58ba1757381a7087a08930be inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a19f43e4c58ba1757381a7087a08930be">getVisible</a></td></tr> <tr class="separator:a19f43e4c58ba1757381a7087a08930be inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac60148bed892b20f8dc4c049ec6f4c4f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkVisual *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac60148bed892b20f8dc4c049ec6f4c4f">getVisual</a></td></tr> <tr class="separator:ac60148bed892b20f8dc4c049ec6f4c4f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a161cce50b4a4ff2bf356d3f6da29c44d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkWindow *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a161cce50b4a4ff2bf356d3f6da29c44d">getWindow</a></td></tr> <tr class="separator:a161cce50b4a4ff2bf356d3f6da29c44d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af1fc22fb43c4efcb0f3000827470771f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af1fc22fb43c4efcb0f3000827470771f">gtkGrabAdd</a></td></tr> <tr class="separator:af1fc22fb43c4efcb0f3000827470771f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a58c4c989df3bfc0f0986967acc113ba3 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a58c4c989df3bfc0f0986967acc113ba3">grabDefault</a></td></tr> <tr class="separator:a58c4c989df3bfc0f0986967acc113ba3 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a20524b669db15669e890c5a00b523e70 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a20524b669db15669e890c5a00b523e70">grabFocus</a></td></tr> <tr class="separator:a20524b669db15669e890c5a00b523e70 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a510b5607cf4e5ba97028a236a5f709e5 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a510b5607cf4e5ba97028a236a5f709e5">gtkGrabRemove</a></td></tr> <tr class="separator:a510b5607cf4e5ba97028a236a5f709e5 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aee2c646e2d1ca917baecc5e99b9d8802 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aee2c646e2d1ca917baecc5e99b9d8802">hasDefault</a></td></tr> <tr class="separator:aee2c646e2d1ca917baecc5e99b9d8802 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad37d527b774ae4a9f9d2fc14172e17f9 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ad37d527b774ae4a9f9d2fc14172e17f9">hasFocus</a></td></tr> <tr class="separator:ad37d527b774ae4a9f9d2fc14172e17f9 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a172a54d258cd3049559adb92253a0575 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a172a54d258cd3049559adb92253a0575">hasGrab</a></td></tr> <tr class="separator:a172a54d258cd3049559adb92253a0575 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af4ce642168176463da445320793e3297 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af4ce642168176463da445320793e3297">hasRcStyle</a></td></tr> <tr class="separator:af4ce642168176463da445320793e3297 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab4022b5a7b59630684c9d4a8d488bd29 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab4022b5a7b59630684c9d4a8d488bd29">hasScreen</a></td></tr> <tr class="separator:ab4022b5a7b59630684c9d4a8d488bd29 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af5064931b4855095bc788c7f574d2520 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af5064931b4855095bc788c7f574d2520">hasVisibleFocus</a></td></tr> <tr class="separator:af5064931b4855095bc788c7f574d2520 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a18eb1d2ff44967a37b0ccdc07533b93a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a18eb1d2ff44967a37b0ccdc07533b93a">hide</a></td></tr> <tr class="separator:a18eb1d2ff44967a37b0ccdc07533b93a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a0c610842d7f05c4cf6f80ca731301075 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a0c610842d7f05c4cf6f80ca731301075">hideOnDelete</a></td></tr> <tr class="separator:a0c610842d7f05c4cf6f80ca731301075 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1e29829a0e7c81c99163c3edf0024410 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1e29829a0e7c81c99163c3edf0024410">inDestruction</a></td></tr> <tr class="separator:a1e29829a0e7c81c99163c3edf0024410 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2d6d01ddaca5c83f1e0574823d17f206 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a2d6d01ddaca5c83f1e0574823d17f206">initTemplate</a></td></tr> <tr class="separator:a2d6d01ddaca5c83f1e0574823d17f206 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7271ceb5acd8cbf8c4cb103a9f7f6368 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7271ceb5acd8cbf8c4cb103a9f7f6368">inputShapeCombineRegion:</a></td></tr> <tr class="separator:a7271ceb5acd8cbf8c4cb103a9f7f6368 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa689039fda371cb06c2e33183ddfd7cd inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa689039fda371cb06c2e33183ddfd7cd">insertActionGroupWithName:andGroup:</a></td></tr> <tr class="separator:aa689039fda371cb06c2e33183ddfd7cd inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aef54289b1456c75e70ae8ea08762be2c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aef54289b1456c75e70ae8ea08762be2c">intersectWithArea:andIntersection:</a></td></tr> <tr class="separator:aef54289b1456c75e70ae8ea08762be2c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1410c9f9bbfa16176048f5f5304aa072 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1410c9f9bbfa16176048f5f5304aa072">isAncestor:</a></td></tr> <tr class="separator:a1410c9f9bbfa16176048f5f5304aa072 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abe2b4d5aa03a9e16a1b0b901eb7d5ddf inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#abe2b4d5aa03a9e16a1b0b901eb7d5ddf">isComposited</a></td></tr> <tr class="separator:abe2b4d5aa03a9e16a1b0b901eb7d5ddf inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3423e25abd513b50942344320fe0ad01 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3423e25abd513b50942344320fe0ad01">isDrawable</a></td></tr> <tr class="separator:a3423e25abd513b50942344320fe0ad01 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a40bea8af8c41c27b8aa3daf04b4b0a93 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a40bea8af8c41c27b8aa3daf04b4b0a93">isFocus</a></td></tr> <tr class="separator:a40bea8af8c41c27b8aa3daf04b4b0a93 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a528b81ff78e755d5c3c7bf819bad4346 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a528b81ff78e755d5c3c7bf819bad4346">isSensitive</a></td></tr> <tr class="separator:a528b81ff78e755d5c3c7bf819bad4346 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac1c2c40164a097b5e02b9032847641e8 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac1c2c40164a097b5e02b9032847641e8">isToplevel</a></td></tr> <tr class="separator:ac1c2c40164a097b5e02b9032847641e8 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6c035b677e2b3104f8f31317cb54e63b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6c035b677e2b3104f8f31317cb54e63b">isVisible</a></td></tr> <tr class="separator:a6c035b677e2b3104f8f31317cb54e63b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aac193bede5729cdfbc37480a2a9f50b1 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aac193bede5729cdfbc37480a2a9f50b1">keynavFailed:</a></td></tr> <tr class="separator:aac193bede5729cdfbc37480a2a9f50b1 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a9979d4479c9d7e325ba62532c3852000 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a9979d4479c9d7e325ba62532c3852000">listAccelClosures</a></td></tr> <tr class="separator:a9979d4479c9d7e325ba62532c3852000 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6da60dcfb97fd5d26a7f17a2cfc6badc inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(const gchar **)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6da60dcfb97fd5d26a7f17a2cfc6badc">listActionPrefixes</a></td></tr> <tr class="separator:a6da60dcfb97fd5d26a7f17a2cfc6badc inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a47decdb6f7659b5a8bd43be00385844c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GList *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a47decdb6f7659b5a8bd43be00385844c">listMnemonicLabels</a></td></tr> <tr class="separator:a47decdb6f7659b5a8bd43be00385844c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad14f1a1d618e9077733922449ce63cf6 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ad14f1a1d618e9077733922449ce63cf6">map</a></td></tr> <tr class="separator:ad14f1a1d618e9077733922449ce63cf6 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aea6173a39482420a935f3c261149ca8c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aea6173a39482420a935f3c261149ca8c">mnemonicActivate:</a></td></tr> <tr class="separator:aea6173a39482420a935f3c261149ca8c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a5649fc7fe9bc19316b2c2b1986d42c28 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a5649fc7fe9bc19316b2c2b1986d42c28">modifyBaseWithState:andColor:</a></td></tr> <tr class="separator:a5649fc7fe9bc19316b2c2b1986d42c28 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a50e976a3c7831fbcc18a6fae5c5fda56 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a50e976a3c7831fbcc18a6fae5c5fda56">modifyBgWithState:andColor:</a></td></tr> <tr class="separator:a50e976a3c7831fbcc18a6fae5c5fda56 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4703525b25265590d79020e7252d0a1b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4703525b25265590d79020e7252d0a1b">modifyCursorWithPrimary:andSecondary:</a></td></tr> <tr class="separator:a4703525b25265590d79020e7252d0a1b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a74b01ac3098c6145a8bc7d34ea866509 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a74b01ac3098c6145a8bc7d34ea866509">modifyFgWithState:andColor:</a></td></tr> <tr class="separator:a74b01ac3098c6145a8bc7d34ea866509 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a9af39fb46882c1c5c2a1034b6cdac799 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a9af39fb46882c1c5c2a1034b6cdac799">modifyFont:</a></td></tr> <tr class="separator:a9af39fb46882c1c5c2a1034b6cdac799 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a71767829b33aecfb6dbbbb6c0002bab8 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a71767829b33aecfb6dbbbb6c0002bab8">modifyStyle:</a></td></tr> <tr class="separator:a71767829b33aecfb6dbbbb6c0002bab8 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3054e88109435d5376b7432878004b07 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3054e88109435d5376b7432878004b07">modifyTextWithState:andColor:</a></td></tr> <tr class="separator:a3054e88109435d5376b7432878004b07 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab9497e604fa20880240adf8e5f23249b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab9497e604fa20880240adf8e5f23249b">overrideBackgroundColorWithState:andColor:</a></td></tr> <tr class="separator:ab9497e604fa20880240adf8e5f23249b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a5e9689020633173c026fe7cd053507db inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a5e9689020633173c026fe7cd053507db">overrideColorWithState:andColor:</a></td></tr> <tr class="separator:a5e9689020633173c026fe7cd053507db inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7d83d6facc8960c52ef0f37f56b71456 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7d83d6facc8960c52ef0f37f56b71456">overrideCursorWithCursor:andSecondaryCursor:</a></td></tr> <tr class="separator:a7d83d6facc8960c52ef0f37f56b71456 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad23c9554f782ec5f06d6149b3825c23f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ad23c9554f782ec5f06d6149b3825c23f">overrideFont:</a></td></tr> <tr class="separator:ad23c9554f782ec5f06d6149b3825c23f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac248f93aa49c5e775d6d5df93ccba2af inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac248f93aa49c5e775d6d5df93ccba2af">overrideSymbolicColorWithName:andColor:</a></td></tr> <tr class="separator:ac248f93aa49c5e775d6d5df93ccba2af inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a12622c4b380c9007043da3177e81e8aa inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a12622c4b380c9007043da3177e81e8aa">pathWithPathLength:andPath:andPathReversed:</a></td></tr> <tr class="separator:a12622c4b380c9007043da3177e81e8aa inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae258b9f503fe8aa097eb6a4ac96b44f2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae258b9f503fe8aa097eb6a4ac96b44f2">queueAllocate</a></td></tr> <tr class="separator:ae258b9f503fe8aa097eb6a4ac96b44f2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4aae1336c0e2dcb08be4774d2ebe57f7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4aae1336c0e2dcb08be4774d2ebe57f7">queueComputeExpand</a></td></tr> <tr class="separator:a4aae1336c0e2dcb08be4774d2ebe57f7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a397a2f86ddd1cfd7778410de7eb7c9a6 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a397a2f86ddd1cfd7778410de7eb7c9a6">queueDraw</a></td></tr> <tr class="separator:a397a2f86ddd1cfd7778410de7eb7c9a6 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abd55800adfc42adadadb7ab6025f0e2f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#abd55800adfc42adadadb7ab6025f0e2f">queueDrawAreaWithX:andY:andWidth:andHeight:</a></td></tr> <tr class="separator:abd55800adfc42adadadb7ab6025f0e2f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac06bdcc0d01cd4fc6889b5f41aa698e4 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac06bdcc0d01cd4fc6889b5f41aa698e4">queueDrawRegion:</a></td></tr> <tr class="separator:ac06bdcc0d01cd4fc6889b5f41aa698e4 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a57ea2b06dfeacd0a658c32bdc91468c7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a57ea2b06dfeacd0a658c32bdc91468c7">queueResize</a></td></tr> <tr class="separator:a57ea2b06dfeacd0a658c32bdc91468c7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa45c06501e4ab39c63f71e62e6da7495 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa45c06501e4ab39c63f71e62e6da7495">queueResizeNoRedraw</a></td></tr> <tr class="separator:aa45c06501e4ab39c63f71e62e6da7495 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab73862f0fc23d7dd6c8e23dd29614bff inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab73862f0fc23d7dd6c8e23dd29614bff">realize</a></td></tr> <tr class="separator:ab73862f0fc23d7dd6c8e23dd29614bff inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa0e9189128f88ddcba28fa071348f02f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(cairo_region_t *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa0e9189128f88ddcba28fa071348f02f">regionIntersect:</a></td></tr> <tr class="separator:aa0e9189128f88ddcba28fa071348f02f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8cd7cf9072471ba4832f295b0227091c inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a8cd7cf9072471ba4832f295b0227091c">registerWindow:</a></td></tr> <tr class="separator:a8cd7cf9072471ba4832f295b0227091c inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3d13e915a1e393e2040449e385183e0f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3d13e915a1e393e2040449e385183e0f">removeAcceleratorWithAccelGroup:andAccelKey:andAccelMods:</a></td></tr> <tr class="separator:a3d13e915a1e393e2040449e385183e0f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a643b6c0d2ce828876e1e4e225193d260 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a643b6c0d2ce828876e1e4e225193d260">removeMnemonicLabel:</a></td></tr> <tr class="separator:a643b6c0d2ce828876e1e4e225193d260 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa8ca32a6ce14d6dba580300408aeb12f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa8ca32a6ce14d6dba580300408aeb12f">removeTickCallback:</a></td></tr> <tr class="separator:aa8ca32a6ce14d6dba580300408aeb12f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a82b1fdd309f049c9f43f35516951d1e7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkPixbuf *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a82b1fdd309f049c9f43f35516951d1e7">renderIconWithStockId:andSize:andDetail:</a></td></tr> <tr class="separator:a82b1fdd309f049c9f43f35516951d1e7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a0e84ded29a2b2a9f1a0ed629be9db5cb inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GdkPixbuf *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a0e84ded29a2b2a9f1a0ed629be9db5cb">renderIconPixbufWithStockId:andSize:</a></td></tr> <tr class="separator:a0e84ded29a2b2a9f1a0ed629be9db5cb inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8d4a9a0a25f245ae6f9ec4f605ba57f4 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a8d4a9a0a25f245ae6f9ec4f605ba57f4">reparent:</a></td></tr> <tr class="separator:a8d4a9a0a25f245ae6f9ec4f605ba57f4 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af464c26c504c62e173ebf96ca5897897 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af464c26c504c62e173ebf96ca5897897">resetRcStyles</a></td></tr> <tr class="separator:af464c26c504c62e173ebf96ca5897897 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7fe988f7b82f68af5093a9e7ae7aa624 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7fe988f7b82f68af5093a9e7ae7aa624">resetStyle</a></td></tr> <tr class="separator:a7fe988f7b82f68af5093a9e7ae7aa624 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a223360a3b7871a5e57e5ff5db93d59ec inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(gint)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a223360a3b7871a5e57e5ff5db93d59ec">sendExpose:</a></td></tr> <tr class="separator:a223360a3b7871a5e57e5ff5db93d59ec inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a621cf231992241ea4b6a712a1c72bc60 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a621cf231992241ea4b6a712a1c72bc60">sendFocusChange:</a></td></tr> <tr class="separator:a621cf231992241ea4b6a712a1c72bc60 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa6f616f327918b4a5ebeb8ce74dc7364 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aa6f616f327918b4a5ebeb8ce74dc7364">setAccelPathWithAccelPath:andAccelGroup:</a></td></tr> <tr class="separator:aa6f616f327918b4a5ebeb8ce74dc7364 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6e6bc9bce25661bd01d345b619c45f75 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6e6bc9bce25661bd01d345b619c45f75">setAllocation:</a></td></tr> <tr class="separator:a6e6bc9bce25661bd01d345b619c45f75 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:afe291d4a47b8153e09759db24d7390a0 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#afe291d4a47b8153e09759db24d7390a0">setAppPaintable:</a></td></tr> <tr class="separator:afe291d4a47b8153e09759db24d7390a0 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abfa0fa606bb6b4806b57e38ab5105c7e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#abfa0fa606bb6b4806b57e38ab5105c7e">setCanDefault:</a></td></tr> <tr class="separator:abfa0fa606bb6b4806b57e38ab5105c7e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:acdb5b0ff287adff2967debc6f3a5d909 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#acdb5b0ff287adff2967debc6f3a5d909">setCanFocus:</a></td></tr> <tr class="separator:acdb5b0ff287adff2967debc6f3a5d909 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6413144416976875ff2cddb457dcb47b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6413144416976875ff2cddb457dcb47b">setChildVisible:</a></td></tr> <tr class="separator:a6413144416976875ff2cddb457dcb47b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7be14cf860b4de3eaadb244692a78cb7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7be14cf860b4de3eaadb244692a78cb7">setClip:</a></td></tr> <tr class="separator:a7be14cf860b4de3eaadb244692a78cb7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a89a87db3d8f4f5d8845a11a47d4dbef4 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a89a87db3d8f4f5d8845a11a47d4dbef4">setCompositeName:</a></td></tr> <tr class="separator:a89a87db3d8f4f5d8845a11a47d4dbef4 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abea446f072aae2b7b5ec45f9d1918b38 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#abea446f072aae2b7b5ec45f9d1918b38">setDeviceEnabledWithDevice:andEnabled:</a></td></tr> <tr class="separator:abea446f072aae2b7b5ec45f9d1918b38 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae17b6069d7a6799347bddf614cb6300e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae17b6069d7a6799347bddf614cb6300e">setDeviceEventsWithDevice:andEvents:</a></td></tr> <tr class="separator:ae17b6069d7a6799347bddf614cb6300e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a46eb42bb649a1abd59b1e398e6e3c58d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a46eb42bb649a1abd59b1e398e6e3c58d">setDirection:</a></td></tr> <tr class="separator:a46eb42bb649a1abd59b1e398e6e3c58d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:adcfda1434b8a006065595260ecb2361a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#adcfda1434b8a006065595260ecb2361a">setDoubleBuffered:</a></td></tr> <tr class="separator:adcfda1434b8a006065595260ecb2361a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac9578fc2db474f42281e9d2039fb9214 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac9578fc2db474f42281e9d2039fb9214">setEvents:</a></td></tr> <tr class="separator:ac9578fc2db474f42281e9d2039fb9214 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a71625cf1471dcd8a095420c06921bb88 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a71625cf1471dcd8a095420c06921bb88">setFocusOnClick:</a></td></tr> <tr class="separator:a71625cf1471dcd8a095420c06921bb88 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8c00c395c4c35b5ab2961d294b79b5bd inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a8c00c395c4c35b5ab2961d294b79b5bd">setFontMap:</a></td></tr> <tr class="separator:a8c00c395c4c35b5ab2961d294b79b5bd inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab709e7da857cc413349e76c82a4eb644 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ab709e7da857cc413349e76c82a4eb644">setFontOptions:</a></td></tr> <tr class="separator:ab709e7da857cc413349e76c82a4eb644 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a909f65ffdce391704302d83763920f10 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a909f65ffdce391704302d83763920f10">setHalign:</a></td></tr> <tr class="separator:a909f65ffdce391704302d83763920f10 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1ae312130de54ba26f948e30e6cbe3a2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1ae312130de54ba26f948e30e6cbe3a2">setHasTooltip:</a></td></tr> <tr class="separator:a1ae312130de54ba26f948e30e6cbe3a2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2d5ad35eaf1aa483a1e45961a752c47d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a2d5ad35eaf1aa483a1e45961a752c47d">setHasWindow:</a></td></tr> <tr class="separator:a2d5ad35eaf1aa483a1e45961a752c47d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6ab2506e8e063882714af8e792676927 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6ab2506e8e063882714af8e792676927">setHexpand:</a></td></tr> <tr class="separator:a6ab2506e8e063882714af8e792676927 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aacb4fdf95b3b5b4fa8aafef1b9c01df0 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aacb4fdf95b3b5b4fa8aafef1b9c01df0">setHexpandSet:</a></td></tr> <tr class="separator:aacb4fdf95b3b5b4fa8aafef1b9c01df0 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a2e904b919493da61d474e6226e13884d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a2e904b919493da61d474e6226e13884d">setMapped:</a></td></tr> <tr class="separator:a2e904b919493da61d474e6226e13884d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3c4a59759408832a079189cda6c8689e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3c4a59759408832a079189cda6c8689e">setMarginBottom:</a></td></tr> <tr class="separator:a3c4a59759408832a079189cda6c8689e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a56e29b11df29273292a35ef0119d4d7d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a56e29b11df29273292a35ef0119d4d7d">setMarginEnd:</a></td></tr> <tr class="separator:a56e29b11df29273292a35ef0119d4d7d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:acdeb4e26f5cdd0f7af4e5aaa87dea0d2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#acdeb4e26f5cdd0f7af4e5aaa87dea0d2">setMarginLeft:</a></td></tr> <tr class="separator:acdeb4e26f5cdd0f7af4e5aaa87dea0d2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac335c54485edd4855e9945dca7dbbc6e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac335c54485edd4855e9945dca7dbbc6e">setMarginRight:</a></td></tr> <tr class="separator:ac335c54485edd4855e9945dca7dbbc6e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1415b3e839cf72a0512d4b4d1594878e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1415b3e839cf72a0512d4b4d1594878e">setMarginStart:</a></td></tr> <tr class="separator:a1415b3e839cf72a0512d4b4d1594878e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af3a59b808cedc70dcc84a33d96d142c4 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af3a59b808cedc70dcc84a33d96d142c4">setMarginTop:</a></td></tr> <tr class="separator:af3a59b808cedc70dcc84a33d96d142c4 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a44a6a0461dfaeb56e2b3ff0e5ec47088 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a44a6a0461dfaeb56e2b3ff0e5ec47088">setName:</a></td></tr> <tr class="separator:a44a6a0461dfaeb56e2b3ff0e5ec47088 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:adafb02c611faf14312893a91defaaa5e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#adafb02c611faf14312893a91defaaa5e">setNoShowAll:</a></td></tr> <tr class="separator:adafb02c611faf14312893a91defaaa5e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a151995f128f9bb6cc22812c25c074d49 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a151995f128f9bb6cc22812c25c074d49">setOpacity:</a></td></tr> <tr class="separator:a151995f128f9bb6cc22812c25c074d49 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af56ad043233d7343c7d3bf0d33c9ed49 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af56ad043233d7343c7d3bf0d33c9ed49">setParent:</a></td></tr> <tr class="separator:af56ad043233d7343c7d3bf0d33c9ed49 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac06f0b53ee3781718f509499fa6783fb inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac06f0b53ee3781718f509499fa6783fb">setParentWindow:</a></td></tr> <tr class="separator:ac06f0b53ee3781718f509499fa6783fb inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4a565bfecd9ee4606ccb1c949220cdb3 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a4a565bfecd9ee4606ccb1c949220cdb3">setRealized:</a></td></tr> <tr class="separator:a4a565bfecd9ee4606ccb1c949220cdb3 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a485c2ae222bf338d20b566f94beafeaa inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a485c2ae222bf338d20b566f94beafeaa">setReceivesDefault:</a></td></tr> <tr class="separator:a485c2ae222bf338d20b566f94beafeaa inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac6214115d0bb3524a139687db29183dc inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac6214115d0bb3524a139687db29183dc">setRedrawOnAllocate:</a></td></tr> <tr class="separator:ac6214115d0bb3524a139687db29183dc inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af779d72c265ad6b420088a4e677795f9 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#af779d72c265ad6b420088a4e677795f9">setSensitive:</a></td></tr> <tr class="separator:af779d72c265ad6b420088a4e677795f9 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:adb3a0759ea886cf3d993df16b638771a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#adb3a0759ea886cf3d993df16b638771a">setSizeRequestWithWidth:andHeight:</a></td></tr> <tr class="separator:adb3a0759ea886cf3d993df16b638771a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae1e6710e2f81bdd00df56af1843a04d2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ae1e6710e2f81bdd00df56af1843a04d2">setState:</a></td></tr> <tr class="separator:ae1e6710e2f81bdd00df56af1843a04d2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3b89087c99f47400392ca1c6d1736129 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3b89087c99f47400392ca1c6d1736129">setStateFlagsWithFlags:andClear:</a></td></tr> <tr class="separator:a3b89087c99f47400392ca1c6d1736129 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a308d2aeb940c9f6693111bdc4e9019a2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a308d2aeb940c9f6693111bdc4e9019a2">setStyle:</a></td></tr> <tr class="separator:a308d2aeb940c9f6693111bdc4e9019a2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1e810a26a2ca787b1199b00a11ce3b4d inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1e810a26a2ca787b1199b00a11ce3b4d">setSupportMultidevice:</a></td></tr> <tr class="separator:a1e810a26a2ca787b1199b00a11ce3b4d inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a11b94bc82753589ce7cc19b0ecd3c29e inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a11b94bc82753589ce7cc19b0ecd3c29e">setTooltipMarkup:</a></td></tr> <tr class="separator:a11b94bc82753589ce7cc19b0ecd3c29e inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:afafca4e6bd6d73ec51fb84b1426dc455 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#afafca4e6bd6d73ec51fb84b1426dc455">setTooltipText:</a></td></tr> <tr class="separator:afafca4e6bd6d73ec51fb84b1426dc455 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a326a2bb86862cc26924598f52665f87f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a326a2bb86862cc26924598f52665f87f">setTooltipWindow:</a></td></tr> <tr class="separator:a326a2bb86862cc26924598f52665f87f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a67893ebb6d07677f3d00608540a9d5df inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a67893ebb6d07677f3d00608540a9d5df">setValign:</a></td></tr> <tr class="separator:a67893ebb6d07677f3d00608540a9d5df inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a46f0ca07fb2cbe2004f37b0ee2edfe76 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a46f0ca07fb2cbe2004f37b0ee2edfe76">setVexpand:</a></td></tr> <tr class="separator:a46f0ca07fb2cbe2004f37b0ee2edfe76 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a54edff6d04876a172d6f3cbf324962bc inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a54edff6d04876a172d6f3cbf324962bc">setVexpandSet:</a></td></tr> <tr class="separator:a54edff6d04876a172d6f3cbf324962bc inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:afcc4c3c6070f49c2cf49ac6328774d97 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#afcc4c3c6070f49c2cf49ac6328774d97">setVisible:</a></td></tr> <tr class="separator:afcc4c3c6070f49c2cf49ac6328774d97 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a31a85055a1b7bdfe704b5dc21bba1234 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a31a85055a1b7bdfe704b5dc21bba1234">setVisual:</a></td></tr> <tr class="separator:a31a85055a1b7bdfe704b5dc21bba1234 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a501ab42e3088c78603aee0228371909f inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a501ab42e3088c78603aee0228371909f">setWindow:</a></td></tr> <tr class="separator:a501ab42e3088c78603aee0228371909f inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:afed4ead169c3614070d3a52955afe373 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#afed4ead169c3614070d3a52955afe373">shapeCombineRegion:</a></td></tr> <tr class="separator:afed4ead169c3614070d3a52955afe373 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7b5d401676c78dbccb41f4ad8d3383af inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a7b5d401676c78dbccb41f4ad8d3383af">show</a></td></tr> <tr class="separator:a7b5d401676c78dbccb41f4ad8d3383af inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1263a8ad40d5f71f74dd9e957628749a inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1263a8ad40d5f71f74dd9e957628749a">showAll</a></td></tr> <tr class="separator:a1263a8ad40d5f71f74dd9e957628749a inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a99a69302361c3191a11763332a657318 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a99a69302361c3191a11763332a657318">showNow</a></td></tr> <tr class="separator:a99a69302361c3191a11763332a657318 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3759d78a2a09fe63af25bf3b02028dba inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3759d78a2a09fe63af25bf3b02028dba">sizeAllocate:</a></td></tr> <tr class="separator:a3759d78a2a09fe63af25bf3b02028dba inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a63c9d00979e2ee28dc3ea33262ac3464 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a63c9d00979e2ee28dc3ea33262ac3464">sizeAllocateWithBaselineWithAllocation:andBaseline:</a></td></tr> <tr class="separator:a63c9d00979e2ee28dc3ea33262ac3464 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a12eb9f5051b0406e87ad256c1da99d28 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a12eb9f5051b0406e87ad256c1da99d28">sizeRequest:</a></td></tr> <tr class="separator:a12eb9f5051b0406e87ad256c1da99d28 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aef49bd32369b6ebba3a6113debe49059 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aef49bd32369b6ebba3a6113debe49059">styleAttach</a></td></tr> <tr class="separator:aef49bd32369b6ebba3a6113debe49059 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6f5e46d70736a8878e84d2ff7689b6b2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a6f5e46d70736a8878e84d2ff7689b6b2">styleGetPropertyWithPropertyName:andValue:</a></td></tr> <tr class="separator:a6f5e46d70736a8878e84d2ff7689b6b2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aaa45bebc29fb3ba57b53f94f83f2a342 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#aaa45bebc29fb3ba57b53f94f83f2a342">styleGetValistWithFirstPropertyName:andVarArgs:</a></td></tr> <tr class="separator:aaa45bebc29fb3ba57b53f94f83f2a342 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1ab0ebd7170c0edf4d32d521f19869f7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a1ab0ebd7170c0edf4d32d521f19869f7">thawChildNotify</a></td></tr> <tr class="separator:a1ab0ebd7170c0edf4d32d521f19869f7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3fa237e6e9a657ac27fff2fa94128fb2 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(BOOL)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a3fa237e6e9a657ac27fff2fa94128fb2">translateCoordinatesWithDestWidget:andSrcX:andSrcY:andDestX:andDestY:</a></td></tr> <tr class="separator:a3fa237e6e9a657ac27fff2fa94128fb2 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a0510c02173a437fdd49d94d562f412b3 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a0510c02173a437fdd49d94d562f412b3">triggerTooltipQuery</a></td></tr> <tr class="separator:a0510c02173a437fdd49d94d562f412b3 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a0273ae8822a1f19b27b78c04def9165b inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a0273ae8822a1f19b27b78c04def9165b">unmap</a></td></tr> <tr class="separator:a0273ae8822a1f19b27b78c04def9165b inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8b9b596cb260a701ddbe450521fbc571 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a8b9b596cb260a701ddbe450521fbc571">unparent</a></td></tr> <tr class="separator:a8b9b596cb260a701ddbe450521fbc571 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a35765c8138aed8d79a05d661e14cab47 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#a35765c8138aed8d79a05d661e14cab47">unrealize</a></td></tr> <tr class="separator:a35765c8138aed8d79a05d661e14cab47 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:afca614d00df68991eeadb12864232df7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#afca614d00df68991eeadb12864232df7">unregisterWindow:</a></td></tr> <tr class="separator:afca614d00df68991eeadb12864232df7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac2598a4f7e6c9ea33b1d04c9c64ac4c7 inherit pub_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKWidget.html#ac2598a4f7e6c9ea33b1d04c9c64ac4c7">unsetStateFlags:</a></td></tr> <tr class="separator:ac2598a4f7e6c9ea33b1d04c9c64ac4c7 inherit pub_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header pub_methods_interfaceCGTKBase"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_interfaceCGTKBase')"><img src="closed.png" alt="-"/>&#160;Instance Methods inherited from <a class="el" href="interfaceCGTKBase.html">CGTKBase</a></td></tr> <tr class="memitem:a94d3a3ecf62077e420e370ca4a72bbd6 inherit pub_methods_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">(id)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#a94d3a3ecf62077e420e370ca4a72bbd6">initWithGObject:</a></td></tr> <tr class="separator:a94d3a3ecf62077e420e370ca4a72bbd6 inherit pub_methods_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad080954f73c40813909f6a477d482b75 inherit pub_methods_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#ad080954f73c40813909f6a477d482b75">setGObject:</a></td></tr> <tr class="separator:ad080954f73c40813909f6a477d482b75 inherit pub_methods_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a07553be10a943fead663d4b3f5ed791d inherit pub_methods_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">(GObject *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#a07553be10a943fead663d4b3f5ed791d">GOBJECT</a></td></tr> <tr class="separator:a07553be10a943fead663d4b3f5ed791d inherit pub_methods_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a94d3a3ecf62077e420e370ca4a72bbd6 inherit pub_methods_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">(id)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#a94d3a3ecf62077e420e370ca4a72bbd6">initWithGObject:</a></td></tr> <tr class="separator:a94d3a3ecf62077e420e370ca4a72bbd6 inherit pub_methods_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad080954f73c40813909f6a477d482b75 inherit pub_methods_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">(void)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#ad080954f73c40813909f6a477d482b75">setGObject:</a></td></tr> <tr class="separator:ad080954f73c40813909f6a477d482b75 inherit pub_methods_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a07553be10a943fead663d4b3f5ed791d inherit pub_methods_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">(GObject *)&#160;</td><td class="memItemRight" valign="bottom">- <a class="el" href="interfaceCGTKBase.html#a07553be10a943fead663d4b3f5ed791d">GOBJECT</a></td></tr> <tr class="separator:a07553be10a943fead663d4b3f5ed791d inherit pub_methods_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a> Additional Inherited Members</h2></td></tr> <tr class="inherit_header pub_static_methods_interfaceCGTKWidget"><td colspan="2" onclick="javascript:toggleInherit('pub_static_methods_interfaceCGTKWidget')"><img src="closed.png" alt="-"/>&#160;Class Methods inherited from <a class="el" href="interfaceCGTKWidget.html">CGTKWidget</a></td></tr> <tr class="memitem:a0bd57b572cd41e78a0f78a45eb3aac0a inherit pub_static_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top">(GtkTextDirection)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interfaceCGTKWidget.html#a0bd57b572cd41e78a0f78a45eb3aac0a">getDefaultDirection</a></td></tr> <tr class="separator:a0bd57b572cd41e78a0f78a45eb3aac0a inherit pub_static_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a39125b678a41fc67b33efe9fd0bf84af inherit pub_static_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top"><a id="a39125b678a41fc67b33efe9fd0bf84af"></a> (GtkStyle *)&#160;</td><td class="memItemRight" valign="bottom">+ <b>getDefaultStyle</b></td></tr> <tr class="separator:a39125b678a41fc67b33efe9fd0bf84af inherit pub_static_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a89e1556f7e47fd5dce259cb30360b789 inherit pub_static_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top"><a id="a89e1556f7e47fd5dce259cb30360b789"></a> (void)&#160;</td><td class="memItemRight" valign="bottom">+ <b>popCompositeChild</b></td></tr> <tr class="separator:a89e1556f7e47fd5dce259cb30360b789 inherit pub_static_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a6ca397ec9ebb220659a04c0a4db9aab4 inherit pub_static_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top"><a id="a6ca397ec9ebb220659a04c0a4db9aab4"></a> (void)&#160;</td><td class="memItemRight" valign="bottom">+ <b>pushCompositeChild</b></td></tr> <tr class="separator:a6ca397ec9ebb220659a04c0a4db9aab4 inherit pub_static_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a880634844ada752e696c721afa52f055 inherit pub_static_methods_interfaceCGTKWidget"><td class="memItemLeft" align="right" valign="top"><a id="a880634844ada752e696c721afa52f055"></a> (void)&#160;</td><td class="memItemRight" valign="bottom">+ <b>setDefaultDirection:</b></td></tr> <tr class="separator:a880634844ada752e696c721afa52f055 inherit pub_static_methods_interfaceCGTKWidget"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header pub_static_methods_interfaceCGTKBase"><td colspan="2" onclick="javascript:toggleInherit('pub_static_methods_interfaceCGTKBase')"><img src="closed.png" alt="-"/>&#160;Class Methods inherited from <a class="el" href="interfaceCGTKBase.html">CGTKBase</a></td></tr> <tr class="memitem:a804322c9fb01b3873c9fd6d12f1f64a3 inherit pub_static_methods_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKBase.html">CGTKBase</a> *)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interfaceCGTKBase.html#a804322c9fb01b3873c9fd6d12f1f64a3">withGObject:</a></td></tr> <tr class="separator:a804322c9fb01b3873c9fd6d12f1f64a3 inherit pub_static_methods_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a804322c9fb01b3873c9fd6d12f1f64a3 inherit pub_static_methods_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">(<a class="el" href="interfaceCGTKBase.html">CGTKBase</a> *)&#160;</td><td class="memItemRight" valign="bottom">+ <a class="el" href="interfaceCGTKBase.html#a804322c9fb01b3873c9fd6d12f1f64a3">withGObject:</a></td></tr> <tr class="separator:a804322c9fb01b3873c9fd6d12f1f64a3 inherit pub_static_methods_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="inherit_header pro_attribs_interfaceCGTKBase"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_interfaceCGTKBase')"><img src="closed.png" alt="-"/>&#160;Protected Attributes inherited from <a class="el" href="interfaceCGTKBase.html">CGTKBase</a></td></tr> <tr class="memitem:a16378c0eef600564798376045483e689 inherit pro_attribs_interfaceCGTKBase"><td class="memItemLeft" align="right" valign="top">GObject *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interfaceCGTKBase.html#a16378c0eef600564798376045483e689">__gObject</a></td></tr> <tr class="separator:a16378c0eef600564798376045483e689 inherit pro_attribs_interfaceCGTKBase"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <h2 class="groupheader">Method Documentation</h2> <a id="ac2faf6efc0b4e086eff9e31759ce73b7"></a> <h2 class="memtitle"><span class="permalink"><a href="#ac2faf6efc0b4e086eff9e31759ce73b7">&#9670;&nbsp;</a></span>getChildRevealed()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (BOOL) getChildRevealed </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(BOOL*)getChildRevealed;</p> <dl class="section return"><dt>Returns</dt><dd>BOOL </dd></dl> </div> </div> <a id="ae8727fa7f9007c48228da543cb52386c"></a> <h2 class="memtitle"><span class="permalink"><a href="#ae8727fa7f9007c48228da543cb52386c">&#9670;&nbsp;</a></span>getRevealChild()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (BOOL) getRevealChild </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(BOOL*)getRevealChild;</p> <dl class="section return"><dt>Returns</dt><dd>BOOL </dd></dl> </div> </div> <a id="aae97d87143cb987f0f01d7161fc274a8"></a> <h2 class="memtitle"><span class="permalink"><a href="#aae97d87143cb987f0f01d7161fc274a8">&#9670;&nbsp;</a></span>getTransitionDuration()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (guint) getTransitionDuration </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(guint*)getTransitionDuration;</p> <dl class="section return"><dt>Returns</dt><dd>guint </dd></dl> </div> </div> <a id="a505c7081e5524dcab1fcbf023566c83a"></a> <h2 class="memtitle"><span class="permalink"><a href="#a505c7081e5524dcab1fcbf023566c83a">&#9670;&nbsp;</a></span>getTransitionType()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (GtkRevealerTransitionType) getTransitionType </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(GtkRevealerTransitionType*)getTransitionType;</p> <dl class="section return"><dt>Returns</dt><dd>GtkRevealerTransitionType </dd></dl> </div> </div> <a id="a53d34850b0873611933656a93238a872"></a> <h2 class="memtitle"><span class="permalink"><a href="#a53d34850b0873611933656a93238a872">&#9670;&nbsp;</a></span>init()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (id) init </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Constructors </p> </div> </div> <a id="a493772f0d7580e575fb6c4d40fbefd98"></a> <h2 class="memtitle"><span class="permalink"><a href="#a493772f0d7580e575fb6c4d40fbefd98">&#9670;&nbsp;</a></span>REVEALER()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (GtkRevealer*) REVEALER </td> <td></td> <td class="paramname"></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Methods </p> </div> </div> <a id="a025227948311c65d5e514304295e6008"></a> <h2 class="memtitle"><span class="permalink"><a href="#a025227948311c65d5e514304295e6008">&#9670;&nbsp;</a></span>setRevealChild:()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (void) setRevealChild: </td> <td></td> <td class="paramtype">(BOOL)&#160;</td> <td class="paramname"><em>revealChild</em></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(void*)<a class="el" href="interfaceCGTKRevealer.html#a025227948311c65d5e514304295e6008">setRevealChild:</a> revealChild;</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">revealChild</td><td></td></tr> </table> </dd> </dl> </div> </div> <a id="ab493ca7b7c28cc610a5be0a91bab74aa"></a> <h2 class="memtitle"><span class="permalink"><a href="#ab493ca7b7c28cc610a5be0a91bab74aa">&#9670;&nbsp;</a></span>setTransitionDuration:()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (void) setTransitionDuration: </td> <td></td> <td class="paramtype">(guint)&#160;</td> <td class="paramname"><em>duration</em></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(void*)<a class="el" href="interfaceCGTKRevealer.html#ab493ca7b7c28cc610a5be0a91bab74aa">setTransitionDuration:</a> duration;</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">duration</td><td></td></tr> </table> </dd> </dl> </div> </div> <a id="aea4f2ff04ef2a003304abf3a39b740c4"></a> <h2 class="memtitle"><span class="permalink"><a href="#aea4f2ff04ef2a003304abf3a39b740c4">&#9670;&nbsp;</a></span>setTransitionType:()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">- (void) setTransitionType: </td> <td></td> <td class="paramtype">(GtkRevealerTransitionType)&#160;</td> <td class="paramname"><em>transition</em></td> <td></td> </tr> </table> </div><div class="memdoc"> <p>-(void*)<a class="el" href="interfaceCGTKRevealer.html#aea4f2ff04ef2a003304abf3a39b740c4">setTransitionType:</a> transition;</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">transition</td><td></td></tr> </table> </dd> </dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="CGTKRevealer_8h_source.html">CGTKRevealer.h</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Sat Nov 4 2017 23:23:29 for CoreGTKGen by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.13 </small></address> </body> </html>
Java
/****************************************************************************** * * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * ******************************************************************************/ #ifndef __RTW_LED_H_ #define __RTW_LED_H_ #include <drv_conf.h> #include <osdep_service.h> #include <drv_types.h> #define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000) #define LED_BLINK_NORMAL_INTERVAL 100 #define LED_BLINK_SLOWLY_INTERVAL 200 #define LED_BLINK_LONG_INTERVAL 400 #define LED_BLINK_NO_LINK_INTERVAL_ALPHA 1000 #define LED_BLINK_LINK_INTERVAL_ALPHA 500 //500 #define LED_BLINK_SCAN_INTERVAL_ALPHA 180 //150 #define LED_BLINK_FASTER_INTERVAL_ALPHA 50 #define LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA 5000 #define LED_BLINK_NORMAL_INTERVAL_NETTRONIX 100 #define LED_BLINK_SLOWLY_INTERVAL_NETTRONIX 2000 #define LED_BLINK_SLOWLY_INTERVAL_PORNET 1000 #define LED_BLINK_NORMAL_INTERVAL_PORNET 100 #define LED_BLINK_FAST_INTERVAL_BITLAND 30 // 060403, rcnjko: Customized for AzWave. #define LED_CM2_BLINK_ON_INTERVAL 250 #define LED_CM2_BLINK_OFF_INTERVAL 4750 #define LED_CM8_BLINK_INTERVAL 500 //for QMI #define LED_CM8_BLINK_OFF_INTERVAL 3750 //for QMI // 080124, lanhsin: Customized for RunTop #define LED_RunTop_BLINK_INTERVAL 300 // 060421, rcnjko: Customized for Sercomm Printer Server case. #define LED_CM3_BLINK_INTERVAL 1500 typedef enum _LED_CTL_MODE{ LED_CTL_POWER_ON = 1, LED_CTL_LINK = 2, LED_CTL_NO_LINK = 3, LED_CTL_TX = 4, LED_CTL_RX = 5, LED_CTL_SITE_SURVEY = 6, LED_CTL_POWER_OFF = 7, LED_CTL_START_TO_LINK = 8, LED_CTL_START_WPS = 9, LED_CTL_STOP_WPS = 10, LED_CTL_START_WPS_BOTTON = 11, //added for runtop LED_CTL_STOP_WPS_FAIL = 12, //added for ALPHA LED_CTL_STOP_WPS_FAIL_OVERLAP = 13, //added for BELKIN LED_CTL_CONNECTION_NO_TRANSFER = 14, }LED_CTL_MODE; typedef enum _LED_STATE_871x{ LED_UNKNOWN = 0, RTW_LED_ON = 1, RTW_LED_OFF = 2, LED_BLINK_NORMAL = 3, LED_BLINK_SLOWLY = 4, LED_BLINK_POWER_ON = 5, LED_BLINK_SCAN = 6, // LED is blinking during scanning period, the # of times to blink is depend on time for scanning. LED_BLINK_NO_LINK = 7, // LED is blinking during no link state. LED_BLINK_StartToBlink = 8,// Customzied for Sercomm Printer Server case LED_BLINK_TXRX = 9, LED_BLINK_WPS = 10, // LED is blinkg during WPS communication LED_BLINK_WPS_STOP = 11, //for ALPHA LED_BLINK_WPS_STOP_OVERLAP = 12, //for BELKIN LED_BLINK_RUNTOP = 13, // Customized for RunTop LED_BLINK_CAMEO = 14, LED_BLINK_XAVI = 15, LED_BLINK_ALWAYS_ON = 16, }LED_STATE_871x; typedef enum _LED_PIN_871x{ LED_PIN_NULL = 0, LED_PIN_LED0 = 1, LED_PIN_LED1 = 2, LED_PIN_LED2 = 3, LED_PIN_GPIO0 = 4, }LED_PIN_871x; typedef struct _LED_871x{ struct rtw_adapter *padapter; LED_PIN_871x LedPin; // Identify how to implement this SW led. LED_STATE_871x CurrLedState; // Current LED state. LED_STATE_871x BlinkingLedState; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are. u8 bLedOn; // true if LED is ON, false if LED is OFF. u8 bLedBlinkInProgress; // true if it is blinking, false o.w.. u8 bLedWPSBlinkInProgress; u32 BlinkTimes; // Number of times to toggle led state for blinking. _timer BlinkTimer; // Timer object for led blinking. u8 bSWLedCtrl; // ALPHA, added by chiyoko, 20090106 u8 bLedNoLinkBlinkInProgress; u8 bLedLinkBlinkInProgress; u8 bLedStartToLinkBlinkInProgress; u8 bLedScanBlinkInProgress; struct work_struct BlinkWorkItem; // Workitem used by BlinkTimer to manipulate H/W to blink LED. } LED_871x, *PLED_871x; #define IS_LED_WPS_BLINKING(_LED_871x) (((PLED_871x)_LED_871x)->CurrLedState==LED_BLINK_WPS \ || ((PLED_871x)_LED_871x)->CurrLedState==LED_BLINK_WPS_STOP \ || ((PLED_871x)_LED_871x)->bLedWPSBlinkInProgress) #define IS_LED_BLINKING(_LED_871x) (((PLED_871x)_LED_871x)->bLedWPSBlinkInProgress \ ||((PLED_871x)_LED_871x)->bLedScanBlinkInProgress) //================================================================================ // LED customization. //================================================================================ typedef enum _LED_STRATEGY_871x{ SW_LED_MODE0 = 0, // SW control 1 LED via GPIO0. It is default option. SW_LED_MODE1= 1, // 2 LEDs, through LED0 and LED1. For ALPHA. SW_LED_MODE2 = 2, // SW control 1 LED via GPIO0, customized for AzWave 8187 minicard. SW_LED_MODE3 = 3, // SW control 1 LED via GPIO0, customized for Sercomm Printer Server case. SW_LED_MODE4 = 4, //for Edimax / Belkin SW_LED_MODE5 = 5, //for Sercomm / Belkin SW_LED_MODE6 = 6, //for 88CU minicard, porting from ce SW_LED_MODE7 HW_LED = 50, // HW control 2 LEDs, LED0 and LED1 (there are 4 different control modes, see MAC.CONFIG1 for details.) LED_ST_NONE = 99, }LED_STRATEGY_871x, *PLED_STRATEGY_871x; void LedControl871x( struct rtw_adapter *padapter, LED_CTL_MODE LedAction ); struct led_priv{ /* add for led controll */ LED_871x SwLed0; LED_871x SwLed1; LED_STRATEGY_871x LedStrategy; u8 bRegUseLed; void (*LedControlHandler)(struct rtw_adapter *padapter, LED_CTL_MODE LedAction); /* add for led controll */ }; #ifdef CONFIG_SW_LED #define rtw_led_control(adapter, LedAction) \ do { \ if((adapter)->ledpriv.LedControlHandler) \ (adapter)->ledpriv.LedControlHandler((adapter), (LedAction)); \ } while(0) #else //CONFIG_SW_LED #define rtw_led_control(adapter, LedAction) #endif //CONFIG_SW_LED void BlinkTimerCallback(void *data); void BlinkWorkItemCallback(struct work_struct *work); void ResetLedStatus(PLED_871x pLed); void InitLed871x( struct rtw_adapter *padapter, PLED_871x pLed, LED_PIN_871x LedPin ); void DeInitLed871x( PLED_871x pLed ); //hal... extern void BlinkHandler(PLED_871x pLed); #endif //__RTW_LED_H_
Java
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ONIX Responsive Business &amp; Portfolio Template</title> <!-- Mobile Specific Metas --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content=""> <meta name="author" content=""> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <!-- CSS files begin--> <link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700|Open+Sans+Condensed:700,300,300italic|Open+Sans:400,300italic,400italic,600,600italic,700,700italic,800,800italic|PT+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'> <link href="assets/css/bootstrap.css" rel="stylesheet"> <link href="assets/css/bootstrap-responsive.css" rel="stylesheet"> <link href="assets/css/docs.css" rel="stylesheet"> <link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet"> <link href="assets/css/responsiveslides.css" rel="stylesheet"> <link rel="stylesheet" href="assets/css/prettyPhoto.css" type='text/css'> <link rel="stylesheet" href="assets/build/mediaelementplayer.min.css" /> <link rel="stylesheet" type="text/css" media="screen" href="assets/css/slide-in.css" /> <!--[if lt IE 9]><link rel="stylesheet" type="text/css" media="screen" href="assets/css/slide-in.ie.css" /><![endif]--> <link href="assets/css/style.css" rel="stylesheet"> <!-- Color Style Setting CSS file--> <link href="assets/css/color-theme/color-sgrey.css" rel="stylesheet"> <!-- HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!-- fav and touch icons --> <link rel="shortcut icon" href="assets/ico/favicon.ico"> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png"> </head> <body> <!-- Head ================================================== --> <div class="top-bar"> <div class="container"> <div class="row"> <div class="span6"> <!-- text widget begin here --> <ul class="info-text pull-left"> <li> <a href="#">Lorem ipsum dolor sit amet, consectetuer adipiscing elit Aenean commodo ligula eget.</a> </li> <li> <a href="#"> This informational text widget - Buy this theme now ! </a> </li> <li> <a href="#"> Lorem ipsum dolor sit </a> amet, consectetuer adipiscing elit. Aenean commodo ligula eget. </li> </ul> </div> <div class="span6"> <!-- social begin here --> <ul class="socicon right top-w"> <li> <a href="#" class="share-icon"> </a> </li> <li> <a href="#" class="google"> </a> </li> <li> <a href="#" class="facebook"> </a> </li> <li> <a href="#" class="twitter"> </a> </li> <li> <a href="#" class="flickr"> </a> </li> <li> <a href="#" class="dribbble"> </a> </li> <li> <a href="#" class="linkedin"> </a> </li> <li class="last"> <a href="#" class="vimeo"> </a> </li> </ul> <form class="navbar-search pull-right" action=""> <input class="search-query" type="text"> </form> </div> </div> </div> </div> <!-- Logo / Menu ================================================== --> <header class="header"> <div class="container strip-line"> <div class="row"> <div class="span4"> <a href="index.html" class="logo"> <img src="assets/img/logo.png" alt=""> </a> </div> <div class="span8"> <nav> <ul class="right"> <li> <a href="index.html"> home </a> <ul> <li> <a href="index_2.html"> home two </a> </li> </ul> </li> <li> <a href="about.html"> about </a> </li> <li> <a href="features.html"> features </a> </li> <li class="current"> <a href="portfolio.html"> portfolio </a> <ul> <li> <a href="portfolio-two.html"> portfolio two </a> </li> <li> <a href="portfolio-three.html"> portfolio three </a> </li> <li> <a href="portfolio-single.html"> single portfolio </a> </li> <li> <a href="portfolio-single-2.html"> single portfolio slider </a> </li> <li> <a href="portfolio-single-3.html"> single portfolio video </a> </li> </ul> </li> <li> <a href="blog.html"> blog </a> <ul> <li> <a href="blog_rs.html"> blog right sidebar </a> </li> <li> <a href="single-post.html"> single post </a> <ul> <li> <a href="#"> example level </a> </li> <li> <a href="#"> example level </a> </li> </ul> </li> </ul> </li> <li> <a href="contact.html"> contact </a> </li> </ul> </nav> </div> </div> </div> </header> <div class="slider-cont"> <div class="container"> <header id="pagehead"> <h1>Portfolio <small>&nbsp; &frasl; &nbsp;&nbsp;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. </small></h1> </header> </div> </div> <div class="container"> <!-- Portfolio filter ================================================== --> <section> <div class="row"> <ul id="portfolio-filter" class="span12"> <li> <a href="javascript:void(0)" title="" class="currents">All</a> </li> <li> <a href="javascript:void(0)" title="">Web</a> </li> <li> <a href="javascript:void(0)" title="">Video</a> </li> <li> <a href="javascript:void(0)" title="">Audio</a> </li> </ul> </div> <!-- Portfolio item ================================================== --> <ul class="thumbnails portfolio" id="containment-portfolio"> <li class="span3 item-block web all"> <a href="assets/img/bootstrap-mdo-sfmoma-01.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="portfolio-single.html"> <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single-2.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block video all"> <iframe src="http://player.vimeo.com/video/28220269?title=0&amp;byline=0&amp;portrait=0" width="270" height="130" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> <div class="desc"> <a href="portfolio-single-3.html">Vimeo Video </a> <p> <em>Portfolio Item Vimeo</em> </p> </div> </li> <li class="span3 item-block web all"> <a href="assets/img/bootstrap-mdo-sfmoma-01.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="#"> <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block"> <a href="assets/img/bootstrap-mdo-sfmoma-01.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="#"> <img src="assets/img/example-sites/example2.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single-2.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block audio all"> <audio src="assets/media/adg3com_electrofreak.mp3" type="audio/mp3" controls="controls"></audio> <div class="desc"> <a href="portfolio-single.html">Local Audio </a> <p> <em>Portfolio Item Audio</em> </p> </div> </li> <li class="span3 item-block"> <a href="assets/img/bootstrap-mdo-sfmoma-01.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="#"> <img src="assets/img/example-sites/example2.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block"> <a href="assets/img/bootstrap-mdo-sfmoma-01.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="#"> <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block video all"> <div class="row"> <div class="span3"> <video src="assets/media/VH_videoAsset.flv" type="video/flv" controls="controls"></video> </div> </div> <div class="desc"> <a href="portfolio-single-3.html"> Local Video </a> <p> <em>Portfolio Item Local Video</em> </p> </div> </li> <li class="span3 item-block web all"> <a href="assets/img/bootstrap-mdo-sfmoma-01.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="portfolio-single.html"> <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single-2.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block video all"> <iframe src="http://player.vimeo.com/video/28220269?title=0&amp;byline=0&amp;portrait=0" width="270" height="130" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> <div class="desc"> <a href="portfolio-single-3.html">Vimeo Video </a> <p> <em>Portfolio Item Vimeo</em> </p> </div> </li> <li class="span3 item-block web all"> <a href="assets/img/bootstrap-mdo-sfmoma-01.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="#"> <img src="assets/img/example-sites/example1.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> <li class="span3 item-block"> <a href="assets/img/bootstrap-mdo-sfmoma-01.jpg" class="zoom" rel="prettyPhoto" title="Image Title"></a> <a href="#" class="link"></a> <a class="thumbnail" href="#"> <img src="assets/img/example-sites/example2.jpg" alt="example-item"> </a> <div class="desc"> <a href="portfolio-single-2.html"> Images </a> <p> <em>Portfolio Item Images</em> </p> </div> </li> </ul> </section> <div class="divider"></div> </div><!-- /container --> <!-- Footer ================================================== --> <footer> <div class="container"> <div class="row"> <div class="span4"> <h3>About</h3> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.</p> <h3>Connect With Us</h3> <!-- social begin here --> <ul class="socicon left"> <li> <a href="#" class="share-icon"> </a> </li> <li> <a href="#" class="google"> </a> </li> <li> <a href="#" class="facebook"> </a> </li> <li> <a href="#" class="twitter"> </a> </li> <li> <a href="#" class="flickr"> </a> </li> <li> <a href="#" class="dribbble"> </a> </li> <li> <a href="#" class="linkedin"> </a> </li> <li class="last"> <a href="#" class="vimeo"> </a> </li> </ul> </div> <!-- tweets begin here --> <div class="span4"> <h3>Latest Tweets</h3> <div class="tweets"> <p> Loading Tweets... </p> <ul id="tweet-list"> </ul> </div> </div> <div class="span4"> <!-- flickr begin here --> <h3>From Flickr</h3> <script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=8&amp;source=user&amp;user=52617155@N08&amp;layout=x&amp;display=random&amp;size=s"></script> </div> <div class="span12 copy"> &copy; 2012 NLINE. All Rights Reserved. </div> </div> </div> </footer> <!-- JavaScript files begin--> <!-- Placed at the end of the document so the pages load faster --> <script src="assets/js/jquery.js"></script> <script src="http://maps.google.com/maps/api/js?sensor=false"></script> <script src="assets/js/jquery.form.js"></script> <script src="assets/js/jquery.ufvalidator-1.0.5.js"></script> <script src="assets/js/jquery.easing.1.3.js"></script> <script src="assets/js/jquery.cycle.all.js"></script> <script src="assets/js/jquery.prettyPhoto.js"></script> <script src="assets/js/google-code-prettify/prettify.js"></script> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/application.js"></script> <script src="assets/js/responsiveslides.min.js"></script> <script src="assets/build/mediaelement-and-player.min.js"></script> <script src="assets/js/gmap3.min.js"></script> <script src="assets/js/custom.js"></script> <script src="assets/js/jquery.ui.totop.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $().UItoTop({ easingType: 'easeOutQuart' }); }); </script> </body> </html>
Java
<?php // +---------------------------------------------------------------------- // | TOPThink [ WE CAN DO IT JUST THINK IT ] // +---------------------------------------------------------------------- // | Copyright (c) 2006-2013 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: liu21st <liu21st@gmail.com> // +---------------------------------------------------------------------- namespace Think\Db\Driver; use Think\Db; defined('THINK_PATH') or exit(); /** * Mongo数据库驱动 必须配合MongoModel使用 */ class Mongo extends Db{ protected $_mongo = null; // MongoDb Object protected $_collection = null; // MongoCollection Object protected $_dbName = ''; // dbName protected $_collectionName = ''; // collectionName protected $_cursor = null; // MongoCursor Object protected $comparison = array('neq'=>'ne','ne'=>'ne','gt'=>'gt','egt'=>'gte','gte'=>'gte','lt'=>'lt','elt'=>'lte','lte'=>'lte','in'=>'in','not in'=>'nin','nin'=>'nin'); /** * 架构函数 读取数据库配置信息 * @access public * @param array $config 数据库配置数组 */ public function __construct($config=''){ if ( !class_exists('mongoClient') ) { throw_exception(L('_NOT_SUPPERT_').':mongoClient'); } if(!empty($config)) { $this->config = $config; if(empty($this->config['params'])) { $this->config['params'] = array(); } } } /** * 连接数据库方法 * @access public */ public function connect($config='',$linkNum=0) { if ( !isset($this->linkID[$linkNum]) ) { if(empty($config)) $config = $this->config; $host = 'mongodb://'.($config['username']?"{$config['username']}":'').($config['password']?":{$config['password']}@":'').$config['hostname'].($config['hostport']?":{$config['hostport']}":'').'/'.($config['database']?"{$config['database']}":''); try{ $this->linkID[$linkNum] = new \mongoClient( $host,$config['params']); }catch (\MongoConnectionException $e){ throw_exception($e->getmessage()); } // 标记连接成功 $this->connected = true; // 注销数据库连接配置信息 if(1 != C('DB_DEPLOY_TYPE')) unset($this->config); } return $this->linkID[$linkNum]; } /** * 切换当前操作的Db和Collection * @access public * @param string $collection collection * @param string $db db * @param boolean $master 是否主服务器 * @return void */ public function switchCollection($collection,$db='',$master=true){ // 当前没有连接 则首先进行数据库连接 if ( !$this->_linkID ) $this->initConnect($master); try{ if(!empty($db)) { // 传人Db则切换数据库 // 当前MongoDb对象 $this->_dbName = $db; $this->_mongo = $this->_linkID->selectDb($db); } // 当前MongoCollection对象 if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.getCollection('.$collection.')'; } if($this->_collectionName != $collection) { N('db_read',1); // 记录开始执行时间 G('queryStartTime'); $this->_collection = $this->_mongo->selectCollection($collection); $this->debug(); $this->_collectionName = $collection; // 记录当前Collection名称 } }catch (MongoException $e){ throw_exception($e->getMessage()); } } /** * 释放查询结果 * @access public */ public function free() { $this->_cursor = null; } /** * 执行命令 * @access public * @param array $command 指令 * @return array */ public function command($command=array()) { N('db_write',1); $this->queryStr = 'command:'.json_encode($command); // 记录开始执行时间 G('queryStartTime'); $result = $this->_mongo->command($command); $this->debug(); if(!$result['ok']) { throw_exception($result['errmsg']); } return $result; } /** * 执行语句 * @access public * @param string $code sql指令 * @param array $args 参数 * @return mixed */ public function execute($code,$args=array()) { N('db_write',1); $this->queryStr = 'execute:'.$code; // 记录开始执行时间 G('queryStartTime'); $result = $this->_mongo->execute($code,$args); $this->debug(); if($result['ok']) { return $result['retval']; }else{ throw_exception($result['errmsg']); } } /** * 关闭数据库 * @access public */ public function close() { if($this->_linkID) { $this->_linkID->close(); $this->_linkID = null; $this->_mongo = null; $this->_collection = null; $this->_cursor = null; } } /** * 数据库错误信息 * @access public * @return string */ public function error() { $this->error = $this->_mongo->lastError(); trace($this->error,'','ERR'); return $this->error; } /** * 插入记录 * @access public * @param mixed $data 数据 * @param array $options 参数表达式 * @param boolean $replace 是否replace * @return false | integer */ public function insert($data,$options=array(),$replace=false) { if(isset($options['table'])) { $this->switchCollection($options['table']); } $this->model = $options['model']; N('db_write',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.insert('; $this->queryStr .= $data?json_encode($data):'{}'; $this->queryStr .= ')'; } try{ // 记录开始执行时间 G('queryStartTime'); $result = $replace? $this->_collection->save($data): $this->_collection->insert($data); $this->debug(); if($result) { $_id = $data['_id']; if(is_object($_id)) { $_id = $_id->__toString(); } $this->lastInsID = $_id; } return $result; } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } } /** * 插入多条记录 * @access public * @param array $dataList 数据 * @param array $options 参数表达式 * @return bool */ public function insertAll($dataList,$options=array()) { if(isset($options['table'])) { $this->switchCollection($options['table']); } $this->model = $options['model']; N('db_write',1); try{ // 记录开始执行时间 G('queryStartTime'); $result = $this->_collection->batchInsert($dataList); $this->debug(); return $result; } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } } /** * 生成下一条记录ID 用于自增非MongoId主键 * @access public * @param string $pk 主键名 * @return integer */ public function mongo_next_id($pk) { N('db_read',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.find({},{'.$pk.':1}).sort({'.$pk.':-1}).limit(1)'; } try{ // 记录开始执行时间 G('queryStartTime'); $result = $this->_collection->find(array(),array($pk=>1))->sort(array($pk=>-1))->limit(1); $this->debug(); } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } $data = $result->getNext(); return isset($data[$pk])?$data[$pk]+1:1; } /** * 更新记录 * @access public * @param mixed $data 数据 * @param array $options 表达式 * @return bool */ public function update($data,$options) { if(isset($options['table'])) { $this->switchCollection($options['table']); } $this->model = $options['model']; N('db_write',1); $query = $this->parseWhere($options['where']); $set = $this->parseSet($data); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.update('; $this->queryStr .= $query?json_encode($query):'{}'; $this->queryStr .= ','.json_encode($set).')'; } try{ // 记录开始执行时间 G('queryStartTime'); if(isset($options['limit']) && $options['limit'] == 1) { $multiple = array("multiple" => false); }else{ $multiple = array("multiple" => true); } $result = $this->_collection->update($query,$set,$multiple); $this->debug(); return $result; } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } } /** * 删除记录 * @access public * @param array $options 表达式 * @return false | integer */ public function delete($options=array()) { if(isset($options['table'])) { $this->switchCollection($options['table']); } $query = $this->parseWhere($options['where']); $this->model = $options['model']; N('db_write',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.remove('.json_encode($query).')'; } try{ // 记录开始执行时间 G('queryStartTime'); $result = $this->_collection->remove($query); $this->debug(); return $result; } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } } /** * 清空记录 * @access public * @param array $options 表达式 * @return false | integer */ public function clear($options=array()){ if(isset($options['table'])) { $this->switchCollection($options['table']); } $this->model = $options['model']; N('db_write',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.remove({})'; } try{ // 记录开始执行时间 G('queryStartTime'); $result = $this->_collection->drop(); $this->debug(); return $result; } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } } /** * 查找记录 * @access public * @param array $options 表达式 * @return iterator */ public function select($options=array()) { if(isset($options['table'])) { $this->switchCollection($options['table'],'',false); } $cache = isset($options['cache'])?$options['cache']:false; if($cache) { // 查询缓存检测 $key = is_string($cache['key'])?$cache['key']:md5(serialize($options)); $value = S($key,'','',$cache['type']); if(false !== $value) { return $value; } } $this->model = $options['model']; N('db_query',1); $query = $this->parseWhere($options['where']); $field = $this->parseField($options['field']); try{ if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.find('; $this->queryStr .= $query? json_encode($query):'{}'; $this->queryStr .= $field? ','.json_encode($field):''; $this->queryStr .= ')'; } // 记录开始执行时间 G('queryStartTime'); $_cursor = $this->_collection->find($query,$field); if($options['order']) { $order = $this->parseOrder($options['order']); if(C('DB_SQL_LOG')) { $this->queryStr .= '.sort('.json_encode($order).')'; } $_cursor = $_cursor->sort($order); } if(isset($options['page'])) { // 根据页数计算limit if(strpos($options['page'],',')) { list($page,$length) = explode(',',$options['page']); }else{ $page = $options['page']; } $page = $page?$page:1; $length = isset($length)?$length:(is_numeric($options['limit'])?$options['limit']:20); $offset = $length*((int)$page-1); $options['limit'] = $offset.','.$length; } if(isset($options['limit'])) { list($offset,$length) = $this->parseLimit($options['limit']); if(!empty($offset)) { if(C('DB_SQL_LOG')) { $this->queryStr .= '.skip('.intval($offset).')'; } $_cursor = $_cursor->skip(intval($offset)); } if(C('DB_SQL_LOG')) { $this->queryStr .= '.limit('.intval($length).')'; } $_cursor = $_cursor->limit(intval($length)); } $this->debug(); $this->_cursor = $_cursor; $resultSet = iterator_to_array($_cursor); if($cache && $resultSet ) { // 查询缓存写入 S($key,$resultSet,$cache['expire'],$cache['type']); } return $resultSet; } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } } /** * 查找某个记录 * @access public * @param array $options 表达式 * @return array */ public function find($options=array()){ if(isset($options['table'])) { $this->switchCollection($options['table'],'',false); } $cache = isset($options['cache'])?$options['cache']:false; if($cache) { // 查询缓存检测 $key = is_string($cache['key'])?$cache['key']:md5(serialize($options)); $value = S($key,'','',$cache['type']); if(false !== $value) { return $value; } } $this->model = $options['model']; N('db_query',1); $query = $this->parseWhere($options['where']); $fields = $this->parseField($options['field']); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.findOne('; $this->queryStr .= $query?json_encode($query):'{}'; $this->queryStr .= $fields?','.json_encode($fields):''; $this->queryStr .= ')'; } try{ // 记录开始执行时间 G('queryStartTime'); $result = $this->_collection->findOne($query,$fields); $this->debug(); if($cache && $result ) { // 查询缓存写入 S($key,$result,$cache['expire'],$cache['type']); } return $result; } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } } /** * 统计记录数 * @access public * @param array $options 表达式 * @return iterator */ public function count($options=array()){ if(isset($options['table'])) { $this->switchCollection($options['table'],'',false); } $this->model = $options['model']; N('db_query',1); $query = $this->parseWhere($options['where']); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName; $this->queryStr .= $query?'.find('.json_encode($query).')':''; $this->queryStr .= '.count()'; } try{ // 记录开始执行时间 G('queryStartTime'); $count = $this->_collection->count($query); $this->debug(); return $count; } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } } public function group($keys,$initial,$reduce,$options=array()){ $this->_collection->group($keys,$initial,$reduce,$options); } /** * 取得数据表的字段信息 * @access public * @return array */ public function getFields($collection=''){ if(!empty($collection) && $collection != $this->_collectionName) { $this->switchCollection($collection,'',false); } N('db_query',1); if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.'.$this->_collectionName.'.findOne()'; } try{ // 记录开始执行时间 G('queryStartTime'); $result = $this->_collection->findOne(); $this->debug(); } catch (MongoCursorException $e) { throw_exception($e->getMessage()); } if($result) { // 存在数据则分析字段 $info = array(); foreach ($result as $key=>$val){ $info[$key] = array( 'name'=>$key, 'type'=>getType($val), ); } return $info; } // 暂时没有数据 返回false return false; } /** * 取得当前数据库的collection信息 * @access public */ public function getTables(){ if(C('DB_SQL_LOG')) { $this->queryStr = $this->_dbName.'.getCollenctionNames()'; } N('db_query',1); // 记录开始执行时间 G('queryStartTime'); $list = $this->_mongo->listCollections(); $this->debug(); $info = array(); foreach ($list as $collection){ $info[] = $collection->getName(); } return $info; } /** * set分析 * @access protected * @param array $data * @return string */ protected function parseSet($data) { $result = array(); foreach ($data as $key=>$val){ if(is_array($val)) { switch($val[0]) { case 'inc': $result['$inc'][$key] = (int)$val[1]; break; case 'set': case 'unset': case 'push': case 'pushall': case 'addtoset': case 'pop': case 'pull': case 'pullall': $result['$'.$val[0]][$key] = $val[1]; break; default: $result['$set'][$key] = $val; } }else{ $result['$set'][$key] = $val; } } return $result; } /** * order分析 * @access protected * @param mixed $order * @return array */ protected function parseOrder($order) { if(is_string($order)) { $array = explode(',',$order); $order = array(); foreach ($array as $key=>$val){ $arr = explode(' ',trim($val)); if(isset($arr[1])) { $arr[1] = $arr[1]=='asc'?1:-1; }else{ $arr[1] = 1; } $order[$arr[0]] = $arr[1]; } } return $order; } /** * limit分析 * @access protected * @param mixed $limit * @return array */ protected function parseLimit($limit) { if(strpos($limit,',')) { $array = explode(',',$limit); }else{ $array = array(0,$limit); } return $array; } /** * field分析 * @access protected * @param mixed $fields * @return array */ public function parseField($fields){ if(empty($fields)) { $fields = array(); } if(is_string($fields)) { $fields = explode(',',$fields); } return $fields; } /** * where分析 * @access protected * @param mixed $where * @return array */ public function parseWhere($where){ $query = array(); foreach ($where as $key=>$val){ if('_id' != $key && 0===strpos($key,'_')) { // 解析特殊条件表达式 $query = $this->parseThinkWhere($key,$val); }else{ // 查询字段的安全过滤 if(!preg_match('/^[A-Z_\|\&\-.a-z0-9]+$/',trim($key))){ throw_exception(L('_ERROR_QUERY_').':'.$key); } $key = trim($key); if(strpos($key,'|')) { $array = explode('|',$key); $str = array(); foreach ($array as $k){ $str[] = $this->parseWhereItem($k,$val); } $query['$or'] = $str; }elseif(strpos($key,'&')){ $array = explode('&',$key); $str = array(); foreach ($array as $k){ $str[] = $this->parseWhereItem($k,$val); } $query = array_merge($query,$str); }else{ $str = $this->parseWhereItem($key,$val); $query = array_merge($query,$str); } } } return $query; } /** * 特殊条件分析 * @access protected * @param string $key * @param mixed $val * @return string */ protected function parseThinkWhere($key,$val) { $query = array(); switch($key) { case '_query': // 字符串模式查询条件 parse_str($val,$query); if(isset($query['_logic']) && strtolower($query['_logic']) == 'or' ) { unset($query['_logic']); $query['$or'] = $query; } break; case '_string':// MongoCode查询 $query['$where'] = new MongoCode($val); break; } return $query; } /** * where子单元分析 * @access protected * @param string $key * @param mixed $val * @return array */ protected function parseWhereItem($key,$val) { $query = array(); if(is_array($val)) { if(is_string($val[0])) { $con = strtolower($val[0]); if(in_array($con,array('neq','ne','gt','egt','gte','lt','lte','elt'))) { // 比较运算 $k = '$'.$this->comparison[$con]; $query[$key] = array($k=>$val[1]); }elseif('like'== $con){ // 模糊查询 采用正则方式 $query[$key] = new MongoRegex("/".$val[1]."/"); }elseif('mod'==$con){ // mod 查询 $query[$key] = array('$mod'=>$val[1]); }elseif('regex'==$con){ // 正则查询 $query[$key] = new MongoRegex($val[1]); }elseif(in_array($con,array('in','nin','not in'))){ // IN NIN 运算 $data = is_string($val[1])? explode(',',$val[1]):$val[1]; $k = '$'.$this->comparison[$con]; $query[$key] = array($k=>$data); }elseif('all'==$con){ // 满足所有指定条件 $data = is_string($val[1])? explode(',',$val[1]):$val[1]; $query[$key] = array('$all'=>$data); }elseif('between'==$con){ // BETWEEN运算 $data = is_string($val[1])? explode(',',$val[1]):$val[1]; $query[$key] = array('$gte'=>$data[0],'$lte'=>$data[1]); }elseif('not between'==$con){ $data = is_string($val[1])? explode(',',$val[1]):$val[1]; $query[$key] = array('$lt'=>$data[0],'$gt'=>$data[1]); }elseif('exp'==$con){ // 表达式查询 $query['$where'] = new MongoCode($val[1]); }elseif('exists'==$con){ // 字段是否存在 $query[$key] =array('$exists'=>(bool)$val[1]); }elseif('size'==$con){ // 限制属性大小 $query[$key] =array('$size'=>intval($val[1])); }elseif('type'==$con){ // 限制字段类型 1 浮点型 2 字符型 3 对象或者MongoDBRef 5 MongoBinData 7 MongoId 8 布尔型 9 MongoDate 10 NULL 15 MongoCode 16 32位整型 17 MongoTimestamp 18 MongoInt64 如果是数组的话判断元素的类型 $query[$key] =array('$type'=>intval($val[1])); }else{ $query[$key] = $val; } return $query; } } $query[$key] = $val; return $query; } }
Java
/** * */ #include <stdio.h> #define NUM_ROWS_A 12 //rows of input [A] #define NUM_COLUMNS_A 12 //columns of input [A] #define NUM_ROWS_B 12 //rows of input [B] #define NUM_COLUMNS_B 12 //columns of input [B] #pragma xmp nodes p(*) #pragma xmp template t(0:11) #pragma xmp distribute t(block) onto p double a[NUM_ROWS_A][NUM_COLUMNS_A]; //declare input [A] double b[NUM_ROWS_B][NUM_COLUMNS_B]; double c[NUM_ROWS_A][NUM_COLUMNS_B]; #pragma xmp align b[i][*] with t(i) #pragma xmp align c[i][*] with t(i) int main(void){ int i; #pragma xmp loop on t(j) for (int j = 0; j < NUM_COLUMNS_B; j++) { for(int i= 0; i < NUM_ROWS_A; i++) { for(int k = 0; k < NUM_COLUMNS_A; k++) { c[j][i] = c[j][i] + a[k][i] * b[j][k]; printf("Process %d is computing c[%d][%d]\n", xmp_node_num(), j, i); } } } return 0; }
Java
package mpicbg.spim.segmentation; import fiji.tool.SliceListener; import fiji.tool.SliceObserver; import ij.IJ; import ij.ImageJ; import ij.ImagePlus; import ij.ImageStack; import ij.WindowManager; import ij.gui.OvalRoi; import ij.gui.Overlay; import ij.gui.Roi; import ij.io.Opener; import ij.plugin.PlugIn; import ij.process.ByteProcessor; import ij.process.FloatProcessor; import ij.process.ImageProcessor; import ij.process.ShortProcessor; import java.awt.Button; import java.awt.Checkbox; import java.awt.Color; import java.awt.Font; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Label; import java.awt.Rectangle; import java.awt.Scrollbar; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.List; import mpicbg.imglib.algorithm.gauss.GaussianConvolutionReal; import mpicbg.imglib.algorithm.math.LocalizablePoint; import mpicbg.imglib.algorithm.scalespace.DifferenceOfGaussianPeak; import mpicbg.imglib.algorithm.scalespace.DifferenceOfGaussianReal1; import mpicbg.imglib.algorithm.scalespace.SubpixelLocalization; import mpicbg.imglib.container.array.ArrayContainerFactory; import mpicbg.imglib.cursor.LocalizableByDimCursor; import mpicbg.imglib.cursor.LocalizableCursor; import mpicbg.imglib.image.Image; import mpicbg.imglib.image.ImageFactory; import mpicbg.imglib.image.display.imagej.ImageJFunctions; import mpicbg.imglib.multithreading.SimpleMultiThreading; import mpicbg.imglib.outofbounds.OutOfBoundsStrategyMirrorFactory; import mpicbg.imglib.outofbounds.OutOfBoundsStrategyValueFactory; import mpicbg.imglib.type.numeric.real.FloatType; import mpicbg.imglib.util.Util; import mpicbg.spim.io.IOFunctions; import mpicbg.spim.registration.ViewStructure; import mpicbg.spim.registration.detection.DetectionSegmentation; import net.imglib2.RandomAccess; import net.imglib2.exception.ImgLibException; import net.imglib2.img.ImagePlusAdapter; import net.imglib2.img.imageplus.FloatImagePlus; import net.imglib2.view.Views; import spim.process.fusion.FusionHelper; /** * An interactive tool for determining the required sigma and peak threshold * * @author Stephan Preibisch */ public class InteractiveDoG implements PlugIn { final int extraSize = 40; final int scrollbarSize = 1000; float sigma = 0.5f; float sigma2 = 0.5f; float threshold = 0.0001f; // steps per octave public static int standardSenstivity = 4; int sensitivity = standardSenstivity; float imageSigma = 0.5f; float sigmaMin = 0.5f; float sigmaMax = 10f; int sigmaInit = 300; float thresholdMin = 0.0001f; float thresholdMax = 1f; int thresholdInit = 500; double minIntensityImage = Double.NaN; double maxIntensityImage = Double.NaN; SliceObserver sliceObserver; RoiListener roiListener; ImagePlus imp; int channel = 0; Rectangle rectangle; Image<FloatType> img; FloatImagePlus< net.imglib2.type.numeric.real.FloatType > source; ArrayList<DifferenceOfGaussianPeak<FloatType>> peaks; Color originalColor = new Color( 0.8f, 0.8f, 0.8f ); Color inactiveColor = new Color( 0.95f, 0.95f, 0.95f ); public Rectangle standardRectangle; boolean isComputing = false; boolean isStarted = false; boolean enableSigma2 = false; boolean sigma2IsAdjustable = true; boolean lookForMinima = false; boolean lookForMaxima = true; public static enum ValueChange { SIGMA, THRESHOLD, SLICE, ROI, MINMAX, ALL } boolean isFinished = false; boolean wasCanceled = false; public boolean isFinished() { return isFinished; } public boolean wasCanceled() { return wasCanceled; } public double getInitialSigma() { return sigma; } public void setInitialSigma( final float value ) { sigma = value; sigmaInit = computeScrollbarPositionFromValue( sigma, sigmaMin, sigmaMax, scrollbarSize ); } public double getSigma2() { return sigma2; } public double getThreshold() { return threshold; } public void setThreshold( final float value ) { threshold = value; final double log1001 = Math.log10( scrollbarSize + 1); thresholdInit = (int)Math.round( 1001-Math.pow(10, -(((threshold - thresholdMin)/(thresholdMax-thresholdMin))*log1001) + log1001 ) ); } public boolean getSigma2WasAdjusted() { return enableSigma2; } public boolean getLookForMaxima() { return lookForMaxima; } public boolean getLookForMinima() { return lookForMinima; } public void setLookForMaxima( final boolean lookForMaxima ) { this.lookForMaxima = lookForMaxima; } public void setLookForMinima( final boolean lookForMinima ) { this.lookForMinima = lookForMinima; } public void setSigmaMax( final float sigmaMax ) { this.sigmaMax = sigmaMax; } public void setSigma2isAdjustable( final boolean state ) { sigma2IsAdjustable = state; } // for the case that it is needed again, we can save one conversion public FloatImagePlus< net.imglib2.type.numeric.real.FloatType > getConvertedImage() { return source; } public InteractiveDoG( final ImagePlus imp, final int channel ) { this.imp = imp; this.channel = channel; } public InteractiveDoG( final ImagePlus imp ) { this.imp = imp; } public InteractiveDoG() {} public void setMinIntensityImage( final double min ) { this.minIntensityImage = min; } public void setMaxIntensityImage( final double max ) { this.maxIntensityImage = max; } @Override public void run( String arg ) { if ( imp == null ) imp = WindowManager.getCurrentImage(); standardRectangle = new Rectangle( imp.getWidth()/4, imp.getHeight()/4, imp.getWidth()/2, imp.getHeight()/2 ); if ( imp.getType() == ImagePlus.COLOR_RGB || imp.getType() == ImagePlus.COLOR_256 ) { IJ.log( "Color images are not supported, please convert to 8, 16 or 32-bit grayscale" ); return; } Roi roi = imp.getRoi(); if ( roi == null ) { //IJ.log( "A rectangular ROI is required to define the area..." ); imp.setRoi( standardRectangle ); roi = imp.getRoi(); } if ( roi.getType() != Roi.RECTANGLE ) { IJ.log( "Only rectangular rois are supported..." ); return; } // copy the ImagePlus into an ArrayImage<FloatType> for faster access source = convertToFloat( imp, channel, 0, minIntensityImage, maxIntensityImage ); // show the interactive kit displaySliders(); // add listener to the imageplus slice slider sliceObserver = new SliceObserver( imp, new ImagePlusListener() ); // compute first version updatePreview( ValueChange.ALL ); isStarted = true; // check whenever roi is modified to update accordingly roiListener = new RoiListener(); imp.getCanvas().addMouseListener( roiListener ); } /** * Updates the Preview with the current parameters (sigma, threshold, roi, slicenumber) * * @param change - what did change */ protected void updatePreview( final ValueChange change ) { // check if Roi changed boolean roiChanged = false; Roi roi = imp.getRoi(); if ( roi == null || roi.getType() != Roi.RECTANGLE ) { imp.setRoi( new Rectangle( standardRectangle ) ); roi = imp.getRoi(); roiChanged = true; } final Rectangle rect = roi.getBounds(); if ( roiChanged || img == null || change == ValueChange.SLICE || rect.getMinX() != rectangle.getMinX() || rect.getMaxX() != rectangle.getMaxX() || rect.getMinY() != rectangle.getMinY() || rect.getMaxY() != rectangle.getMaxY() ) { rectangle = rect; img = extractImage( source, rectangle, extraSize ); roiChanged = true; } // if we got some mouse click but the ROI did not change we can return if ( !roiChanged && change == ValueChange.ROI ) { isComputing = false; return; } // compute the Difference Of Gaussian if necessary if ( peaks == null || roiChanged || change == ValueChange.SIGMA || change == ValueChange.SLICE || change == ValueChange.ALL ) { // // Compute the Sigmas for the gaussian folding // final float k, K_MIN1_INV; final float[] sigma, sigmaDiff; if ( enableSigma2 ) { sigma = new float[ 2 ]; sigma[ 0 ] = this.sigma; sigma[ 1 ] = this.sigma2; k = sigma[ 1 ] / sigma[ 0 ]; K_MIN1_INV = DetectionSegmentation.computeKWeight( k ); sigmaDiff = DetectionSegmentation.computeSigmaDiff( sigma, imageSigma ); } else { k = (float)DetectionSegmentation.computeK( sensitivity ); K_MIN1_INV = DetectionSegmentation.computeKWeight( k ); sigma = DetectionSegmentation.computeSigma( k, this.sigma ); sigmaDiff = DetectionSegmentation.computeSigmaDiff( sigma, imageSigma ); } // the upper boundary this.sigma2 = sigma[ 1 ]; final DifferenceOfGaussianReal1<FloatType> dog = new DifferenceOfGaussianReal1<FloatType>( img, new OutOfBoundsStrategyValueFactory<FloatType>(), sigmaDiff[ 0 ], sigmaDiff[ 1 ], thresholdMin/4, K_MIN1_INV ); dog.setKeepDoGImage( true ); dog.process(); final SubpixelLocalization<FloatType> subpixel = new SubpixelLocalization<FloatType>( dog.getDoGImage(), dog.getPeaks() ); subpixel.process(); peaks = dog.getPeaks(); } // extract peaks to show Overlay o = imp.getOverlay(); if ( o == null ) { o = new Overlay(); imp.setOverlay( o ); } o.clear(); for ( final DifferenceOfGaussianPeak<FloatType> peak : peaks ) { if ( ( peak.isMax() && lookForMaxima ) || ( peak.isMin() && lookForMinima ) ) { final float x = peak.getPosition( 0 ); final float y = peak.getPosition( 1 ); if ( Math.abs( peak.getValue().get() ) > threshold && x >= extraSize/2 && y >= extraSize/2 && x < rect.width+extraSize/2 && y < rect.height+extraSize/2 ) { final OvalRoi or = new OvalRoi( Util.round( x - sigma ) + rect.x - extraSize/2, Util.round( y - sigma ) + rect.y - extraSize/2, Util.round( sigma+sigma2 ), Util.round( sigma+sigma2 ) ); if ( peak.isMax() ) or.setStrokeColor( Color.green ); else if ( peak.isMin() ) or.setStrokeColor( Color.red ); o.add( or ); } } } imp.updateAndDraw(); isComputing = false; } public static float computeSigma2( final float sigma1, final int sensitivity ) { final float k = (float)DetectionSegmentation.computeK( sensitivity ); final float[] sigma = DetectionSegmentation.computeSigma( k, sigma1 ); return sigma[ 1 ]; } /** * Extract the current 2d region of interest from the souce image * * @param source - the source image, a {@link Image} which is a copy of the {@link ImagePlus} * @param rectangle - the area of interest * @param extraSize - the extra size around so that detections at the border of the roi are not messed up * @return */ protected Image<FloatType> extractImage( final FloatImagePlus< net.imglib2.type.numeric.real.FloatType > source, final Rectangle rectangle, final int extraSize ) { final Image<FloatType> img = new ImageFactory<FloatType>( new FloatType(), new ArrayContainerFactory() ).createImage( new int[]{ rectangle.width+extraSize, rectangle.height+extraSize } ); final int offsetX = rectangle.x - extraSize/2; final int offsetY = rectangle.y - extraSize/2; final int[] location = new int[ source.numDimensions() ]; if ( location.length > 2 ) location[ 2 ] = (imp.getCurrentSlice()-1)/imp.getNChannels(); final LocalizableCursor<FloatType> cursor = img.createLocalizableCursor(); final RandomAccess<net.imglib2.type.numeric.real.FloatType> positionable; if ( offsetX >= 0 && offsetY >= 0 && offsetX + img.getDimension( 0 ) < source.dimension( 0 ) && offsetY + img.getDimension( 1 ) < source.dimension( 1 ) ) { // it is completely inside so we need no outofbounds for copying positionable = source.randomAccess(); } else { positionable = Views.extendMirrorSingle( source ).randomAccess(); } while ( cursor.hasNext() ) { cursor.fwd(); cursor.getPosition( location ); location[ 0 ] += offsetX; location[ 1 ] += offsetY; positionable.setPosition( location ); cursor.getType().set( positionable.get().get() ); } return img; } /** * Normalize and make a copy of the {@link ImagePlus} into an {@link Image}&gt;FloatType&lt; for faster access when copying the slices * * @param imp - the {@link ImagePlus} input image * @return - the normalized copy [0...1] */ public static FloatImagePlus< net.imglib2.type.numeric.real.FloatType > convertToFloat( final ImagePlus imp, int channel, int timepoint ) { return convertToFloat( imp, channel, timepoint, Double.NaN, Double.NaN ); } public static FloatImagePlus< net.imglib2.type.numeric.real.FloatType > convertToFloat( final ImagePlus imp, int channel, int timepoint, final double min, final double max ) { // stupid 1-offset of imagej channel++; timepoint++; final int h = imp.getHeight(); final int w = imp.getWidth(); final ArrayList< float[] > img = new ArrayList< float[] >(); if ( imp.getProcessor() instanceof FloatProcessor ) { for ( int z = 0; z < imp.getNSlices(); ++z ) img.add( ( (float[])imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, timepoint ) ).getPixels() ).clone() ); } else if ( imp.getProcessor() instanceof ByteProcessor ) { for ( int z = 0; z < imp.getNSlices(); ++z ) { final byte[] pixels = (byte[])imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, timepoint ) ).getPixels(); final float[] pixelsF = new float[ pixels.length ]; for ( int i = 0; i < pixels.length; ++i ) pixelsF[ i ] = pixels[ i ] & 0xff; img.add( pixelsF ); } } else if ( imp.getProcessor() instanceof ShortProcessor ) { for ( int z = 0; z < imp.getNSlices(); ++z ) { final short[] pixels = (short[])imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, timepoint ) ).getPixels(); final float[] pixelsF = new float[ pixels.length ]; for ( int i = 0; i < pixels.length; ++i ) pixelsF[ i ] = pixels[ i ] & 0xffff; img.add( pixelsF ); } } else // some color stuff or so { for ( int z = 0; z < imp.getNSlices(); ++z ) { final ImageProcessor ip = imp.getStack().getProcessor( imp.getStackIndex( channel, z + 1, timepoint ) ); final float[] pixelsF = new float[ w * h ]; int i = 0; for ( int y = 0; y < h; ++y ) for ( int x = 0; x < w; ++x ) pixelsF[ i++ ] = ip.getPixelValue( x, y ); img.add( pixelsF ); } } final FloatImagePlus< net.imglib2.type.numeric.real.FloatType > i = createImgLib2( img, w, h ); if ( Double.isNaN( min ) || Double.isNaN( max ) || Double.isInfinite( min ) || Double.isInfinite( max ) || min == max ) FusionHelper.normalizeImage( i ); else FusionHelper.normalizeImage( i, (float)min, (float)max ); return i; } public static FloatImagePlus< net.imglib2.type.numeric.real.FloatType > createImgLib2( final List< float[] > img, final int w, final int h ) { final ImagePlus imp; if ( img.size() > 1 ) { final ImageStack stack = new ImageStack( w, h ); for ( int z = 0; z < img.size(); ++z ) stack.addSlice( new FloatProcessor( w, h, img.get( z ) ) ); imp = new ImagePlus( "ImgLib2 FloatImagePlus (3d)", stack ); } else { imp = new ImagePlus( "ImgLib2 FloatImagePlus (2d)", new FloatProcessor( w, h, img.get( 0 ) ) ); } return ImagePlusAdapter.wrapFloat( imp ); } /** * Instantiates the panel for adjusting the paramters */ protected void displaySliders() { final Frame frame = new Frame("Adjust Difference-of-Gaussian Values"); frame.setSize( 400, 330 ); /* Instantiation */ final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints c = new GridBagConstraints(); final Scrollbar sigma1 = new Scrollbar ( Scrollbar.HORIZONTAL, sigmaInit, 10, 0, 10 + scrollbarSize ); this.sigma = computeValueFromScrollbarPosition( sigmaInit, sigmaMin, sigmaMax, scrollbarSize); final Scrollbar threshold = new Scrollbar ( Scrollbar.HORIZONTAL, thresholdInit, 10, 0, 10 + scrollbarSize ); final float log1001 = (float)Math.log10( scrollbarSize + 1); this.threshold = thresholdMin + ( (log1001 - (float)Math.log10(1001-thresholdInit))/log1001 ) * (thresholdMax-thresholdMin); this.sigma2 = computeSigma2( this.sigma, this.sensitivity ); final int sigma2init = computeScrollbarPositionFromValue( this.sigma2, sigmaMin, sigmaMax, scrollbarSize ); final Scrollbar sigma2 = new Scrollbar ( Scrollbar.HORIZONTAL, sigma2init, 10, 0, 10 + scrollbarSize ); final Label sigmaText1 = new Label( "Sigma 1 = " + this.sigma, Label.CENTER ); final Label sigmaText2 = new Label( "Sigma 2 = " + this.sigma2, Label.CENTER ); final Label thresholdText = new Label( "Threshold = " + this.threshold, Label.CENTER ); final Button apply = new Button( "Apply to Stack (will take some time)" ); final Button button = new Button( "Done" ); final Button cancel = new Button( "Cancel" ); final Checkbox sigma2Enable = new Checkbox( "Enable Manual Adjustment of Sigma 2 ", enableSigma2 ); final Checkbox min = new Checkbox( "Look for Minima (red)", lookForMinima ); final Checkbox max = new Checkbox( "Look for Maxima (green)", lookForMaxima ); /* Location */ frame.setLayout( layout ); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 1; frame.add ( sigma1, c ); ++c.gridy; frame.add( sigmaText1, c ); ++c.gridy; frame.add ( sigma2, c ); ++c.gridy; frame.add( sigmaText2, c ); ++c.gridy; c.insets = new Insets(0,65,0,65); frame.add( sigma2Enable, c ); ++c.gridy; c.insets = new Insets(10,0,0,0); frame.add ( threshold, c ); c.insets = new Insets(0,0,0,0); ++c.gridy; frame.add( thresholdText, c ); ++c.gridy; c.insets = new Insets(0,130,0,75); frame.add( min, c ); ++c.gridy; c.insets = new Insets(0,125,0,75); frame.add( max, c ); ++c.gridy; c.insets = new Insets(0,75,0,75); frame.add( apply, c ); ++c.gridy; c.insets = new Insets(10,150,0,150); frame.add( button, c ); ++c.gridy; c.insets = new Insets(10,150,0,150); frame.add( cancel, c ); /* Configuration */ sigma1.addAdjustmentListener( new SigmaListener( sigmaText1, sigmaMin, sigmaMax, scrollbarSize, sigma1, sigma2, sigmaText2 ) ); sigma2.addAdjustmentListener( new Sigma2Listener( sigmaMin, sigmaMax, scrollbarSize, sigma2, sigmaText2 ) ); threshold.addAdjustmentListener( new ThresholdListener( thresholdText, thresholdMin, thresholdMax ) ); button.addActionListener( new FinishedButtonListener( frame, false ) ); cancel.addActionListener( new FinishedButtonListener( frame, true ) ); apply.addActionListener( new ApplyButtonListener() ); min.addItemListener( new MinListener() ); max.addItemListener( new MaxListener() ); sigma2Enable.addItemListener( new EnableListener( sigma2, sigmaText2 ) ); if ( !sigma2IsAdjustable ) sigma2Enable.setEnabled( false ); frame.addWindowListener( new FrameListener( frame ) ); frame.setVisible( true ); originalColor = sigma2.getBackground(); sigma2.setBackground( inactiveColor ); sigmaText1.setFont( sigmaText1.getFont().deriveFont( Font.BOLD ) ); thresholdText.setFont( thresholdText.getFont().deriveFont( Font.BOLD ) ); } protected class EnableListener implements ItemListener { final Scrollbar sigma2; final Label sigmaText2; public EnableListener( final Scrollbar sigma2, final Label sigmaText2 ) { this.sigmaText2 = sigmaText2; this.sigma2 = sigma2; } @Override public void itemStateChanged( final ItemEvent arg0 ) { if ( arg0.getStateChange() == ItemEvent.DESELECTED ) { sigmaText2.setFont( sigmaText2.getFont().deriveFont( Font.PLAIN ) ); sigma2.setBackground( inactiveColor ); enableSigma2 = false; } else if ( arg0.getStateChange() == ItemEvent.SELECTED ) { sigmaText2.setFont( sigmaText2.getFont().deriveFont( Font.BOLD ) ); sigma2.setBackground( originalColor ); enableSigma2 = true; } } } protected class MinListener implements ItemListener { @Override public void itemStateChanged( final ItemEvent arg0 ) { boolean oldState = lookForMinima; if ( arg0.getStateChange() == ItemEvent.DESELECTED ) lookForMinima = false; else if ( arg0.getStateChange() == ItemEvent.SELECTED ) lookForMinima = true; if ( lookForMinima != oldState ) { while ( isComputing ) SimpleMultiThreading.threadWait( 10 ); updatePreview( ValueChange.MINMAX ); } } } protected class MaxListener implements ItemListener { @Override public void itemStateChanged( final ItemEvent arg0 ) { boolean oldState = lookForMaxima; if ( arg0.getStateChange() == ItemEvent.DESELECTED ) lookForMaxima = false; else if ( arg0.getStateChange() == ItemEvent.SELECTED ) lookForMaxima = true; if ( lookForMaxima != oldState ) { while ( isComputing ) SimpleMultiThreading.threadWait( 10 ); updatePreview( ValueChange.MINMAX ); } } } /** * Tests whether the ROI was changed and will recompute the preview * * @author Stephan Preibisch */ protected class RoiListener implements MouseListener { @Override public void mouseClicked(MouseEvent e) {} @Override public void mouseEntered(MouseEvent e) {} @Override public void mouseExited(MouseEvent e) {} @Override public void mousePressed(MouseEvent e) {} @Override public void mouseReleased( final MouseEvent e ) { // here the ROI might have been modified, let's test for that final Roi roi = imp.getRoi(); if ( roi == null || roi.getType() != Roi.RECTANGLE ) return; while ( isComputing ) SimpleMultiThreading.threadWait( 10 ); updatePreview( ValueChange.ROI ); } } protected class ApplyButtonListener implements ActionListener { @Override public void actionPerformed( final ActionEvent arg0 ) { ImagePlus imp; try { imp = source.getImagePlus(); } catch (ImgLibException e) { imp = null; e.printStackTrace(); } // convert ImgLib2 image to ImgLib1 image via the imageplus final Image< FloatType > source = ImageJFunctions.wrapFloat( imp ); IOFunctions.println( "Computing DoG ... " ); // test the parameters on the complete stack final ArrayList<DifferenceOfGaussianPeak<FloatType>> peaks = DetectionSegmentation.extractBeadsLaPlaceImgLib( source, new OutOfBoundsStrategyMirrorFactory<FloatType>(), imageSigma, sigma, sigma2, threshold, threshold/4, lookForMaxima, lookForMinima, ViewStructure.DEBUG_MAIN ); IOFunctions.println( "Drawing DoG result ... " ); // display as extra image Image<FloatType> detections = source.createNewImage(); final LocalizableByDimCursor<FloatType> c = detections.createLocalizableByDimCursor(); for ( final DifferenceOfGaussianPeak<FloatType> peak : peaks ) { final LocalizablePoint p = new LocalizablePoint( new float[]{ peak.getSubPixelPosition( 0 ), peak.getSubPixelPosition( 1 ), peak.getSubPixelPosition( 2 ) } ); c.setPosition( p ); c.getType().set( 1 ); } IOFunctions.println( "Convolving DoG result ... " ); final GaussianConvolutionReal<FloatType> gauss = new GaussianConvolutionReal<FloatType>( detections, new OutOfBoundsStrategyValueFactory<FloatType>(), 2 ); gauss.process(); detections = gauss.getResult(); IOFunctions.println( "Showing DoG result ... " ); ImageJFunctions.show( detections ); } } protected class FinishedButtonListener implements ActionListener { final Frame parent; final boolean cancel; public FinishedButtonListener( Frame parent, final boolean cancel ) { this.parent = parent; this.cancel = cancel; } @Override public void actionPerformed( final ActionEvent arg0 ) { wasCanceled = cancel; close( parent, sliceObserver, imp, roiListener ); } } protected class FrameListener extends WindowAdapter { final Frame parent; public FrameListener( Frame parent ) { super(); this.parent = parent; } @Override public void windowClosing (WindowEvent e) { close( parent, sliceObserver, imp, roiListener ); } } protected final void close( final Frame parent, final SliceObserver sliceObserver, final ImagePlus imp, final RoiListener roiListener ) { if ( parent != null ) parent.dispose(); if ( sliceObserver != null ) sliceObserver.unregister(); if ( imp != null ) { if ( roiListener != null ) imp.getCanvas().removeMouseListener( roiListener ); imp.getOverlay().clear(); imp.updateAndDraw(); } isFinished = true; } protected class Sigma2Listener implements AdjustmentListener { final float min, max; final int scrollbarSize; final Scrollbar sigmaScrollbar2; final Label sigma2Label; public Sigma2Listener( final float min, final float max, final int scrollbarSize, final Scrollbar sigmaScrollbar2, final Label sigma2Label ) { this.min = min; this.max = max; this.scrollbarSize = scrollbarSize; this.sigmaScrollbar2 = sigmaScrollbar2; this.sigma2Label = sigma2Label; } @Override public void adjustmentValueChanged( final AdjustmentEvent event ) { if ( enableSigma2 ) { sigma2 = computeValueFromScrollbarPosition( event.getValue(), min, max, scrollbarSize ); if ( sigma2 < sigma ) { sigma2 = sigma + 0.001f; sigmaScrollbar2.setValue( computeScrollbarPositionFromValue( sigma2, min, max, scrollbarSize ) ); } sigma2Label.setText( "Sigma 2 = " + sigma2 ); if ( !event.getValueIsAdjusting() ) { while ( isComputing ) { SimpleMultiThreading.threadWait( 10 ); } updatePreview( ValueChange.SIGMA ); } } else { // if no manual adjustment simply reset it sigmaScrollbar2.setValue( computeScrollbarPositionFromValue( sigma2, min, max, scrollbarSize ) ); } } } protected class SigmaListener implements AdjustmentListener { final Label label; final float min, max; final int scrollbarSize; final Scrollbar sigmaScrollbar1; final Scrollbar sigmaScrollbar2; final Label sigmaText2; public SigmaListener( final Label label, final float min, final float max, final int scrollbarSize, final Scrollbar sigmaScrollbar1, final Scrollbar sigmaScrollbar2, final Label sigmaText2 ) { this.label = label; this.min = min; this.max = max; this.scrollbarSize = scrollbarSize; this.sigmaScrollbar1 = sigmaScrollbar1; this.sigmaScrollbar2 = sigmaScrollbar2; this.sigmaText2 = sigmaText2; } @Override public void adjustmentValueChanged( final AdjustmentEvent event ) { sigma = computeValueFromScrollbarPosition( event.getValue(), min, max, scrollbarSize ); if ( !enableSigma2 ) { sigma2 = computeSigma2( sigma, sensitivity ); sigmaText2.setText( "Sigma 2 = " + sigma2 ); sigmaScrollbar2.setValue( computeScrollbarPositionFromValue( sigma2, min, max, scrollbarSize ) ); } else if ( sigma > sigma2 ) { sigma = sigma2 - 0.001f; sigmaScrollbar1.setValue( computeScrollbarPositionFromValue( sigma, min, max, scrollbarSize ) ); } label.setText( "Sigma 1 = " + sigma ); if ( !event.getValueIsAdjusting() ) { while ( isComputing ) { SimpleMultiThreading.threadWait( 10 ); } updatePreview( ValueChange.SIGMA ); } } } protected static float computeValueFromScrollbarPosition( final int scrollbarPosition, final float min, final float max, final int scrollbarSize ) { return min + (scrollbarPosition/(float)scrollbarSize) * (max-min); } protected static int computeScrollbarPositionFromValue( final float sigma, final float min, final float max, final int scrollbarSize ) { return Util.round( ((sigma - min)/(max-min)) * scrollbarSize ); } protected class ThresholdListener implements AdjustmentListener { final Label label; final float min, max; final float log1001 = (float)Math.log10(1001); public ThresholdListener( final Label label, final float min, final float max ) { this.label = label; this.min = min; this.max = max; } @Override public void adjustmentValueChanged( final AdjustmentEvent event ) { threshold = min + ( (log1001 - (float)Math.log10(1001-event.getValue()))/log1001 ) * (max-min); label.setText( "Threshold = " + threshold ); if ( !isComputing ) { updatePreview( ValueChange.THRESHOLD ); } else if ( !event.getValueIsAdjusting() ) { while ( isComputing ) { SimpleMultiThreading.threadWait( 10 ); } updatePreview( ValueChange.THRESHOLD ); } } } protected class ImagePlusListener implements SliceListener { @Override public void sliceChanged(ImagePlus arg0) { if ( isStarted ) { while ( isComputing ) { SimpleMultiThreading.threadWait( 10 ); } updatePreview( ValueChange.SLICE ); } } } public static void main( String[] args ) { new ImageJ(); ImagePlus imp = new Opener().openImage( "/home/preibisch/Documents/Microscopy/SPIM/Harvard/f11e6/exp3/img_Ch0_Angle0.tif.zip" ); //ImagePlus imp = new Opener().openImage( "D:/Documents and Settings/Stephan/My Documents/Downloads/1-315--0.08-isotropic-subvolume/1-315--0.08-isotropic-subvolume.tif" ); imp.show(); imp.setSlice( 27 ); imp.setRoi( imp.getWidth()/4, imp.getHeight()/4, imp.getWidth()/2, imp.getHeight()/2 ); new InteractiveDoG().run( null ); } }
Java
<?php $name='KievitCyr-ExtraBold'; $type='TTF'; $desc=array ( 'Ascent' => 872, 'Descent' => -250, 'CapHeight' => 872, 'Flags' => 262148, 'FontBBox' => '[-56 -250 1278 872]', 'ItalicAngle' => 0, 'StemV' => 165, 'MissingWidth' => 566, ); $up=-143; $ut=20; $ttffile='C:/wamp/www/alfakasko/mpdf/ttfonts/KvCyXb_.ttf'; $TTCfontID='0'; $originalsize=20632; $sip=false; $smp=false; $BMPselected=false; $fontkey='kievitB'; $panose=' 0 0 2 0 8 3 0 0 0 0 0 0'; $haskerninfo=false; $unAGlyphs=false; ?>
Java
#ifndef __EVENT_BROWSER_TAB_INDICES_GET_ALL_H__ #define __EVENT_BROWSER_TAB_INDICES_GET_ALL_H__ /*LICENSE_START*/ /* * Copyright (C) 2014 Washington University School of Medicine * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /*LICENSE_END*/ #include "Event.h" namespace caret { class EventBrowserTabIndicesGetAll : public Event { public: EventBrowserTabIndicesGetAll(); virtual ~EventBrowserTabIndicesGetAll(); void addBrowserTabIndex(const int32_t browserTabIndex); std::vector<int32_t> getAllBrowserTabIndices() const; bool isValidBrowserTabIndex(const int32_t browserTabIndex); // ADD_NEW_METHODS_HERE private: EventBrowserTabIndicesGetAll(const EventBrowserTabIndicesGetAll&); EventBrowserTabIndicesGetAll& operator=(const EventBrowserTabIndicesGetAll&); std::vector<int32_t> m_browserTabIndices; // ADD_NEW_MEMBERS_HERE }; #ifdef __EVENT_BROWSER_TAB_INDICES_GET_ALL_DECLARE__ // <PLACE DECLARATIONS OF STATIC MEMBERS HERE> #endif // __EVENT_BROWSER_TAB_INDICES_GET_ALL_DECLARE__ } // namespace #endif //__EVENT_BROWSER_TAB_INDICES_GET_ALL_H__
Java
/** * \file * \brief Common IPC interface. * \ingroup l4_api */ /* * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>, * Alexander Warg <warg@os.inf.tu-dresden.de>, * Björn Döbel <doebel@os.inf.tu-dresden.de>, * Torsten Frenzel <frenzel@os.inf.tu-dresden.de> * economic rights: Technische Universität Dresden (Germany) * * This file is part of TUD:OS and distributed under the terms of the * GNU General Public License 2. * Please see the COPYING-GPL-2 file for details. * * As a special exception, you may use this file as part of a free software * library without restriction. Specifically, if other files instantiate * templates or use macros or inline functions from this file, or you compile * this file and link it with other files to produce an executable, this * file does not by itself cause the resulting executable to be covered by * the GNU General Public License. This exception does not however * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. */ #ifndef __L4SYS__INCLUDE__L4API_FIASCO__IPC_H__ #define __L4SYS__INCLUDE__L4API_FIASCO__IPC_H__ #include <l4/sys/types.h> #include <l4/sys/utcb.h> #include <l4/sys/err.h> /** * \defgroup l4_ipc_api Object Invocation * \ingroup l4_api * \brief API for L4 object invocation. * * <c>\#include <l4/sys/ipc.h></c> * * General abstractions for L4 object invocation. The basic principle is that * all objects are denoted by a capability that is accessed via a capability * selector (see \link l4_cap_api Capabilities \endlink). * * This set of functions is common to all kinds of objects provided by the * L4 micro kernel. The concrete semantics of an invocation depends on the * object that shall be invoked. * * Objects may be invoked in various ways, the most common way is to use * a \em call operation (l4_ipc_call()). However, there are a lot more * flavours available that have a semantics depending on the object. * * \see \ref l4_kernel_object_gate_api * */ /***************************************************************************** *** IPC result checking *****************************************************************************/ /** * \defgroup l4_ipc_err_api Error Handling * \ingroup l4_ipc_api * \brief Error handling for L4 object invocation. * * <c>\#include <l4/sys/ipc.h></c> */ /** * \brief Error codes in the \em error TCR. * \ingroup l4_ipc_err_api * * The error codes are accessible via the \em error TCR, see * #l4_thread_regs_t.error. */ enum l4_ipc_tcr_error_t { L4_IPC_ERROR_MASK = 0x1F, /**< Mask for error bits. */ L4_IPC_SND_ERR_MASK = 0x01, /**< Send error mask. */ L4_IPC_ENOT_EXISTENT = 0x04, /**< Non-existing destination or source. ** \ingroup l4_ipc_api **/ L4_IPC_RETIMEOUT = 0x03, /**< Timeout during receive operation. ** \ingroup l4_ipc_api **/ L4_IPC_SETIMEOUT = 0x02, /**< Timeout during send operation. ** \ingroup l4_ipc_api **/ L4_IPC_RECANCELED = 0x07, /**< Receive operation canceled. ** \ingroup l4_ipc_api **/ L4_IPC_SECANCELED = 0x06, /**< Send operation canceled. ** \ingroup l4_ipc_api **/ L4_IPC_REMAPFAILED = 0x11, /**< Map flexpage failed in receive ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_SEMAPFAILED = 0x10, /**< Map flexpage failed in send operation. ** \ingroup l4_ipc_api **/ L4_IPC_RESNDPFTO = 0x0b, /**< Send-pagefault timeout in receive ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_SESNDPFTO = 0x0a, /**< Send-pagefault timeout in send ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_RERCVPFTO = 0x0d, /**< Receive-pagefault timeout in receive ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_SERCVPFTO = 0x0c, /**< Receive-pagefault timeout in send ** operation. ** \ingroup l4_ipc_api **/ L4_IPC_REABORTED = 0x0f, /**< Receive operation aborted. ** \ingroup l4_ipc_api **/ L4_IPC_SEABORTED = 0x0e, /**< Send operation aborted. ** \ingroup l4_ipc_api **/ L4_IPC_REMSGCUT = 0x09, /**< Cut receive message, due to ** message buffer is too small. ** \ingroup l4_ipc_api **/ L4_IPC_SEMSGCUT = 0x08, /**< Cut send message. due to ** message buffer is too small, ** \ingroup l4_ipc_api **/ }; /** * \brief Get the error code for an object invocation. * \ingroup l4_ipc_err_api * * \param tag Return value of the invocation. * \param utcb UTCB that was used for the invocation. * * \return 0 if no error condition is set, * error code otherwise (see #l4_ipc_tcr_error_t). */ L4_INLINE l4_umword_t l4_ipc_error(l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW; /** * \brief Return error code of a system call return message tag. * \ingroup l4_ipc_err_api * \param tag System call return message type * \return 0 for no error, error number in case of error */ L4_INLINE long l4_error(l4_msgtag_t tag) L4_NOTHROW; L4_INLINE long l4_error_u(l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW; /***************************************************************************** *** IPC results *****************************************************************************/ /** * \brief Returns whether an error occurred in send phase of an invocation. * \ingroup l4_ipc_err_api * * \pre l4_msgtag_has_error(tag) == true * \param utcb UTCB to check. * * \return Boolean value. */ L4_INLINE int l4_ipc_is_snd_error(l4_utcb_t *utcb) L4_NOTHROW; /** * \brief Returns whether an error occurred in receive phase of an invocation. * \ingroup l4_ipc_err_api * * \pre l4_msgtag_has_error(tag) == true * \param utcb UTCB to check. * * \return Boolean value. */ L4_INLINE int l4_ipc_is_rcv_error(l4_utcb_t *utcb) L4_NOTHROW; /** * \brief Get the error condition of the last invocation from the TCR. * \ingroup l4_ipc_err_api * * \pre l4_msgtag_has_error(tag) == true * \param utcb UTCB to check. * * \return Error condition of type l4_ipc_tcr_error_t. */ L4_INLINE int l4_ipc_error_code(l4_utcb_t *utcb) L4_NOTHROW; /***************************************************************************** *** IPC calls *****************************************************************************/ /** * \brief Send a message to an object (do \b not wait for a reply). * \ingroup l4_ipc_api * * \param dest Capability selector for the destination object. * \param utcb UTCB of the caller. * \param tag Descriptor for the message to be sent. * \param timeout Timeout pair (see #l4_timeout_t) only send part is relevant. * * \return result tag * * A message is sent to the destination object. There is no receive phase * included. The invoker continues working after sending the message. * * \attention This is a special-purpose message transfer, objects usually * support only invocation via l4_ipc_call(). */ L4_INLINE l4_msgtag_t l4_ipc_send(l4_cap_idx_t dest, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Wait for an incoming message from any possible sender. * \ingroup l4_ipc_api * * \param utcb UTCB of the caller. * \retval label Label assigned to the source object (IPC gate or IRQ). * \param timeout Timeout pair (see #l4_timeout_t, only the receive part is * used). * * \return return tag * * This operation does an open wait, and therefore needs no capability to * denote the possible source of a message. This means the calling thread * waits for an incoming message from any possible source. * There is no send phase included in this operation. * * The usual usage of this function is to call that function when entering a * server loop in a user-level server that implements user-level objects, * see also #l4_ipc_reply_and_wait(). */ L4_INLINE l4_msgtag_t l4_ipc_wait(l4_utcb_t *utcb, l4_umword_t *label, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Wait for a message from a specific source. * \ingroup l4_ipc_api * * \param object Object to receive a message from. * \param timeout Timeout pair (see #l4_timeout_t, only the receive part * matters). * \param utcb UTCB of the caller. * * \return result tag. * * This operation waits for a message from the specified object. Messages from * other sources are not accepted by this operation. The operation does not * include a send phase, this means no message is sent to the object. * * \note This operation is usually used to receive messages from a specific IRQ * or thread. However, it is not common to use this operation for normal * applications. */ L4_INLINE l4_msgtag_t l4_ipc_receive(l4_cap_idx_t object, l4_utcb_t *utcb, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Object call (usual invocation). * \ingroup l4_ipc_api * * \param object Capability selector for the object to call. * \param utcb UTCB of the caller. * \param tag Message tag to describe the message to be sent. * \param timeout Timeout pair for send an receive phase (see #l4_timeout_t). * * \return result tag * * A message is sent to the object and the invoker waits for a * reply from the object. Messages from other sources are not accepted. * \note The send-to-receive transition needs no time, the object can reply * with a send timeout of zero. */ L4_INLINE l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Reply and wait operation (uses the \em reply capability). * \ingroup l4_ipc_api * * \param tag Describes the message to be sent as reply. * \param utcb UTCB of the caller. * \retval label Label assigned to the source object of the received message. * \param timeout Timeout pair (see #l4_timeout_t). * \return result tag * * A message is sent to the previous caller using the implicit reply * capability. Afterwards the invoking thread waits for a message from any * source. * \note This is the standard server operation: it sends a reply to the actual * client and waits for the next incoming request, which may come from * any other client. */ L4_INLINE l4_msgtag_t l4_ipc_reply_and_wait(l4_utcb_t *utcb, l4_msgtag_t tag, l4_umword_t *label, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Send a message and do an open wait. * \ingroup l4_ipc_api * * \param dest Object to send a message to. * \param utcb UTCB of the caller. * \param tag Describes the message that shall be sent. * \retval label Label assigned to the source object of the receive phase. * \param timeout Timeout pair (see #l4_timeout_t). * \return result tag * * A message is sent to the destination object and the invoking thread waits * for a reply from any source. * * \note This is a special-purpose operation and shall not be used in general * applications. */ L4_INLINE l4_msgtag_t l4_ipc_send_and_wait(l4_cap_idx_t dest, l4_utcb_t *utcb, l4_msgtag_t tag, l4_umword_t *label, l4_timeout_t timeout) L4_NOTHROW; /** * \defgroup l4_ipc_rt_api Realtime API * \ingroup l4_ipc_api * \internal */ #if 0 /** * Wait for next period. * \ingroup l4_ipc_rt_api * * \param utcb UTCB of the caller. * \param label Label * \param timeout IPC timeout (see #l4_ipc_timeout). * * \return result tag */ L4_INLINE l4_msgtag_t l4_ipc_wait_next_period(l4_utcb_t *utcb, l4_umword_t *label, l4_timeout_t timeout); #endif /** * \brief Generic L4 object invocation. * \ingroup l4_ipc_api * * \param dest Destination object. * \param utcb UTCB of the caller. * \param flags Invocation flags (see #l4_syscall_flags_t). * \param slabel Send label if applicable (may be seen by the receiver). * \param tag Sending message tag. * \retval rlabel Receiving label. * \param timeout Timeout pair (see #l4_timeout_t). * * \return return tag */ L4_INLINE l4_msgtag_t l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb, l4_umword_t flags, l4_umword_t slabel, l4_msgtag_t tag, l4_umword_t *rlabel, l4_timeout_t timeout) L4_NOTHROW; /** * \brief Sleep for an amount of time. * \ingroup l4_ipc_api * * \param timeout Timeout pair (see #l4_timeout_t, the receive part matters). * * \return error code: * - #L4_IPC_RETIMEOUT: success * - #L4_IPC_RECANCELED woken up by a different thread * (l4_thread_ex_regs()). * * The invoking thread waits until the timeout * is expired or the wait was aborted by another thread by l4_thread_ex_regs(). */ L4_INLINE l4_msgtag_t l4_ipc_sleep(l4_timeout_t timeout) L4_NOTHROW; /** * \brief Add a flex-page to be sent to the UTCB * \ingroup l4_ipc_api * * \param snd_fpage Flex-page. * \param snd_base Send base. * \param tag Tag to be modified. * \retval tag Modified tag, the number of items will be increased, * all other values in the tag will be retained. * * \return 0 on success, negative error code otherwise */ L4_INLINE int l4_sndfpage_add(l4_fpage_t const snd_fpage, unsigned long snd_base, l4_msgtag_t *tag) L4_NOTHROW; /* * \internal * \ingroup l4_ipc_api */ L4_INLINE int l4_sndfpage_add_u(l4_fpage_t const snd_fpage, unsigned long snd_base, l4_msgtag_t *tag, l4_utcb_t *utcb) L4_NOTHROW; /************************************************************************ * Implementations **********************/ L4_INLINE l4_umword_t l4_ipc_error(l4_msgtag_t tag, l4_utcb_t *utcb) L4_NOTHROW { if (!l4_msgtag_has_error(tag)) return 0; return l4_utcb_tcr_u(utcb)->error & L4_IPC_ERROR_MASK; } L4_INLINE long l4_error_u(l4_msgtag_t tag, l4_utcb_t *u) L4_NOTHROW { if (l4_msgtag_has_error(tag)) return -(L4_EIPC_LO + (l4_utcb_tcr_u(u)->error & L4_IPC_ERROR_MASK)); return l4_msgtag_label(tag); } L4_INLINE long l4_error(l4_msgtag_t tag) L4_NOTHROW { return l4_error_u(tag, l4_utcb()); } L4_INLINE int l4_ipc_is_snd_error(l4_utcb_t *u) L4_NOTHROW { return !(l4_utcb_tcr_u(u)->error & 1) == 0; } L4_INLINE int l4_ipc_is_rcv_error(l4_utcb_t *u) L4_NOTHROW { return l4_utcb_tcr_u(u)->error & 1; } L4_INLINE int l4_ipc_error_code(l4_utcb_t *u) L4_NOTHROW { return l4_utcb_tcr_u(u)->error & L4_IPC_ERROR_MASK; } /* * \internal * \ingroup l4_ipc_api */ L4_INLINE int l4_sndfpage_add_u(l4_fpage_t const snd_fpage, unsigned long snd_base, l4_msgtag_t *tag, l4_utcb_t *utcb) L4_NOTHROW { l4_msg_regs_t *v = l4_utcb_mr_u(utcb); int i = l4_msgtag_words(*tag) + 2 * l4_msgtag_items(*tag); if (i >= L4_UTCB_GENERIC_DATA_SIZE - 1) return -L4_ENOMEM; v->mr[i] = snd_base | L4_ITEM_MAP | L4_ITEM_CONT; v->mr[i + 1] = snd_fpage.raw; *tag = l4_msgtag(l4_msgtag_label(*tag), l4_msgtag_words(*tag), l4_msgtag_items(*tag) + 1, l4_msgtag_flags(*tag)); return 0; } L4_INLINE int l4_sndfpage_add(l4_fpage_t const snd_fpage, unsigned long snd_base, l4_msgtag_t *tag) L4_NOTHROW { return l4_sndfpage_add_u(snd_fpage, snd_base, tag, l4_utcb()); } #endif /* ! __L4SYS__INCLUDE__L4API_FIASCO__IPC_H__ */
Java
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 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; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Written by Sergei A. Golubchik, who has a shared copyright to this code */ #include "ftdefs.h" typedef struct st_ft_docstat { FT_WORD *list; uint uniq; double sum; } FT_DOCSTAT; typedef struct st_my_ft_parser_param { TREE *wtree; MEM_ROOT *mem_root; } MY_FT_PARSER_PARAM; static int FT_WORD_cmp(CHARSET_INFO* cs, FT_WORD *w1, FT_WORD *w2) { return ha_compare_text(cs, (uchar*) w1->pos, w1->len, (uchar*) w2->pos, w2->len, 0); } static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat) { word->weight=LWS_IN_USE; docstat->sum+=word->weight; memcpy((docstat->list)++, word, sizeof(FT_WORD)); return 0; } /* transforms tree of words into the array, applying normalization */ FT_WORD * ft_linearize(TREE *wtree, MEM_ROOT *mem_root) { FT_WORD *wlist,*p; FT_DOCSTAT docstat; DBUG_ENTER("ft_linearize"); if ((wlist=(FT_WORD *) alloc_root(mem_root, sizeof(FT_WORD)* (1+wtree->elements_in_tree)))) { docstat.list=wlist; docstat.uniq=wtree->elements_in_tree; docstat.sum=0; tree_walk(wtree,(tree_walk_action)&walk_and_copy,&docstat,left_root_right); } delete_tree(wtree, 0); if (!wlist) DBUG_RETURN(NULL); docstat.list->pos=NULL; for (p=wlist;p->pos;p++) { p->weight=PRENORM_IN_USE; } for (p=wlist;p->pos;p++) { p->weight/=NORM_IN_USE; } DBUG_RETURN(wlist); } my_bool ft_boolean_check_syntax_string(const uchar *str) { uint i, j; if (!str || (strlen((char*) str)+1 != sizeof(DEFAULT_FTB_SYNTAX)) || (str[0] != ' ' && str[1] != ' ')) return 1; for (i=0; i<sizeof(DEFAULT_FTB_SYNTAX); i++) { /* limiting to 7-bit ascii only */ if ((unsigned char)(str[i]) > 127 || my_isalnum(default_charset_info, str[i])) return 1; for (j=0; j<i; j++) if (str[i] == str[j] && (i != 11 || j != 10)) return 1; } return 0; } /* RETURN VALUE 0 - eof 1 - word found 2 - left bracket 3 - right bracket 4 - stopword found */ uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end, FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param) { const uchar *doc=*start; int ctype; uint mwc, length; int mbl; param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0); param->weight_adjust= param->wasign= 0; param->type= FT_TOKEN_EOF; while (doc<end) { for (; doc < end; doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); if (true_word_char(ctype, *doc)) break; if (*doc == FTB_RQUOT && param->quot) { *start=doc+1; param->type= FT_TOKEN_RIGHT_PAREN; goto ret; } if (!param->quot) { if (*doc == FTB_LBR || *doc == FTB_RBR || *doc == FTB_LQUOT) { /* param->prev=' '; */ *start=doc+1; if (*doc == FTB_LQUOT) param->quot= (char*) 1; param->type= (*doc == FTB_RBR ? FT_TOKEN_RIGHT_PAREN : FT_TOKEN_LEFT_PAREN); goto ret; } if (param->prev == ' ') { if (*doc == FTB_YES ) { param->yesno=+1; continue; } else if (*doc == FTB_EGAL) { param->yesno= 0; continue; } else if (*doc == FTB_NO ) { param->yesno=-1; continue; } else if (*doc == FTB_INC ) { param->weight_adjust++; continue; } else if (*doc == FTB_DEC ) { param->weight_adjust--; continue; } else if (*doc == FTB_NEG ) { param->wasign= !param->wasign; continue; } } } param->prev=*doc; param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0); param->weight_adjust= param->wasign= 0; } mwc=length=0; for (word->pos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); if (true_word_char(ctype, *doc)) mwc=0; else if (!misc_word_char(*doc) || mwc) break; else mwc++; } param->prev='A'; /* be sure *prev is true_word_char */ word->len= (uint)(doc-word->pos) - mwc; if ((param->trunc=(doc<end && *doc == FTB_TRUNC))) doc++; if (((length >= ft_min_word_len && !is_stopword((char*) word->pos, word->len)) || param->trunc) && length < ft_max_word_len) { *start=doc; param->type= FT_TOKEN_WORD; goto ret; } else if (length) /* make sure length > 0 (if start contains spaces only) */ { *start= doc; param->type= FT_TOKEN_STOPWORD; goto ret; } } if (param->quot) { *start= doc; param->type= 3; /* FT_RBR */ goto ret; } ret: return param->type; } uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end, FT_WORD *word, my_bool skip_stopwords) { uchar *doc= *start; uint mwc, length; int mbl; int ctype; DBUG_ENTER("ft_simple_get_word"); do { for (;; doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { if (doc >= end) DBUG_RETURN(0); mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); if (true_word_char(ctype, *doc)) break; } mwc= length= 0; for (word->pos= doc; doc < end; length++, doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1))) { mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end); if (true_word_char(ctype, *doc)) mwc= 0; else if (!misc_word_char(*doc) || mwc) break; else mwc++; } word->len= (uint)(doc-word->pos) - mwc; if (skip_stopwords == FALSE || (length >= ft_min_word_len && length < ft_max_word_len && !is_stopword((char*) word->pos, word->len))) { *start= doc; DBUG_RETURN(1); } } while (doc < end); DBUG_RETURN(0); } void ft_parse_init(TREE *wtree, CHARSET_INFO *cs) { DBUG_ENTER("ft_parse_init"); if (!is_tree_inited(wtree)) init_tree(wtree, 0, 0, sizeof(FT_WORD), (qsort_cmp2)&FT_WORD_cmp, 0, (void*)cs, MYF(0)); DBUG_VOID_RETURN; } static int ft_add_word(MYSQL_FTPARSER_PARAM *param, const char *word, int word_len, MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused))) { TREE *wtree; FT_WORD w; MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam; DBUG_ENTER("ft_add_word"); wtree= ft_param->wtree; if (param->flags & MYSQL_FTFLAGS_NEED_COPY) { uchar *ptr; DBUG_ASSERT(wtree->with_delete == 0); ptr= (uchar *)alloc_root(ft_param->mem_root, word_len); memcpy(ptr, word, word_len); w.pos= ptr; } else w.pos= (uchar*) word; w.len= word_len; if (!tree_insert(wtree, &w, 0, wtree->custom_arg)) { delete_tree(wtree, 0); DBUG_RETURN(1); } DBUG_RETURN(0); } static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param, const char *doc_arg, int doc_len) { uchar *doc= (uchar*) doc_arg; uchar *end= doc + doc_len; MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam; TREE *wtree= ft_param->wtree; FT_WORD w; DBUG_ENTER("ft_parse_internal"); while (ft_simple_get_word(wtree->custom_arg, &doc, end, &w, TRUE)) if (param->mysql_add_word(param, (char*) w.pos, w.len, 0)) DBUG_RETURN(1); DBUG_RETURN(0); } int ft_parse(TREE *wtree, uchar *doc, int doclen, struct st_mysql_ftparser *parser, MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root) { MY_FT_PARSER_PARAM my_param; DBUG_ENTER("ft_parse"); DBUG_ASSERT(parser); my_param.wtree= wtree; my_param.mem_root= mem_root; param->mysql_parse= ft_parse_internal; param->mysql_add_word= ft_add_word; param->mysql_ftparam= &my_param; param->cs= wtree->custom_arg; param->doc= (char*) doc; param->length= doclen; param->mode= MYSQL_FTPARSER_SIMPLE_MODE; DBUG_RETURN(parser->parse(param)); } #define MAX_PARAM_NR 2 MYSQL_FTPARSER_PARAM* ftparser_alloc_param(MI_INFO *info) { if (!info->ftparser_param) { /* . info->ftparser_param can not be zero after the initialization, because it always includes built-in fulltext parser. And built-in parser can be called even if the table has no fulltext indexes and no varchar/text fields. ftb_find_relevance... parser (ftb_find_relevance_parse, ftb_find_relevance_add_word) calls ftb_check_phrase... parser (ftb_check_phrase_internal, ftb_phrase_add_word). Thus MAX_PARAM_NR=2. */ info->ftparser_param= (MYSQL_FTPARSER_PARAM *) my_malloc(MAX_PARAM_NR * sizeof(MYSQL_FTPARSER_PARAM) * info->s->ftkeys, MYF(MY_WME | MY_ZEROFILL)); init_alloc_root(&info->ft_memroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0, MYF(0)); } return info->ftparser_param; } MYSQL_FTPARSER_PARAM *ftparser_call_initializer(MI_INFO *info, uint keynr, uint paramnr) { uint32 ftparser_nr; struct st_mysql_ftparser *parser; if (!ftparser_alloc_param(info)) return 0; if (keynr == NO_SUCH_KEY) { ftparser_nr= 0; parser= &ft_default_parser; } else { ftparser_nr= info->s->keyinfo[keynr].ftkey_nr; parser= info->s->keyinfo[keynr].parser; } DBUG_ASSERT(paramnr < MAX_PARAM_NR); ftparser_nr= ftparser_nr*MAX_PARAM_NR + paramnr; if (! info->ftparser_param[ftparser_nr].mysql_add_word) { /* Note, that mysql_add_word is used here as a flag: mysql_add_word == 0 - parser is not initialized mysql_add_word != 0 - parser is initialized, or no initialization needed. */ info->ftparser_param[ftparser_nr].mysql_add_word= (int (*)(struct st_mysql_ftparser_param *, const char *, int, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1; if (parser->init && parser->init(&info->ftparser_param[ftparser_nr])) return 0; } return &info->ftparser_param[ftparser_nr]; } void ftparser_call_deinitializer(MI_INFO *info) { uint i, j, keys= info->s->state.header.keys; free_root(&info->ft_memroot, MYF(0)); if (! info->ftparser_param) return; for (i= 0; i < keys; i++) { MI_KEYDEF *keyinfo= &info->s->keyinfo[i]; for (j=0; j < MAX_PARAM_NR; j++) { MYSQL_FTPARSER_PARAM *ftparser_param= &info->ftparser_param[keyinfo->ftkey_nr * MAX_PARAM_NR + j]; if (keyinfo->flag & HA_FULLTEXT && ftparser_param->mysql_add_word) { if (keyinfo->parser->deinit) keyinfo->parser->deinit(ftparser_param); ftparser_param->mysql_add_word= 0; } else break; } } }
Java
<?php /** * File containing ezcomNotification class * * @copyright Copyright (C) 1999-2011 eZ Systems AS. All rights reserved. * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2 * */ /** * ezcomNotification persistent object class definition * */ class ezcomNotification extends eZPersistentObject { /** * Construct, use {@link ezcomNotification::create()} to create new objects. * * @param array $row */ public function __construct( $row ) { parent::__construct( $row ); } /** * Fields definition * * @return array */ public static function definition() { static $def = array( 'fields' => array( 'id' => array( 'name' => 'ID', 'datatype' => 'integer', 'default' => 0, 'required' => true ), 'contentobject_id' => array( 'name' => 'ContentObjectID', 'datatype' => 'integer', 'default' => 0, 'required' => true ), 'language_id' => array( 'name' => 'LanguageID', 'datatype' => 'integer', 'default' => 0, 'required' => true ), 'send_time' => array( 'name' => 'SendTime', 'datatype' => 'integer', 'default' => 0, 'required' => true ), 'status' => array( 'name' => 'Status', 'datatype' => 'integer', 'default' => 1, 'required' => true ), 'comment_id' => array( 'name' => 'CommentID', 'datatype' => 'integer', 'default' => 0, 'required' => true ) ), 'keys' => array( 'id' ), 'function_attributes' => array(), 'increment_key' => 'id', 'class_name' => 'ezcomNotification', 'name' => 'ezcomment_notification' ); return $def; } /** * Create new ezcomNotification object * * @static * @param array $row * @return ezcomNotification */ public static function create( $row = array() ) { $object = new self( $row ); return $object; } /** * Fetch notification by given id * * @param int $id * @return null|ezcomNotification */ static function fetch( $id ) { $cond = array( 'id' => $id ); $return = eZPersistentObject::fetchObject( self::definition(), null, $cond ); return $return; } /** * Fetch the list of notification * @param $length: count of the notification to be fetched * @param $status: the status of the notification * @param $offset: offset * @return notification list */ static function fetchNotificationList( $status = 1, $length = null, $offset = 0, $sorts = null ) { $cond = array(); if ( is_null( $status ) ) { $cond = null; } else { $cond['status'] = $status; } $limit = array(); if ( is_null( $length ) ) { $limit = null; } else { $limit['offset'] = $offset; $limit['length'] = $length; } return eZPersistentObject::fetchObjectList( self::definition(), null, $cond, $sorts, $limit ); } /** * clean up the notification quque * @param unknown_type $contentObjectID * @param unknown_type $languageID * @param unknown_type $commentID * @return unknown_type */ public static function cleanUpNotification( $contentObjectID, $language ) { //1. fetch the queue, judge if there is data // } } ?>
Java
/* * linux/fs/ext4/ialloc.c * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * BSD ufs-inspired inode and directory allocation by * Stephen Tweedie (sct@redhat.com), 1993 * Big-endian to little-endian byte-swapping/bitmaps by * David S. Miller (davem@caip.rutgers.edu), 1995 */ #include <linux/time.h> #include <linux/fs.h> #include <linux/jbd2.h> #include <linux/stat.h> #include <linux/string.h> #include <linux/quotaops.h> #include <linux/buffer_head.h> #include <linux/random.h> #include <linux/bitops.h> #include <linux/blkdev.h> #include <asm/byteorder.h> #include "ext4.h" #include "ext4_jbd2.h" #include "xattr.h" #include "acl.h" #include <trace/events/ext4.h> /* * ialloc.c contains the inodes allocation and deallocation routines */ /* * The free inodes are managed by bitmaps. A file system contains several * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap * block for inodes, N blocks for the inode table and data blocks. * * The file system contains group descriptors which are located after the * super block. Each descriptor contains the number of the bitmap block and * the free blocks count in the block. */ /* * To avoid calling the atomic setbit hundreds or thousands of times, we only * need to use it within a single byte (to ensure we get endianness right). * We can use memset for the rest of the bitmap as there are no other users. */ void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap) { int i; if (start_bit >= end_bit) return; ext4_debug("mark end bits +%d through +%d used\n", start_bit, end_bit); for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++) ext4_set_bit(i, bitmap); if (i < end_bit) memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3); } /* Initializes an uninitialized inode bitmap */ static unsigned ext4_init_inode_bitmap(struct super_block *sb, struct buffer_head *bh, ext4_group_t block_group, struct ext4_group_desc *gdp) { struct ext4_sb_info *sbi = EXT4_SB(sb); J_ASSERT_BH(bh, buffer_locked(bh)); /* If checksum is bad mark all blocks and inodes use to prevent * allocation, essentially implementing a per-group read-only flag. */ if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { ext4_error(sb, "Checksum bad for group %u", block_group); ext4_free_group_clusters_set(sb, gdp, 0); ext4_free_inodes_set(sb, gdp, 0); ext4_itable_unused_set(sb, gdp, 0); memset(bh->b_data, 0xff, sb->s_blocksize); return 0; } memset(bh->b_data, 0, (EXT4_INODES_PER_GROUP(sb) + 7) / 8); ext4_mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), sb->s_blocksize * 8, bh->b_data); return EXT4_INODES_PER_GROUP(sb); } void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate) { if (uptodate) { set_buffer_uptodate(bh); set_bitmap_uptodate(bh); } unlock_buffer(bh); put_bh(bh); } /* * Read the inode allocation bitmap for a given block_group, reading * into the specified slot in the superblock's bitmap cache. * * Return buffer_head of bitmap on success or NULL. */ static struct buffer_head * ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) { struct ext4_group_desc *desc; struct buffer_head *bh = NULL; ext4_fsblk_t bitmap_blk; desc = ext4_get_group_desc(sb, block_group, NULL); if (!desc) return NULL; bitmap_blk = ext4_inode_bitmap(sb, desc); bh = sb_getblk(sb, bitmap_blk); if (unlikely(!bh)) { ext4_error(sb, "Cannot read inode bitmap - " "block_group = %u, inode_bitmap = %llu", block_group, bitmap_blk); return NULL; } if (bitmap_uptodate(bh)) return bh; lock_buffer(bh); if (bitmap_uptodate(bh)) { unlock_buffer(bh); return bh; } ext4_lock_group(sb, block_group); if (desc->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) { ext4_init_inode_bitmap(sb, bh, block_group, desc); set_bitmap_uptodate(bh); set_buffer_uptodate(bh); ext4_unlock_group(sb, block_group); unlock_buffer(bh); return bh; } ext4_unlock_group(sb, block_group); if (buffer_uptodate(bh)) { /* * if not uninit if bh is uptodate, * bitmap is also uptodate */ set_bitmap_uptodate(bh); unlock_buffer(bh); return bh; } /* * submit the buffer_head for reading */ trace_ext4_load_inode_bitmap(sb, block_group); bh->b_end_io = ext4_end_bitmap_read; get_bh(bh); submit_bh(READ, bh); wait_on_buffer(bh); if (!buffer_uptodate(bh)) { put_bh(bh); ext4_error(sb, "Cannot read inode bitmap - " "block_group = %u, inode_bitmap = %llu", block_group, bitmap_blk); return NULL; } return bh; } /* * NOTE! When we get the inode, we're the only people * that have access to it, and as such there are no * race conditions we have to worry about. The inode * is not on the hash-lists, and it cannot be reached * through the filesystem because the directory entry * has been deleted earlier. * * HOWEVER: we must make sure that we get no aliases, * which means that we have to call "clear_inode()" * _before_ we mark the inode not in use in the inode * bitmaps. Otherwise a newly created file might use * the same inode number (not actually the same pointer * though), and then we'd have two inodes sharing the * same inode number and space on the harddisk. */ void ext4_free_inode(handle_t *handle, struct inode *inode) { struct super_block *sb = inode->i_sb; int is_directory; unsigned long ino; struct buffer_head *bitmap_bh = NULL; struct buffer_head *bh2; ext4_group_t block_group; unsigned long bit; struct ext4_group_desc *gdp; struct ext4_super_block *es; struct ext4_sb_info *sbi; int fatal = 0, err, count, cleared; if (!sb) { printk(KERN_ERR "EXT4-fs: %s:%d: inode on " "nonexistent device\n", __func__, __LINE__); return; } if (atomic_read(&inode->i_count) > 1) { ext4_msg(sb, KERN_ERR, "%s:%d: inode #%lu: count=%d", __func__, __LINE__, inode->i_ino, atomic_read(&inode->i_count)); return; } if (inode->i_nlink) { ext4_msg(sb, KERN_ERR, "%s:%d: inode #%lu: nlink=%d\n", __func__, __LINE__, inode->i_ino, inode->i_nlink); return; } sbi = EXT4_SB(sb); ino = inode->i_ino; ext4_debug("freeing inode %lu\n", ino); trace_ext4_free_inode(inode); /* * Note: we must free any quota before locking the superblock, * as writing the quota to disk may need the lock as well. */ dquot_initialize(inode); ext4_xattr_delete_inode(handle, inode); dquot_free_inode(inode); dquot_drop(inode); is_directory = S_ISDIR(inode->i_mode); /* Do this BEFORE marking the inode not in use or returning an error */ ext4_clear_inode(inode); es = EXT4_SB(sb)->s_es; if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { ext4_error(sb, "reserved or nonexistent inode %lu", ino); goto error_return; } block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb); bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb); bitmap_bh = ext4_read_inode_bitmap(sb, block_group); if (!bitmap_bh) goto error_return; BUFFER_TRACE(bitmap_bh, "get_write_access"); fatal = ext4_journal_get_write_access(handle, bitmap_bh); if (fatal) goto error_return; fatal = -ESRCH; gdp = ext4_get_group_desc(sb, block_group, &bh2); if (gdp) { BUFFER_TRACE(bh2, "get_write_access"); fatal = ext4_journal_get_write_access(handle, bh2); } ext4_lock_group(sb, block_group); cleared = ext4_test_and_clear_bit(bit, bitmap_bh->b_data); if (fatal || !cleared) { ext4_unlock_group(sb, block_group); goto out; } count = ext4_free_inodes_count(sb, gdp) + 1; ext4_free_inodes_set(sb, gdp, count); if (is_directory) { count = ext4_used_dirs_count(sb, gdp) - 1; ext4_used_dirs_set(sb, gdp, count); percpu_counter_dec(&sbi->s_dirs_counter); } gdp->bg_checksum = ext4_group_desc_csum(sbi, block_group, gdp); ext4_unlock_group(sb, block_group); percpu_counter_inc(&sbi->s_freeinodes_counter); if (sbi->s_log_groups_per_flex) { ext4_group_t f = ext4_flex_group(sbi, block_group); atomic_inc(&sbi->s_flex_groups[f].free_inodes); if (is_directory) atomic_dec(&sbi->s_flex_groups[f].used_dirs); } BUFFER_TRACE(bh2, "call ext4_handle_dirty_metadata"); fatal = ext4_handle_dirty_metadata(handle, NULL, bh2); out: if (cleared) { BUFFER_TRACE(bitmap_bh, "call ext4_handle_dirty_metadata"); err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); if (!fatal) fatal = err; ext4_mark_super_dirty(sb); } else { /* for debugging, sangwoo2.lee */ print_bh(sb, bitmap_bh, 0, EXT4_BLOCK_SIZE(sb)); /* for debugging */ ext4_error(sb, "bit already cleared for inode %lu", ino); } error_return: brelse(bitmap_bh); ext4_std_error(sb, fatal); } struct orlov_stats { __u64 free_clusters; __u32 free_inodes; __u32 used_dirs; }; /* * Helper function for Orlov's allocator; returns critical information * for a particular block group or flex_bg. If flex_size is 1, then g * is a block group number; otherwise it is flex_bg number. */ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, int flex_size, struct orlov_stats *stats) { struct ext4_group_desc *desc; struct flex_groups *flex_group = EXT4_SB(sb)->s_flex_groups; if (flex_size > 1) { stats->free_inodes = atomic_read(&flex_group[g].free_inodes); stats->free_clusters = atomic64_read(&flex_group[g].free_clusters); stats->used_dirs = atomic_read(&flex_group[g].used_dirs); return; } desc = ext4_get_group_desc(sb, g, NULL); if (desc) { stats->free_inodes = ext4_free_inodes_count(sb, desc); stats->free_clusters = ext4_free_group_clusters(sb, desc); stats->used_dirs = ext4_used_dirs_count(sb, desc); } else { stats->free_inodes = 0; stats->free_clusters = 0; stats->used_dirs = 0; } } /* * Orlov's allocator for directories. * * We always try to spread first-level directories. * * If there are blockgroups with both free inodes and free blocks counts * not worse than average we return one with smallest directory count. * Otherwise we simply return a random group. * * For the rest rules look so: * * It's OK to put directory into a group unless * it has too many directories already (max_dirs) or * it has too few free inodes left (min_inodes) or * it has too few free blocks left (min_blocks) or * Parent's group is preferred, if it doesn't satisfy these * conditions we search cyclically through the rest. If none * of the groups look good we just look for a group with more * free inodes than average (starting at parent's group). */ static int find_group_orlov(struct super_block *sb, struct inode *parent, ext4_group_t *group, umode_t mode, const struct qstr *qstr) { ext4_group_t parent_group = EXT4_I(parent)->i_block_group; struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_group_t real_ngroups = ext4_get_groups_count(sb); int inodes_per_group = EXT4_INODES_PER_GROUP(sb); unsigned int freei, avefreei, grp_free; ext4_fsblk_t freeb, avefreec; unsigned int ndirs; int max_dirs, min_inodes; ext4_grpblk_t min_clusters; ext4_group_t i, grp, g, ngroups; struct ext4_group_desc *desc; struct orlov_stats stats; int flex_size = ext4_flex_bg_size(sbi); struct dx_hash_info hinfo; ngroups = real_ngroups; if (flex_size > 1) { ngroups = (real_ngroups + flex_size - 1) >> sbi->s_log_groups_per_flex; parent_group >>= sbi->s_log_groups_per_flex; } freei = percpu_counter_read_positive(&sbi->s_freeinodes_counter); avefreei = freei / ngroups; freeb = EXT4_C2B(sbi, percpu_counter_read_positive(&sbi->s_freeclusters_counter)); avefreec = freeb; do_div(avefreec, ngroups); ndirs = percpu_counter_read_positive(&sbi->s_dirs_counter); if (S_ISDIR(mode) && ((parent == sb->s_root->d_inode) || (ext4_test_inode_flag(parent, EXT4_INODE_TOPDIR)))) { int best_ndir = inodes_per_group; int ret = -1; if (qstr) { hinfo.hash_version = DX_HASH_HALF_MD4; hinfo.seed = sbi->s_hash_seed; ext4fs_dirhash(qstr->name, qstr->len, &hinfo); grp = hinfo.hash; } else get_random_bytes(&grp, sizeof(grp)); parent_group = (unsigned)grp % ngroups; for (i = 0; i < ngroups; i++) { g = (parent_group + i) % ngroups; get_orlov_stats(sb, g, flex_size, &stats); if (!stats.free_inodes) continue; if (stats.used_dirs >= best_ndir) continue; if (stats.free_inodes < avefreei) continue; if (stats.free_clusters < avefreec) continue; grp = g; ret = 0; best_ndir = stats.used_dirs; } if (ret) goto fallback; found_flex_bg: if (flex_size == 1) { *group = grp; return 0; } /* * We pack inodes at the beginning of the flexgroup's * inode tables. Block allocation decisions will do * something similar, although regular files will * start at 2nd block group of the flexgroup. See * ext4_ext_find_goal() and ext4_find_near(). */ grp *= flex_size; for (i = 0; i < flex_size; i++) { if (grp+i >= real_ngroups) break; desc = ext4_get_group_desc(sb, grp+i, NULL); if (desc && ext4_free_inodes_count(sb, desc)) { *group = grp+i; return 0; } } goto fallback; } max_dirs = ndirs / ngroups + inodes_per_group / 16; min_inodes = avefreei - inodes_per_group*flex_size / 4; if (min_inodes < 1) min_inodes = 1; min_clusters = avefreec - EXT4_CLUSTERS_PER_GROUP(sb)*flex_size / 4; /* * Start looking in the flex group where we last allocated an * inode for this parent directory */ if (EXT4_I(parent)->i_last_alloc_group != ~0) { parent_group = EXT4_I(parent)->i_last_alloc_group; if (flex_size > 1) parent_group >>= sbi->s_log_groups_per_flex; } for (i = 0; i < ngroups; i++) { grp = (parent_group + i) % ngroups; get_orlov_stats(sb, grp, flex_size, &stats); if (stats.used_dirs >= max_dirs) continue; if (stats.free_inodes < min_inodes) continue; if (stats.free_clusters < min_clusters) continue; goto found_flex_bg; } fallback: ngroups = real_ngroups; avefreei = freei / ngroups; fallback_retry: parent_group = EXT4_I(parent)->i_block_group; for (i = 0; i < ngroups; i++) { grp = (parent_group + i) % ngroups; desc = ext4_get_group_desc(sb, grp, NULL); if (desc) { grp_free = ext4_free_inodes_count(sb, desc); if (grp_free && grp_free >= avefreei) { *group = grp; return 0; } } } if (avefreei) { /* * The free-inodes counter is approximate, and for really small * filesystems the above test can fail to find any blockgroups */ avefreei = 0; goto fallback_retry; } return -1; } static int find_group_other(struct super_block *sb, struct inode *parent, ext4_group_t *group, umode_t mode) { ext4_group_t parent_group = EXT4_I(parent)->i_block_group; ext4_group_t i, last, ngroups = ext4_get_groups_count(sb); struct ext4_group_desc *desc; int flex_size = ext4_flex_bg_size(EXT4_SB(sb)); /* * Try to place the inode is the same flex group as its * parent. If we can't find space, use the Orlov algorithm to * find another flex group, and store that information in the * parent directory's inode information so that use that flex * group for future allocations. */ if (flex_size > 1) { int retry = 0; try_again: parent_group &= ~(flex_size-1); last = parent_group + flex_size; if (last > ngroups) last = ngroups; for (i = parent_group; i < last; i++) { desc = ext4_get_group_desc(sb, i, NULL); if (desc && ext4_free_inodes_count(sb, desc)) { *group = i; return 0; } } if (!retry && EXT4_I(parent)->i_last_alloc_group != ~0) { retry = 1; parent_group = EXT4_I(parent)->i_last_alloc_group; goto try_again; } /* * If this didn't work, use the Orlov search algorithm * to find a new flex group; we pass in the mode to * avoid the topdir algorithms. */ *group = parent_group + flex_size; if (*group > ngroups) *group = 0; return find_group_orlov(sb, parent, group, mode, NULL); } /* * Try to place the inode in its parent directory */ *group = parent_group; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && ext4_free_inodes_count(sb, desc) && ext4_free_group_clusters(sb, desc)) return 0; /* * We're going to place this inode in a different blockgroup from its * parent. We want to cause files in a common directory to all land in * the same blockgroup. But we want files which are in a different * directory which shares a blockgroup with our parent to land in a * different blockgroup. * * So add our directory's i_ino into the starting point for the hash. */ *group = (*group + parent->i_ino) % ngroups; /* * Use a quadratic hash to find a group with a free inode and some free * blocks. */ for (i = 1; i < ngroups; i <<= 1) { *group += i; if (*group >= ngroups) *group -= ngroups; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && ext4_free_inodes_count(sb, desc) && ext4_free_group_clusters(sb, desc)) return 0; } /* * That failed: try linear search for a free inode, even if that group * has no free blocks. */ *group = parent_group; for (i = 0; i < ngroups; i++) { if (++*group >= ngroups) *group = 0; desc = ext4_get_group_desc(sb, *group, NULL); if (desc && ext4_free_inodes_count(sb, desc)) return 0; } return -1; } /* * There are two policies for allocating an inode. If the new inode is * a directory, then a forward search is made for a block group with both * free space and a low directory-to-inode ratio; if that fails, then of * the groups with above-average free space, that group with the fewest * directories already is chosen. * * For other inodes, search forward from the parent directory's block * group to find a free inode. */ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, umode_t mode, const struct qstr *qstr, __u32 goal, uid_t *owner, int nblocks) { struct super_block *sb; struct buffer_head *inode_bitmap_bh = NULL; struct buffer_head *group_desc_bh; ext4_group_t ngroups, group = 0; unsigned long ino = 0; struct inode *inode; struct ext4_group_desc *gdp = NULL; struct ext4_inode_info *ei; struct ext4_sb_info *sbi; int ret2, err = 0; struct inode *ret; ext4_group_t i; ext4_group_t flex_group; /* Cannot create files in a deleted directory */ if (!dir || !dir->i_nlink) return ERR_PTR(-EPERM); sb = dir->i_sb; ngroups = ext4_get_groups_count(sb); trace_ext4_request_inode(dir, mode); inode = new_inode(sb); if (!inode) return ERR_PTR(-ENOMEM); ei = EXT4_I(inode); sbi = EXT4_SB(sb); if (!goal) goal = sbi->s_inode_goal; if (goal && goal <= le32_to_cpu(sbi->s_es->s_inodes_count)) { group = (goal - 1) / EXT4_INODES_PER_GROUP(sb); ino = (goal - 1) % EXT4_INODES_PER_GROUP(sb); ret2 = 0; goto got_group; } if (S_ISDIR(mode)) ret2 = find_group_orlov(sb, dir, &group, mode, qstr); else ret2 = find_group_other(sb, dir, &group, mode); got_group: EXT4_I(dir)->i_last_alloc_group = group; err = -ENOSPC; if (ret2 == -1) goto out; /* * Normally we will only go through one pass of this loop, * unless we get unlucky and it turns out the group we selected * had its last inode grabbed by someone else. */ for (i = 0; i < ngroups; i++, ino = 0) { err = -EIO; gdp = ext4_get_group_desc(sb, group, &group_desc_bh); if (!gdp) { ext4_debug("ext4_get_group_desc error: %d\n", group); print_bh(sb, group_desc_bh, 0, EXT4_BLOCK_SIZE(sb)); goto fail; } if (inode_bitmap_bh) { ext4_handle_release_buffer(handle, inode_bitmap_bh); brelse(inode_bitmap_bh); } inode_bitmap_bh = ext4_read_inode_bitmap(sb, group); if (!inode_bitmap_bh) { ext4_debug("ext4_read_inode_bitmap error: %d\n", group); goto fail; } repeat_in_this_group: ino = ext4_find_next_zero_bit((unsigned long *) inode_bitmap_bh->b_data, EXT4_INODES_PER_GROUP(sb), ino); if (ino >= EXT4_INODES_PER_GROUP(sb)) goto next_group; if (group == 0 && (ino+1) < EXT4_FIRST_INO(sb)) { ext4_error(sb, "reserved inode found cleared - " "inode=%lu", ino + 1); continue; } if (!handle) { BUG_ON(nblocks <= 0); handle = ext4_journal_start_sb(dir->i_sb, nblocks); if (IS_ERR(handle)) { err = PTR_ERR(handle); goto fail; } } BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); err = ext4_journal_get_write_access(handle, inode_bitmap_bh); if (err) goto fail; ext4_lock_group(sb, group); ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data); ext4_unlock_group(sb, group); ino++; /* the inode bitmap is zero-based */ if (!ret2) goto got; /* we grabbed the inode! */ if (ino < EXT4_INODES_PER_GROUP(sb)) goto repeat_in_this_group; next_group: if (++group == ngroups) group = 0; } ext4_handle_release_buffer(handle, inode_bitmap_bh); err = -ENOSPC; goto out; got: BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata"); err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh); if (err) { ext4_debug("ext4_handle_dirty_metadata error\n"); goto fail; } /* We may have to initialize the block bitmap if it isn't already */ if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM) && gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { struct buffer_head *block_bitmap_bh; block_bitmap_bh = ext4_read_block_bitmap(sb, group); if (!block_bitmap_bh) { err = -EIO; goto out; } BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); err = ext4_journal_get_write_access(handle, block_bitmap_bh); if (err) { brelse(block_bitmap_bh); ext4_debug("ext4_journal_get_write_access error\n"); goto fail; } BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); err = ext4_handle_dirty_metadata(handle, NULL, block_bitmap_bh); /* recheck and clear flag under lock if we still need to */ ext4_lock_group(sb, group); if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); ext4_free_group_clusters_set(sb, gdp, ext4_free_clusters_after_init(sb, group, gdp)); gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp); } ext4_unlock_group(sb, group); brelse(block_bitmap_bh); if (err) { ext4_debug("ext4_handle_dirty_metadata error\n"); goto fail; } } BUFFER_TRACE(group_desc_bh, "get_write_access"); err = ext4_journal_get_write_access(handle, group_desc_bh); if (err) { ext4_debug("ext4_journal_get_write_access error\n"); goto fail; } /* Update the relevant bg descriptor fields */ if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) { int free; struct ext4_group_info *grp = ext4_get_group_info(sb, group); down_read(&grp->alloc_sem); /* protect vs itable lazyinit */ ext4_lock_group(sb, group); /* while we modify the bg desc */ free = EXT4_INODES_PER_GROUP(sb) - ext4_itable_unused_count(sb, gdp); if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) { gdp->bg_flags &= cpu_to_le16(~EXT4_BG_INODE_UNINIT); free = 0; } /* * Check the relative inode number against the last used * relative inode number in this group. if it is greater * we need to update the bg_itable_unused count */ if (ino > free) ext4_itable_unused_set(sb, gdp, (EXT4_INODES_PER_GROUP(sb) - ino)); up_read(&grp->alloc_sem); } else { ext4_lock_group(sb, group); } ext4_free_inodes_set(sb, gdp, ext4_free_inodes_count(sb, gdp) - 1); if (S_ISDIR(mode)) { ext4_used_dirs_set(sb, gdp, ext4_used_dirs_count(sb, gdp) + 1); if (sbi->s_log_groups_per_flex) { ext4_group_t f = ext4_flex_group(sbi, group); atomic_inc(&sbi->s_flex_groups[f].used_dirs); } } if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) { gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp); } ext4_unlock_group(sb, group); BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata"); err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh); if (err) { ext4_debug("ext4_handle_dirty_metadata error\n"); goto fail; } percpu_counter_dec(&sbi->s_freeinodes_counter); if (S_ISDIR(mode)) percpu_counter_inc(&sbi->s_dirs_counter); ext4_mark_super_dirty(sb); if (sbi->s_log_groups_per_flex) { flex_group = ext4_flex_group(sbi, group); atomic_dec(&sbi->s_flex_groups[flex_group].free_inodes); } if (owner) { inode->i_mode = mode; inode->i_uid = owner[0]; inode->i_gid = owner[1]; } else if (test_opt(sb, GRPID)) { inode->i_mode = mode; inode->i_uid = current_fsuid(); inode->i_gid = dir->i_gid; } else inode_init_owner(inode, dir, mode); inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb); /* This is the optimal IO size (for stat), not the fs block size */ inode->i_blocks = 0; inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = ext4_current_time(inode); memset(ei->i_data, 0, sizeof(ei->i_data)); ei->i_dir_start_lookup = 0; ei->i_disksize = 0; /* Don't inherit extent flag from directory, amongst others. */ ei->i_flags = ext4_mask_flags(mode, EXT4_I(dir)->i_flags & EXT4_FL_INHERITED); ei->i_file_acl = 0; ei->i_dtime = 0; ei->i_block_group = group; ei->i_last_alloc_group = ~0; ext4_set_inode_flags(inode); if (IS_DIRSYNC(inode)) ext4_handle_sync(handle); if (insert_inode_locked(inode) < 0) { /* * Likely a bitmap corruption causing inode to be allocated * twice. */ ext4_debug("insert_inode_locked error\n"); if(inode_bitmap_bh) print_bh(sb, inode_bitmap_bh, 0, EXT4_BLOCK_SIZE(sb)); err = -EIO; goto fail; } spin_lock(&sbi->s_next_gen_lock); inode->i_generation = sbi->s_next_generation++; spin_unlock(&sbi->s_next_gen_lock); ext4_clear_state_flags(ei); /* Only relevant on 32-bit archs */ ext4_set_inode_state(inode, EXT4_STATE_NEW); ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; ret = inode; dquot_initialize(inode); err = dquot_alloc_inode(inode); if (err) goto fail_drop; err = ext4_init_acl(handle, inode, dir); if (err) goto fail_free_drop; err = ext4_init_security(handle, inode, dir, qstr); if (err) goto fail_free_drop; if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS)) { /* set extent flag only for directory, file and normal symlink*/ if (S_ISDIR(mode) || S_ISREG(mode) || S_ISLNK(mode)) { ext4_set_inode_flag(inode, EXT4_INODE_EXTENTS); ext4_ext_tree_init(handle, inode); } } if (ext4_handle_valid(handle)) { ei->i_sync_tid = handle->h_transaction->t_tid; ei->i_datasync_tid = handle->h_transaction->t_tid; } err = ext4_mark_inode_dirty(handle, inode); if (err) { ext4_std_error(sb, err); goto fail_free_drop; } ext4_debug("allocating inode %lu\n", inode->i_ino); trace_ext4_allocate_inode(inode, dir, mode); goto really_out; fail: ext4_std_error(sb, err); out: iput(inode); ret = ERR_PTR(err); really_out: brelse(inode_bitmap_bh); return ret; fail_free_drop: dquot_free_inode(inode); fail_drop: dquot_drop(inode); inode->i_flags |= S_NOQUOTA; clear_nlink(inode); unlock_new_inode(inode); iput(inode); brelse(inode_bitmap_bh); return ERR_PTR(err); } /* Verify that we are loading a valid orphan from disk */ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) { unsigned long max_ino = le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count); ext4_group_t block_group; int bit; struct buffer_head *bitmap_bh; struct inode *inode = NULL; long err = -EIO; /* Error cases - e2fsck has already cleaned up for us */ if (ino > max_ino) { ext4_warning(sb, "bad orphan ino %lu! e2fsck was run?", ino); goto error; } block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb); bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb); bitmap_bh = ext4_read_inode_bitmap(sb, block_group); if (!bitmap_bh) { ext4_warning(sb, "inode bitmap error for orphan %lu", ino); goto error; } /* Having the inode bit set should be a 100% indicator that this * is a valid orphan (no e2fsck run on fs). Orphans also include * inodes that were being truncated, so we can't check i_nlink==0. */ if (!ext4_test_bit(bit, bitmap_bh->b_data)) goto bad_orphan; inode = ext4_iget(sb, ino); if (IS_ERR(inode)) goto iget_failed; /* * If the orphans has i_nlinks > 0 then it should be able to be * truncated, otherwise it won't be removed from the orphan list * during processing and an infinite loop will result. */ if (inode->i_nlink && !ext4_can_truncate(inode)) goto bad_orphan; if (NEXT_ORPHAN(inode) > max_ino) goto bad_orphan; brelse(bitmap_bh); return inode; iget_failed: err = PTR_ERR(inode); inode = NULL; bad_orphan: ext4_warning(sb, "bad orphan inode %lu! e2fsck was run?", ino); printk(KERN_NOTICE "ext4_test_bit(bit=%d, block=%llu) = %d\n", bit, (unsigned long long)bitmap_bh->b_blocknr, ext4_test_bit(bit, bitmap_bh->b_data)); printk(KERN_NOTICE "inode=%p\n", inode); if (inode) { printk(KERN_NOTICE "is_bad_inode(inode)=%d\n", is_bad_inode(inode)); printk(KERN_NOTICE "NEXT_ORPHAN(inode)=%u\n", NEXT_ORPHAN(inode)); printk(KERN_NOTICE "max_ino=%lu\n", max_ino); printk(KERN_NOTICE "i_nlink=%u\n", inode->i_nlink); /* Avoid freeing blocks if we got a bad deleted inode */ if (inode->i_nlink == 0) inode->i_blocks = 0; iput(inode); } brelse(bitmap_bh); error: return ERR_PTR(err); } unsigned long ext4_count_free_inodes(struct super_block *sb) { unsigned long desc_count; struct ext4_group_desc *gdp; ext4_group_t i, ngroups = ext4_get_groups_count(sb); #ifdef EXT4FS_DEBUG struct ext4_super_block *es; unsigned long bitmap_count, x; struct buffer_head *bitmap_bh = NULL; es = EXT4_SB(sb)->s_es; desc_count = 0; bitmap_count = 0; gdp = NULL; for (i = 0; i < ngroups; i++) { gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; desc_count += ext4_free_inodes_count(sb, gdp); brelse(bitmap_bh); bitmap_bh = ext4_read_inode_bitmap(sb, i); if (!bitmap_bh) continue; x = ext4_count_free(bitmap_bh->b_data, EXT4_INODES_PER_GROUP(sb) / 8); printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n", (unsigned long) i, ext4_free_inodes_count(sb, gdp), x); bitmap_count += x; } brelse(bitmap_bh); printk(KERN_DEBUG "ext4_count_free_inodes: " "stored = %u, computed = %lu, %lu\n", le32_to_cpu(es->s_free_inodes_count), desc_count, bitmap_count); return desc_count; #else desc_count = 0; for (i = 0; i < ngroups; i++) { gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; desc_count += ext4_free_inodes_count(sb, gdp); cond_resched(); } return desc_count; #endif } /* Called at mount-time, super-block is locked */ unsigned long ext4_count_dirs(struct super_block * sb) { unsigned long count = 0; ext4_group_t i, ngroups = ext4_get_groups_count(sb); for (i = 0; i < ngroups; i++) { struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); if (!gdp) continue; count += ext4_used_dirs_count(sb, gdp); } return count; } /* * Zeroes not yet zeroed inode table - just write zeroes through the whole * inode table. Must be called without any spinlock held. The only place * where it is called from on active part of filesystem is ext4lazyinit * thread, so we do not need any special locks, however we have to prevent * inode allocation from the current group, so we take alloc_sem lock, to * block ext4_new_inode() until we are finished. */ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, int barrier) { struct ext4_group_info *grp = ext4_get_group_info(sb, group); struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_group_desc *gdp = NULL; struct buffer_head *group_desc_bh; handle_t *handle; ext4_fsblk_t blk; int num, ret = 0, used_blks = 0; /* This should not happen, but just to be sure check this */ if (sb->s_flags & MS_RDONLY) { ret = 1; goto out; } gdp = ext4_get_group_desc(sb, group, &group_desc_bh); if (!gdp) goto out; /* * We do not need to lock this, because we are the only one * handling this flag. */ if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)) goto out; handle = ext4_journal_start_sb(sb, 1); if (IS_ERR(handle)) { ret = PTR_ERR(handle); goto out; } down_write(&grp->alloc_sem); /* * If inode bitmap was already initialized there may be some * used inodes so we need to skip blocks with used inodes in * inode table. */ if (!(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT))) used_blks = DIV_ROUND_UP((EXT4_INODES_PER_GROUP(sb) - ext4_itable_unused_count(sb, gdp)), sbi->s_inodes_per_block); if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group)) { ext4_error(sb, "Something is wrong with group %u: " "used itable blocks: %d; " "itable unused count: %u", group, used_blks, ext4_itable_unused_count(sb, gdp)); ret = 1; goto err_out; } blk = ext4_inode_table(sb, gdp) + used_blks; num = sbi->s_itb_per_group - used_blks; BUFFER_TRACE(group_desc_bh, "get_write_access"); ret = ext4_journal_get_write_access(handle, group_desc_bh); if (ret) goto err_out; /* * Skip zeroout if the inode table is full. But we set the ZEROED * flag anyway, because obviously, when it is full it does not need * further zeroing. */ if (unlikely(num == 0)) goto skip_zeroout; ext4_debug("going to zero out inode table in group %d\n", group); ret = sb_issue_zeroout(sb, blk, num, GFP_NOFS); if (ret < 0) goto err_out; if (barrier) blkdev_issue_flush(sb->s_bdev, GFP_NOFS, NULL); skip_zeroout: ext4_lock_group(sb, group); gdp->bg_flags |= cpu_to_le16(EXT4_BG_INODE_ZEROED); gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp); ext4_unlock_group(sb, group); BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata"); ret = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh); err_out: up_write(&grp->alloc_sem); ext4_journal_stop(handle); out: return ret; }
Java
/* * DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/netwerk/socket/base/nsITransportSecurityInfo.idl */ #ifndef __gen_nsITransportSecurityInfo_h__ #define __gen_nsITransportSecurityInfo_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 /* starting interface: nsITransportSecurityInfo */ #define NS_ITRANSPORTSECURITYINFO_IID_STR "0d0a6b62-d4a9-402e-a197-6bc6e358fec9" #define NS_ITRANSPORTSECURITYINFO_IID \ {0x0d0a6b62, 0xd4a9, 0x402e, \ { 0xa1, 0x97, 0x6b, 0xc6, 0xe3, 0x58, 0xfe, 0xc9 }} class NS_NO_VTABLE NS_SCRIPTABLE nsITransportSecurityInfo : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITRANSPORTSECURITYINFO_IID) /* readonly attribute unsigned long securityState; */ NS_SCRIPTABLE NS_IMETHOD GetSecurityState(PRUint32 *aSecurityState) = 0; /* readonly attribute wstring shortSecurityDescription; */ NS_SCRIPTABLE NS_IMETHOD GetShortSecurityDescription(PRUnichar * *aShortSecurityDescription) = 0; /* readonly attribute wstring errorMessage; */ NS_SCRIPTABLE NS_IMETHOD GetErrorMessage(PRUnichar * *aErrorMessage) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsITransportSecurityInfo, NS_ITRANSPORTSECURITYINFO_IID) /* Use this macro when declaring classes that implement this interface. */ #define NS_DECL_NSITRANSPORTSECURITYINFO \ NS_SCRIPTABLE NS_IMETHOD GetSecurityState(PRUint32 *aSecurityState); \ NS_SCRIPTABLE NS_IMETHOD GetShortSecurityDescription(PRUnichar * *aShortSecurityDescription); \ NS_SCRIPTABLE NS_IMETHOD GetErrorMessage(PRUnichar * *aErrorMessage); /* Use this macro to declare functions that forward the behavior of this interface to another object. */ #define NS_FORWARD_NSITRANSPORTSECURITYINFO(_to) \ NS_SCRIPTABLE NS_IMETHOD GetSecurityState(PRUint32 *aSecurityState) { return _to GetSecurityState(aSecurityState); } \ NS_SCRIPTABLE NS_IMETHOD GetShortSecurityDescription(PRUnichar * *aShortSecurityDescription) { return _to GetShortSecurityDescription(aShortSecurityDescription); } \ NS_SCRIPTABLE NS_IMETHOD GetErrorMessage(PRUnichar * *aErrorMessage) { return _to GetErrorMessage(aErrorMessage); } /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */ #define NS_FORWARD_SAFE_NSITRANSPORTSECURITYINFO(_to) \ NS_SCRIPTABLE NS_IMETHOD GetSecurityState(PRUint32 *aSecurityState) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSecurityState(aSecurityState); } \ NS_SCRIPTABLE NS_IMETHOD GetShortSecurityDescription(PRUnichar * *aShortSecurityDescription) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetShortSecurityDescription(aShortSecurityDescription); } \ NS_SCRIPTABLE NS_IMETHOD GetErrorMessage(PRUnichar * *aErrorMessage) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetErrorMessage(aErrorMessage); } #if 0 /* Use the code below as a template for the implementation class for this interface. */ /* Header file */ class nsTransportSecurityInfo : public nsITransportSecurityInfo { public: NS_DECL_ISUPPORTS NS_DECL_NSITRANSPORTSECURITYINFO nsTransportSecurityInfo(); private: ~nsTransportSecurityInfo(); protected: /* additional members */ }; /* Implementation file */ NS_IMPL_ISUPPORTS1(nsTransportSecurityInfo, nsITransportSecurityInfo) nsTransportSecurityInfo::nsTransportSecurityInfo() { /* member initializers and constructor code */ } nsTransportSecurityInfo::~nsTransportSecurityInfo() { /* destructor code */ } /* readonly attribute unsigned long securityState; */ NS_IMETHODIMP nsTransportSecurityInfo::GetSecurityState(PRUint32 *aSecurityState) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute wstring shortSecurityDescription; */ NS_IMETHODIMP nsTransportSecurityInfo::GetShortSecurityDescription(PRUnichar * *aShortSecurityDescription) { return NS_ERROR_NOT_IMPLEMENTED; } /* readonly attribute wstring errorMessage; */ NS_IMETHODIMP nsTransportSecurityInfo::GetErrorMessage(PRUnichar * *aErrorMessage) { return NS_ERROR_NOT_IMPLEMENTED; } /* End of implementation class template. */ #endif #endif /* __gen_nsITransportSecurityInfo_h__ */
Java
from flask import request, jsonify from sql_classes import UrlList, Acl, UserGroup, User, Role def _node_base_and_rest(path): """ Returns a tuple: (the substring of a path after the last nodeSeparator, the preceding path before it) If 'base' includes its own baseSeparator - return only a string after it So if a path is 'OU=Group,OU=Dept,OU=Company', the tuple result would be ('OU=Group,OU=Dept', 'Company') """ node_separator = ',' base_separator = '=' node_base = path[path.rfind(node_separator) + 1:] if path.find(node_separator) != -1: node_preceding = path[:len(path) - len(node_base) - 1] else: node_preceding = '' return (node_preceding, node_base[node_base.find(base_separator) + 1:]) def _place_user_onto_tree(user, usertree, user_groups): """ Places a 'user' object on a 'usertree' object according to user's pathField string key """ curr_node = usertree # Decompose 'OU=Group,OU=Dept,OU=Company' into ('OU=Group,OU=Dept', 'Company') preceding, base = _node_base_and_rest(user['distinguishedName']) full_node_path = '' # Place all path groups onto a tree starting from the outermost while base != '': node_found = False full_node_path = 'OU=' + base + (',' if full_node_path != '' else '') + full_node_path # Search for corresponding base element on current hierarchy level for obj in curr_node: if obj.get('text') == None: continue if obj['text'] == base: node_found = True curr_node = obj['children'] break # Create a new group node if not node_found: curr_node.append({ 'id': 'usergroup_' + str(user_groups[full_node_path]), 'text': base, 'objectType': 'UserGroup', 'children': [] }) curr_node = curr_node[len(curr_node) - 1]['children'] preceding, base = _node_base_and_rest(preceding) curr_node.append({ 'id': 'user_' + str(user['id']), 'text': user['cn'], 'leaf': True, 'iconCls': 'x-fa fa-user' if user['status'] == 1 else 'x-fa fa-user-times', 'objectType': 'User' }) def _sort_tree(subtree, sort_field): """ Sorts a subtree node by a sortField key of each element """ # Sort eval function, first by group property, then by text subtree['children'] = sorted( subtree['children'], key=lambda obj: (1 if obj.get('children') == None else 0, obj[sort_field])) for tree_elem in subtree['children']: if tree_elem.get('children') != None: _sort_tree(tree_elem, sort_field) def _collapse_terminal_nodes(subtree): """ Collapses tree nodes which doesn't contain subgroups, just tree leaves """ subtree_has_group_nodes = False for tree_elem in subtree['children']: if tree_elem.get('children') != None: subtree_has_group_nodes = True _collapse_terminal_nodes(tree_elem) subtree['expanded'] = subtree_has_group_nodes def _expand_all_nodes(subtree): """ Expand all level nodes """ for tree_elem in subtree['children']: if tree_elem.get('children') != None: _expand_all_nodes(tree_elem) subtree['expanded'] = True def _get_user_tree(current_user_properties, Session): """ Build user tree """ current_user_permissions = current_user_properties['user_permissions'] session = Session() # Get all groups query_result = session.query(UserGroup.id, UserGroup.distinguishedName).all() user_groups = {} for query_result_row in query_result: user_groups[query_result_row.distinguishedName] = query_result_row.id # Get all users if ViewUsers permission present if next((item for item in current_user_permissions if item['permissionName'] == 'ViewUsers'), None) != None: query_result = session.query( User.id.label('user_id'), User.cn, User.status, UserGroup.id.label('usergroup_id'), UserGroup.distinguishedName).join(UserGroup).filter(User.hidden == 0).all() # Get just the requester otherwise else: query_result = session.query( User.id.label('user_id'), User.cn, User.status, UserGroup.id.label('usergroup_id'), UserGroup.distinguishedName).join(UserGroup).\ filter(User.id == current_user_properties['user_object']['id'], User.hidden == 0).all() Session.remove() # Future tree user_tree = [] # Place each user on a tree for query_result_row in query_result: user_object = { 'id': query_result_row.user_id, 'distinguishedName': query_result_row.distinguishedName, 'status': query_result_row.status, 'cn': query_result_row.cn } _place_user_onto_tree(user_object, user_tree, user_groups) user_tree = { 'id': 'usergroup_0', 'objectType': 'UserGroup', 'text': 'Пользователи', 'children': user_tree } # Sort tree elements _sort_tree(user_tree, 'text') # Collapse/expand tree nodes if next((item for item in current_user_permissions if item['permissionName'] == 'ViewUsers'), None) != None: _collapse_terminal_nodes(user_tree) else: _expand_all_nodes(user_tree) return user_tree def _get_url_lists(Session): """ Get URL lists """ session = Session() # Get all urllists from DB query_result = session.query(UrlList.id, UrlList.name, UrlList.whitelist).all() Session.remove() urllist_list = [] # Making a list of them for query_result_row in query_result: url_list_object = { 'id': 'urllist_' + str(query_result_row.id), 'text': query_result_row.name, 'leaf': True, 'iconCls': 'x-fa fa-unlock' if query_result_row.whitelist else 'x-fa fa-lock', 'objectType': 'UrlList' } urllist_list.append(url_list_object) url_lists = { 'id': 'urllists', 'objectType': 'UrlLists', 'text': 'Списки URL', 'iconCls': 'x-fa fa-cog', 'children': urllist_list } # Sort tree elements _sort_tree(url_lists, 'text') return url_lists def _get_acls(Session): """ Get ACLs """ session = Session() # Get all access control lists from DB query_result = session.query(Acl.id, Acl.name).all() Session.remove() acl_list = [] # Making a list of them for query_result_row in query_result: acl_object = { 'id': 'acl_' + str(query_result_row.id), 'text': query_result_row.name, 'leaf': True, 'iconCls': 'x-fa fa-filter', 'objectType': 'AclContents' } acl_list.append(acl_object) acls = { 'id': 'acls', 'objectType': 'Acls', 'text': 'Списки доступа', 'iconCls': 'x-fa fa-cog', 'children': acl_list } # Sort tree elements _sort_tree(acls, 'text') return acls def _get_roles(Session): """ Get user roles """ session = Session() # Get all roles from DB query_result = session.query(Role.id, Role.name).all() Session.remove() roles_list = [] # Making a list of them for query_result_row in query_result: role_object = { 'id': 'role_' + str(query_result_row.id), 'text': query_result_row.name, 'leaf': True, 'iconCls': 'x-fa fa-key', 'objectType': 'Role' } roles_list.append(role_object) roles = { 'id': 'roles', 'objectType': 'Roles', 'text': 'Роли', 'iconCls': 'x-fa fa-cog', 'children': roles_list } # Sorting tree elements _sort_tree(roles, 'text') return roles def select_tree(current_user_properties, node_name, Session): url_lists_node = None acls_node = None roles_node = None users_node = None current_user_permissions = current_user_properties['user_permissions'] if next((item for item in current_user_permissions if item['permissionName'] == 'ViewSettings'), None) != None: if node_name in ['root', 'urllists']: url_lists_node = _get_url_lists(Session) if node_name in ['root', 'acls']: acls_node = _get_acls(Session) if next((item for item in current_user_permissions if item['permissionName'] == 'ViewPermissions'), None) != None: if node_name in ['root', 'roles']: roles_node = _get_roles(Session) if node_name in ['root']: users_node = _get_user_tree(current_user_properties, Session) if node_name == 'root': children_list = [] if url_lists_node is not None: children_list.append(url_lists_node) if acls_node is not None: children_list.append(acls_node) if roles_node is not None: children_list.append(roles_node) if users_node is not None: children_list.append(users_node) result = { 'success': True, 'children': children_list } elif node_name == 'urllists': if next((item for item in current_user_permissions if item['permissionName'] == 'ViewSettings'), None) != None: result = { 'success': True, 'children': url_lists_node['children'] } else: return Response('Forbidden', 403) elif node_name == 'acls': if next((item for item in current_user_permissions if item['permissionName'] == 'ViewSettings'), None) != None: result = { 'success': True, 'children': acls_node['children'] } else: return Response('Forbidden', 403) elif node_name == 'roles': if next((item for item in current_user_permissions if item['permissionName'] == 'ViewPermissions'), None) != None: result = { 'success': True, 'children': roles_node['children'] } else: return Response('Forbidden', 403) return jsonify(result)
Java
<?php /* core/themes/stable/templates/navigation/menu--toolbar.html.twig */ class __TwigTemplate_6d5e9324ee90ee9b5c8803c6bf39943fec4c217cff21756d529e71138cf50b3a extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); $this->parent = false; $this->blocks = array( ); } protected function doDisplay(array $context, array $blocks = array()) { $tags = array("import" => 21, "macro" => 29, "if" => 31, "for" => 37, "set" => 39); $filters = array(); $functions = array("link" => 47); try { $this->env->getExtension('sandbox')->checkSecurity( array('import', 'macro', 'if', 'for', 'set'), array(), array('link') ); } catch (Twig_Sandbox_SecurityError $e) { $e->setTemplateFile($this->getTemplateName()); if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) { $e->setTemplateLine($tags[$e->getTagName()]); } elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) { $e->setTemplateLine($filters[$e->getFilterName()]); } elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) { $e->setTemplateLine($functions[$e->getFunctionName()]); } throw $e; } // line 21 $context["menus"] = $this; // line 22 echo " "; // line 27 echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->renderVar($context["menus"]->getmenu_links((isset($context["items"]) ? $context["items"] : null), (isset($context["attributes"]) ? $context["attributes"] : null), 0))); echo " "; } // line 29 public function getmenu_links($__items__ = null, $__attributes__ = null, $__menu_level__ = null, ...$__varargs__) { $context = $this->env->mergeGlobals(array( "items" => $__items__, "attributes" => $__attributes__, "menu_level" => $__menu_level__, "varargs" => $__varargs__, )); $blocks = array(); ob_start(); try { // line 30 echo " "; $context["menus"] = $this; // line 31 echo " "; if ((isset($context["items"]) ? $context["items"] : null)) { // line 32 echo " "; if (((isset($context["menu_level"]) ? $context["menu_level"] : null) == 0)) { // line 33 echo " <ul"; echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["attributes"]) ? $context["attributes"] : null), "addClass", array(0 => "toolbar-menu"), "method"), "html", null, true)); echo "> "; } else { // line 35 echo " <ul class=\"toolbar-menu\"> "; } // line 37 echo " "; $context['_parent'] = $context; $context['_seq'] = twig_ensure_traversable((isset($context["items"]) ? $context["items"] : null)); foreach ($context['_seq'] as $context["_key"] => $context["item"]) { // line 38 echo " "; // line 39 $context["classes"] = array(0 => "menu-item", 1 => (($this->getAttribute( // line 41 $context["item"], "is_expanded", array())) ? ("menu-item--expanded") : ("")), 2 => (($this->getAttribute( // line 42 $context["item"], "is_collapsed", array())) ? ("menu-item--collapsed") : ("")), 3 => (($this->getAttribute( // line 43 $context["item"], "in_active_trail", array())) ? ("menu-item--active-trail") : (""))); // line 46 echo " <li"; echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute($this->getAttribute($context["item"], "attributes", array()), "addClass", array(0 => (isset($context["classes"]) ? $context["classes"] : null)), "method"), "html", null, true)); echo "> "; // line 47 echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->env->getExtension('drupal_core')->getLink($this->getAttribute($context["item"], "title", array()), $this->getAttribute($context["item"], "url", array())), "html", null, true)); echo " "; // line 48 if ($this->getAttribute($context["item"], "below", array())) { // line 49 echo " "; echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->renderVar($context["menus"]->getmenu_links($this->getAttribute($context["item"], "below", array()), (isset($context["attributes"]) ? $context["attributes"] : null), ((isset($context["menu_level"]) ? $context["menu_level"] : null) + 1)))); echo " "; } // line 51 echo " </li> "; } $_parent = $context['_parent']; unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']); $context = array_intersect_key($context, $_parent) + $_parent; // line 53 echo " </ul> "; } } catch (Exception $e) { ob_end_clean(); throw $e; } catch (Throwable $e) { ob_end_clean(); throw $e; } return ('' === $tmp = ob_get_clean()) ? '' : new Twig_Markup($tmp, $this->env->getCharset()); } public function getTemplateName() { return "core/themes/stable/templates/navigation/menu--toolbar.html.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 124 => 53, 117 => 51, 111 => 49, 109 => 48, 105 => 47, 100 => 46, 98 => 43, 97 => 42, 96 => 41, 95 => 39, 93 => 38, 88 => 37, 84 => 35, 78 => 33, 75 => 32, 72 => 31, 69 => 30, 55 => 29, 48 => 27, 45 => 22, 43 => 21,); } public function getSource() { return "{# /** * @file * Theme override to display a toolbar menu. * * Available variables: * - menu_name: The machine name of the menu. * - items: A nested list of menu items. Each menu item contains: * - attributes: HTML attributes for the menu item. * - below: The menu item child items. * - title: The menu link title. * - url: The menu link url, instance of \\Drupal\\Core\\Url * - localized_options: Menu link localized options. * - is_expanded: TRUE if the link has visible children within the current * menu tree. * - is_collapsed: TRUE if the link has children within the current menu tree * that are not currently visible. * - in_active_trail: TRUE if the link is in the active trail. */ #} {% import _self as menus %} {# We call a macro which calls itself to render the full tree. @see http://twig.sensiolabs.org/doc/tags/macro.html #} {{ menus.menu_links(items, attributes, 0) }} {% macro menu_links(items, attributes, menu_level) %} {% import _self as menus %} {% if items %} {% if menu_level == 0 %} <ul{{ attributes.addClass('toolbar-menu') }}> {% else %} <ul class=\"toolbar-menu\"> {% endif %} {% for item in items %} {% set classes = [ 'menu-item', item.is_expanded ? 'menu-item--expanded', item.is_collapsed ? 'menu-item--collapsed', item.in_active_trail ? 'menu-item--active-trail', ] %} <li{{ item.attributes.addClass(classes) }}> {{ link(item.title, item.url) }} {% if item.below %} {{ menus.menu_links(item.below, attributes, menu_level + 1) }} {% endif %} </li> {% endfor %} </ul> {% endif %} {% endmacro %} "; } }
Java
<?php /** * --------------------------------------------------------------------- * GLPI - Gestionnaire Libre de Parc Informatique * Copyright (C) 2015-2021 Teclib' and contributors. * * http://glpi-project.org * * based on GLPI - Gestionnaire Libre de Parc Informatique * Copyright (C) 2003-2014 by the INDEPNET Development Team. * * --------------------------------------------------------------------- * * LICENSE * * This file is part of GLPI. * * GLPI 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. * * GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>. * --------------------------------------------------------------------- */ /** * @since 0.85 */ include ('../inc/includes.php'); header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); Session::checkCentralAccess(); // Make a select box if ($_POST['items_id'] && $_POST['itemtype'] && class_exists($_POST['itemtype'])) { $devicetype = $_POST['itemtype']; $linktype = $devicetype::getItem_DeviceType(); if (count($linktype::getSpecificities())) { $keys = array_keys($linktype::getSpecificities()); array_walk($keys, function (&$val) use ($DB) { return $DB->quoteName($val); }); $name_field = new QueryExpression( "CONCAT_WS(' - ', " . implode(', ', $keys) . ")" . "AS ".$DB->quoteName("name") ); } else { $name_field = 'id AS name'; } $result = $DB->request( [ 'SELECT' => ['id', $name_field], 'FROM' => $linktype::getTable(), 'WHERE' => [ $devicetype::getForeignKeyField() => $_POST['items_id'], 'itemtype' => '', ] ] ); echo "<table width='100%'><tr><td>" . __('Choose an existing device') . "</td><td rowspan='2'>" . __('and/or') . "</td><td>" . __('Add new devices') . '</td></tr>'; echo "<tr><td>"; if ($result->count() == 0) { echo __('No unaffected device !'); } else { $devices = []; foreach ($result as $row) { $name = $row['name']; if (empty($name)) { $name = $row['id']; } $devices[$row['id']] = $name; } Dropdown::showFromArray($linktype::getForeignKeyField(), $devices, ['multiple' => true]); } echo "</td><td>"; Dropdown::showNumber('new_devices', ['min' => 0, 'max' => 10]); echo "</td></tr></table>"; }
Java
/* *************************************************************************** * Ralink Tech Inc. * 4F, No. 2 Technology 5th Rd. * Science-based Industrial Park * Hsin-chu, Taiwan, R.O.C. * * (c) Copyright 2002, Ralink Technology, Inc. * * All rights reserved. Ralink's source code is an unpublished work and the * use of a copyright notice does not imply otherwise. This source code * contains confidential trade secret material of Ralink Tech. Any attemp * or participation in deciphering, decoding, reverse engineering or in any * way altering the source code is stricitly prohibited, unless the prior * written consent of Ralink Technology, Inc. is obtained. *************************************************************************** Module Name: rbus_prop_dev.c Abstract: Create and register network interface for RBUS based chipsets in linux platform. Revision History: Who When What -------- ---------- ---------------------------------------------- */ #ifdef RTMP_RBUS_SUPPORT #define RTMP_MODULE_OS #include "rt_config.h" #if defined(CONFIG_RA_CLASSIFIER) && (!defined(CONFIG_RA_CLASSIFIER_MODULE)) extern int (*ra_classifier_init_func)(void); extern void (*ra_classifier_release_func)(void); extern struct proc_dir_entry *proc_ptr, *proc_ralink_wl_video; #endif #ifdef MEM_ALLOC_INFO_SUPPORT extern MEM_INFO_LIST MemInfoList; extern MEM_INFO_LIST PktInfoList; #endif /*MEM_ALLOC_INFO_SUPPORT*/ static struct pci_device_id mt_rbus_tbl[] DEVINITDATA = { #ifdef MT7622 {PCI_DEVICE(0x14c3, 0x7622)}, #endif /* MT7622 */ {} /* terminate list */ }; MODULE_DEVICE_TABLE(pci, mt_rbus_tbl); #define RBUS_TSSI_CTRL_OFFSET 0x34 #define RBUS_PA_LNA_CTRL_OFFSET 0x38 int rbus_tssi_set(struct _RTMP_ADAPTER *ad, UCHAR mode) { struct pci_dev *dev = ((POS_COOKIE)ad->OS_Cookie)->pci_dev; pci_write_config_byte(dev, RBUS_TSSI_CTRL_OFFSET, mode); return 0; } int rbus_pa_lna_set(struct _RTMP_ADAPTER *ad, UINT32 mode) { struct pci_dev *dev = ((POS_COOKIE)ad->OS_Cookie)->pci_dev; pci_write_config_dword(dev, RBUS_PA_LNA_CTRL_OFFSET, mode); return 0; } static int DEVINIT mt_rbus_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) { struct net_device *net_dev; ULONG csr_addr; INT rv; void *handle = NULL; RTMP_ADAPTER *pAd; RTMP_OS_NETDEV_OP_HOOK netDevHook; UINT32 Value; MTWF_LOG(DBG_CAT_HIF, CATHIF_PCI, DBG_LVL_TRACE, ("===> rt2880_probe\n")); if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { /* * pci_set_consistent_dma_mask() will always be able to set the same * or a smaller mask as pci_set_dma_mask() */ pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } else { MTWF_LOG(DBG_CAT_HIF, CATHIF_PCI, DBG_LVL_ERROR, ("set DMA mask failed\n")); goto err_out; } #ifdef MEM_ALLOC_INFO_SUPPORT MemInfoListInital(); #endif /* MEM_ALLOC_INFO_SUPPORT */ /* map physical address to virtual address for accessing register */ csr_addr = (unsigned long)ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); /* Allocate RTMP_ADAPTER adapter structure */ os_alloc_mem(NULL, (UCHAR **)&handle, sizeof(struct os_cookie)); if (!handle) { MTWF_LOG(DBG_CAT_HIF, CATHIF_PCI, DBG_LVL_ERROR, ("Allocate memory for os_cookie failed!\n")); goto err_out; } os_zero_mem(handle, sizeof(struct os_cookie)); #ifdef OS_ABL_FUNC_SUPPORT /* get DRIVER operations */ RTMP_DRV_OPS_FUNCTION(pRtmpDrvOps, NULL, NULL, NULL); #endif /* OS_ABL_FUNC_SUPPORT */ rv = RTMPAllocAdapterBlock(handle, (VOID **)&pAd); if (rv != NDIS_STATUS_SUCCESS) { MTWF_LOG(DBG_CAT_HIF, CATHIF_PCI, DBG_LVL_ERROR, (" RTMPAllocAdapterBlock != NDIS_STATUS_SUCCESS\n")); os_free_mem(handle); goto err_out; } /* Here are the RTMP_ADAPTER structure with rbus-bus specific parameters. */ pAd->PciHif.CSRBaseAddress = (PUCHAR)csr_addr; RTMP_IO_READ32(pAd, TOP_HCR, &Value); pAd->ChipID = Value; /*is not a regular method*/ ((POS_COOKIE)handle)->pci_dev = (VOID *)pdev; ((POS_COOKIE)handle)->pDev = &pdev->dev; RtmpRaDevCtrlInit(pAd, RTMP_DEV_INF_RBUS); net_dev = RtmpPhyNetDevInit(pAd, &netDevHook); if (net_dev == NULL) goto err_out_free_radev; /*assign net_dev as pdev's privdate*/ pci_set_drvdata(pdev, net_dev); /* Here are the net_device structure with pci-bus specific parameters. */ net_dev->irq = pdev->irq; /* Interrupt IRQ number */ net_dev->base_addr = csr_addr; /* Save CSR virtual address and irq to device structure */ RTMP_DRIVER_CHIP_PREPARE(pAd); /*All done, it's time to register the net device to kernel. */ /* Register this device */ rv = RtmpOSNetDevAttach(pAd->OpMode, net_dev, &netDevHook); if (rv) { MTWF_LOG(DBG_CAT_HIF, CATHIF_PCI, DBG_LVL_ERROR, ("failed to call RtmpOSNetDevAttach(), rv=%d!\n", rv)); goto err_out_free_netdev; } MTWF_LOG(DBG_CAT_HIF, CATHIF_PCI, DBG_LVL_TRACE, ("%s: at CSR addr 0x%lx, IRQ %ld.\n", net_dev->name, (ULONG)csr_addr, (long int)net_dev->irq)); MTWF_LOG(DBG_CAT_HIF, CATHIF_PCI, DBG_LVL_TRACE, ("<=== %s()\n", __func__)); #if defined(CONFIG_RA_CLASSIFIER) && (!defined(CONFIG_RA_CLASSIFIER_MODULE)) proc_ptr = proc_ralink_wl_video; if (ra_classifier_init_func != NULL) ra_classifier_init_func(); #endif return 0; err_out_free_netdev: RtmpOSNetDevFree(net_dev); #ifdef MEM_ALLOC_INFO_SUPPORT { UINT32 memalctotal, pktalctotal; memalctotal = ShowMemAllocInfo(); pktalctotal = ShowPktAllocInfo(); if ((memalctotal != 0) || (pktalctotal != 0)) { MTWF_LOG(DBG_CAT_INIT, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("Error: Memory leak!!\n")); ASSERT(0); } MIListExit(&MemInfoList); MIListExit(&PktInfoList); } #endif /* MEM_ALLOC_INFO_SUPPORT */ err_out_free_radev: /* free RTMP_ADAPTER strcuture and os_cookie*/ RTMPFreeAdapter(pAd); err_out: return -ENODEV; } static VOID DEVEXIT mt_rbus_remove(struct pci_dev *pci_dev) { struct net_device *net_dev = pci_get_drvdata(pci_dev); RTMP_ADAPTER *pAd; if (net_dev == NULL) return; /* pAd = net_dev->priv; */ GET_PAD_FROM_NET_DEV(pAd, net_dev); if (pAd != NULL) { RtmpPhyNetDevExit(pAd, net_dev); RtmpRaDevCtrlExit(pAd); } else RtmpOSNetDevDetach(net_dev); /* Free the root net_device. */ RtmpOSNetDevFree(net_dev); #if defined(CONFIG_RA_CLASSIFIER) && (!defined(CONFIG_RA_CLASSIFIER_MODULE)) proc_ptr = proc_ralink_wl_video; if (ra_classifier_release_func != NULL) ra_classifier_release_func(); #endif #ifdef MEM_ALLOC_INFO_SUPPORT { UINT32 memalctotal, pktalctotal; memalctotal = ShowMemAllocInfo(); pktalctotal = ShowPktAllocInfo(); if ((memalctotal != 0) || (pktalctotal != 0)) { MTWF_LOG(DBG_CAT_INIT, DBG_SUBCAT_ALL, DBG_LVL_ERROR, ("Error: Memory leak!!\n")); ASSERT(0); } MIListExit(&MemInfoList); MIListExit(&PktInfoList); } #endif /* MEM_ALLOC_INFO_SUPPORT */ } /* * Our PCI driver structure */ static struct pci_driver mt_rbus_driver = { name: "mt_rbus", id_table : mt_rbus_tbl, probe : mt_rbus_probe, remove : DEVEXIT_P(mt_rbus_remove), }; /* * Driver module load/unload function */ int __init wbsys_module_init(void) { MTWF_LOG(DBG_CAT_HIF, CATHIF_PCI, DBG_LVL_ERROR, ("register %s\n", RTMP_DRV_NAME)); #ifdef MEM_ALLOC_INFO_SUPPORT MemInfoListInital(); #endif /* MEM_ALLOC_INFO_SUPPORT */ return pci_register_driver(&mt_rbus_driver); } void __exit wbsys_module_exit(void) { pci_unregister_driver(&mt_rbus_driver); } /** @} */ /** @} */ #ifndef MULTI_INF_SUPPORT module_init(wbsys_module_init); module_exit(wbsys_module_exit); #endif /* MULTI_INF_SUPPORT */ #endif /* RTMP_RBUS_SUPPORT */
Java
<?php /** * Indonesia Provinces * */ global $pms_states; $pms_states['ID'] = array( 'AC' => __( 'Daerah Istimewa Aceh', 'paid-member-subscriptions' ), 'SU' => __( 'Sumatera Utara', 'paid-member-subscriptions' ), 'SB' => __( 'Sumatera Barat', 'paid-member-subscriptions' ), 'RI' => __( 'Riau', 'paid-member-subscriptions' ), 'KR' => __( 'Kepulauan Riau', 'paid-member-subscriptions' ), 'JA' => __( 'Jambi', 'paid-member-subscriptions' ), 'SS' => __( 'Sumatera Selatan', 'paid-member-subscriptions' ), 'BB' => __( 'Bangka Belitung', 'paid-member-subscriptions' ), 'BE' => __( 'Bengkulu', 'paid-member-subscriptions' ), 'LA' => __( 'Lampung', 'paid-member-subscriptions' ), 'JK' => __( 'DKI Jakarta', 'paid-member-subscriptions' ), 'JB' => __( 'Jawa Barat', 'paid-member-subscriptions' ), 'BT' => __( 'Banten', 'paid-member-subscriptions' ), 'JT' => __( 'Jawa Tengah', 'paid-member-subscriptions' ), 'JI' => __( 'Jawa Timur', 'paid-member-subscriptions' ), 'YO' => __( 'Daerah Istimewa Yogyakarta', 'paid-member-subscriptions' ), 'BA' => __( 'Bali', 'paid-member-subscriptions' ), 'NB' => __( 'Nusa Tenggara Barat', 'paid-member-subscriptions' ), 'NT' => __( 'Nusa Tenggara Timur', 'paid-member-subscriptions' ), 'KB' => __( 'Kalimantan Barat', 'paid-member-subscriptions' ), 'KT' => __( 'Kalimantan Tengah', 'paid-member-subscriptions' ), 'KI' => __( 'Kalimantan Timur', 'paid-member-subscriptions' ), 'KS' => __( 'Kalimantan Selatan', 'paid-member-subscriptions' ), 'KU' => __( 'Kalimantan Utara', 'paid-member-subscriptions' ), 'SA' => __( 'Sulawesi Utara', 'paid-member-subscriptions' ), 'ST' => __( 'Sulawesi Tengah', 'paid-member-subscriptions' ), 'SG' => __( 'Sulawesi Tenggara', 'paid-member-subscriptions' ), 'SR' => __( 'Sulawesi Barat', 'paid-member-subscriptions' ), 'SN' => __( 'Sulawesi Selatan', 'paid-member-subscriptions' ), 'GO' => __( 'Gorontalo', 'paid-member-subscriptions' ), 'MA' => __( 'Maluku', 'paid-member-subscriptions' ), 'MU' => __( 'Maluku Utara', 'paid-member-subscriptions' ), 'PA' => __( 'Papua', 'paid-member-subscriptions' ), 'PB' => __( 'Papua Barat', 'paid-member-subscriptions' ) );
Java
/* * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package test.auctionportal; import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_LANGUAGE; import static com.sun.org.apache.xerces.internal.jaxp.JAXPConstants.JAXP_SCHEMA_SOURCE; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.math.BigInteger; import java.nio.file.Paths; import java.util.GregorianCalendar; import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI; import javax.xml.datatype.DatatypeConstants; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import jaxp.library.JAXPFileReadOnlyBaseTest; import static jaxp.library.JAXPTestUtilities.bomStream; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.TypeInfo; import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS; import static test.auctionportal.HiBidConstants.XML_DIR; /** * This is the user controller class for the Auction portal HiBid.com. */ public class AuctionController extends JAXPFileReadOnlyBaseTest { /** * Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927 * DOMConfiguration.setParameter("well-formed",true) throws an exception. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testCreateNewItem2Sell() throws Exception { String xmlFile = XML_DIR + "novelsInvalid.xml"; Document document = DocumentBuilderFactory.newInstance() .newDocumentBuilder().parse(xmlFile); document.getDomConfig().setParameter("well-formed", true); DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("LS"); MyDOMOutput domOutput = new MyDOMOutput(); domOutput.setByteStream(System.out); LSSerializer writer = impl.createLSSerializer(); writer.write(document, domOutput); } /** * Check for DOMErrorHandler handling DOMError. Before fix of bug 4896132 * test throws DOM Level 1 node error. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testCreateNewItem2SellRetry() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(xmlFile); DOMConfiguration domConfig = document.getDomConfig(); MyDOMErrorHandler errHandler = new MyDOMErrorHandler(); domConfig.setParameter("error-handler", errHandler); DOMImplementationLS impl = (DOMImplementationLS) DOMImplementationRegistry.newInstance() .getDOMImplementation("LS"); LSSerializer writer = impl.createLSSerializer(); MyDOMOutput domoutput = new MyDOMOutput(); domoutput.setByteStream(System.out); writer.write(document, domoutput); document.normalizeDocument(); writer.write(document, domoutput); assertFalse(errHandler.isError()); } /** * Check if setting the attribute to be of type ID works. This will affect * the Attr.isID method according to the spec. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testCreateID() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(xmlFile); Element account = (Element)document .getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0); account.setIdAttributeNS(PORTAL_ACCOUNT_NS, "accountID", true); Attr aID = account.getAttributeNodeNS(PORTAL_ACCOUNT_NS, "accountID"); assertTrue(aID.isId()); } /** * Check the user data on the node. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testCheckingUserData() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document document = docBuilder.parse(xmlFile); Element account = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Account").item(0); assertEquals(account.getNodeName(), "acc:Account"); Element firstName = (Element) document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "FirstName").item(0); assertEquals(firstName.getNodeName(), "FirstName"); Document doc1 = docBuilder.newDocument(); Element someName = doc1.createElement("newelem"); someName.setUserData("mykey", "dd", (operation, key, data, src, dst) -> { System.err.println("In UserDataHandler" + key); System.out.println("In UserDataHandler"); }); Element impAccount = (Element)document.importNode(someName, true); assertEquals(impAccount.getNodeName(), "newelem"); document.normalizeDocument(); String data = (someName.getUserData("mykey")).toString(); assertEquals(data, "dd"); } /** * Check the UTF-16 XMLEncoding xml file. * * @throws Exception If any errors occur. * @see <a href="content/movies.xml">movies.xml</a> */ @Test(groups = {"readLocalFiles"}) public void testCheckingEncoding() throws Exception { // Note since movies.xml is UTF-16 encoding. We're not using stanard XML // file suffix. String xmlFile = XML_DIR + "movies.xml.data"; try (InputStream source = bomStream("UTF-16", xmlFile)) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(source); assertEquals(document.getXmlEncoding(), "UTF-16"); assertEquals(document.getXmlStandalone(), true); } } /** * Check validation API features. A schema which is including in Bug 4909119 * used to be testing for the functionalities. * * @throws Exception If any errors occur. * @see <a href="content/userDetails.xsd">userDetails.xsd</a> */ @Test(groups = {"readLocalFiles"}) public void testGetOwnerInfo() throws Exception { String schemaFile = XML_DIR + "userDetails.xsd"; String xmlFile = XML_DIR + "userDetails.xml"; try(FileInputStream fis = new FileInputStream(xmlFile)) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI); SchemaFactory schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(Paths.get(schemaFile).toFile()); Validator validator = schema.newValidator(); MyErrorHandler eh = new MyErrorHandler(); validator.setErrorHandler(eh); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); docBuilder.setErrorHandler(eh); Document document = docBuilder.parse(fis); DOMResult dResult = new DOMResult(); DOMSource domSource = new DOMSource(document); validator.validate(domSource, dResult); assertFalse(eh.isAnyError()); } } /** * Check grammar caching with imported schemas. * * @throws Exception If any errors occur. * @see <a href="content/coins.xsd">coins.xsd</a> * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a> */ @Test(groups = {"readLocalFiles"}) public void testGetOwnerItemList() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; try(FileInputStream fis = new FileInputStream(xmlFile)) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI); dbf.setValidating(false); SchemaFactory schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(new File(((xsdFile)))); MyErrorHandler eh = new MyErrorHandler(); Validator validator = schema.newValidator(); validator.setErrorHandler(eh); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); Document document = docBuilder.parse(fis); validator.validate(new DOMSource(document), new DOMResult()); assertFalse(eh.isAnyError()); } } /** * Check for the same imported schemas but will use SAXParserFactory and try * parsing using the SAXParser. SCHEMA_SOURCE attribute is using for this * test. * * @throws Exception If any errors occur. * @see <a href="content/coins.xsd">coins.xsd</a> * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a> */ @Test(groups = {"readLocalFiles"}) public void testGetOwnerItemList1() throws Exception { String xsdFile = XML_DIR + "coins.xsd"; String xmlFile = XML_DIR + "coins.xml"; SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); spf.setValidating(true); SAXParser sp = spf.newSAXParser(); sp.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI); sp.setProperty(JAXP_SCHEMA_SOURCE, xsdFile); MyErrorHandler eh = new MyErrorHandler(); sp.parse(new File(xmlFile), eh); assertFalse(eh.isAnyError()); } /** * Check usage of javax.xml.datatype.Duration class. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testGetItemDuration() throws Exception { String xmlFile = XML_DIR + "itemsDuration.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); Document document = dbf.newDocumentBuilder().parse(xmlFile); Element durationElement = (Element) document.getElementsByTagName("sellDuration").item(0); NodeList childList = durationElement.getChildNodes(); for (int i = 0; i < childList.getLength(); i++) { System.out.println("child " + i + childList.item(i)); } Duration duration = DatatypeFactory.newInstance().newDuration("P365D"); Duration sellDuration = DatatypeFactory.newInstance().newDuration(childList.item(0).getNodeValue()); assertFalse(sellDuration.isShorterThan(duration)); assertFalse(sellDuration.isLongerThan(duration)); assertEquals(sellDuration.getField(DatatypeConstants.DAYS), BigInteger.valueOf(365)); assertEquals(sellDuration.normalizeWith(new GregorianCalendar(1999, 2, 22)), duration); Duration myDuration = sellDuration.add(duration); assertEquals(myDuration.normalizeWith(new GregorianCalendar(2003, 2, 22)), DatatypeFactory.newInstance().newDuration("P730D")); } /** * Check usage of TypeInfo interface introduced in DOM L3. * * @throws Exception If any errors occur. */ @Test(groups = {"readLocalFiles"}) public void testGetTypeInfo() throws Exception { String xmlFile = XML_DIR + "accountInfo.xml"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setValidating(true); dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); docBuilder.setErrorHandler(new MyErrorHandler()); Document document = docBuilder.parse(xmlFile); Element userId = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "UserID").item(0); TypeInfo typeInfo = userId.getSchemaTypeInfo(); assertTrue(typeInfo.getTypeName().equals("nonNegativeInteger")); assertTrue(typeInfo.getTypeNamespace().equals(W3C_XML_SCHEMA_NS_URI)); Element role = (Element)document.getElementsByTagNameNS(PORTAL_ACCOUNT_NS, "Role").item(0); TypeInfo roletypeInfo = role.getSchemaTypeInfo(); assertTrue(roletypeInfo.getTypeName().equals("BuyOrSell")); assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS)); } }
Java
<?php /** * Custom functions that act independently of the theme templates * * Eventually, some of the functionality here could be replaced by core features * * @package Decode */ /** * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. */ if ( ! function_exists( 'decode_page_menu_args' ) ) { function decode_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'decode_page_menu_args' ); } /** * Adds custom classes to the array of body classes. */ if ( ! function_exists( 'decode_body_classes' ) ) { function decode_body_classes( $classes ) { // Adds a class of group-blog to blogs with more than 1 published author if ( is_multi_author() ) { $classes[] = 'group-blog'; } return $classes; } } add_filter( 'body_class', 'decode_body_classes' ); /** * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages */ if ( ! function_exists( 'decode_enhanced_image_navigation' ) ) { function decode_enhanced_image_navigation( $url, $id ) { if ( ! is_attachment() && ! wp_attachment_is_image( $id ) ) return $url; $image = get_post( $id ); if ( ! empty( $image->post_parent ) && $image->post_parent != $id ) $url .= '#main'; return $url; } } add_filter( 'attachment_link', 'decode_enhanced_image_navigation', 10, 2 ); /** * Highlight search terms in search results. */ function decode_highlight_search_results( $text ) { if ( is_search() ) { $sr = get_search_query(); $keys = implode( '|', explode( ' ', get_search_query() ) ); if ($keys != '') { // Check for empty search, and don't modify text if empty $text = preg_replace( '/(' . $keys .')/iu', '<mark class="search-highlight">\0</mark>', $text ); } } return $text; } add_filter( 'the_excerpt', 'decode_highlight_search_results' ); add_filter( 'the_title', 'decode_highlight_search_results' ); /** * Link to post in excerpt [...] links. */ if ( ! function_exists( 'link_ellipses' ) ) { function link_ellipses( $more ) { if ( ! is_search() ) { return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">[&hellip;]</a>'; } } } add_filter( 'excerpt_more', 'link_ellipses' ); if ( ! function_exists( '_wp_render_title_tag' ) ) : /** * Filters wp_title to print a neat <title> tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function decode_wp_title( $title, $sep ) { if ( is_feed() ) { return $title; } global $page, $paged; // Add the blog name $title .= get_bloginfo( 'name', 'display' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title .= " $sep $site_description"; } // Add a page number if necessary: if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title .= " $sep " . sprintf( __( 'Page %s', 'decode' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'decode_wp_title', 10, 2 ); endif; if ( ! function_exists( '_wp_render_title_tag' ) ) : /** * Title shim for sites older than WordPress 4.1. * * @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ * @todo Remove this function when WordPress 4.3 is released. */ function decode_render_title() { ?> <title><?php wp_title( '|', false, 'right' ); ?></title> <?php } add_action( 'wp_head', 'decode_render_title' ); endif; /** * Sets the authordata global when viewing an author archive. * * This provides backwards compatibility for WP versions below 3.7 * that don't have this change: * http://core.trac.wordpress.org/changeset/25574. * * It removes the need to call the_post() and rewind_posts() in an author * template to print information about the author. * * @global WP_Query $wp_query WordPress Query object. * @return void */ if ( ! function_exists( 'decode_setup_author' ) ) { function decode_setup_author() { global $wp_query; if ( $wp_query->is_author() && isset( $wp_query->post ) ) { $GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author ); } } } add_action( 'wp', 'decode_setup_author' );
Java
/* Adept MobileRobots Robotics Interface for Applications (ARIA) Copyright (C) 2004-2005 ActivMedia Robotics LLC Copyright (C) 2006-2010 MobileRobots Inc. Copyright (C) 2011-2014 Adept Technology 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 If you wish to redistribute ARIA under different terms, contact Adept MobileRobots for information about a commercial version of ARIA at robots@mobilerobots.com or Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960 */ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 1.3.40 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package com.mobilerobots.Aria; public class ArUrg extends ArLaser { /* (begin code from javabody_derived typemap) */ private long swigCPtr; /* for internal use by swig only */ public ArUrg(long cPtr, boolean cMemoryOwn) { super(AriaJavaJNI.SWIGArUrgUpcast(cPtr), cMemoryOwn); swigCPtr = cPtr; } /* for internal use by swig only */ public static long getCPtr(ArUrg obj) { return (obj == null) ? 0 : obj.swigCPtr; } /* (end code from javabody_derived typemap) */ protected void finalize() { delete(); } public synchronized void delete() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; AriaJavaJNI.delete_ArUrg(swigCPtr); } swigCPtr = 0; } super.delete(); } public ArUrg(int laserNumber, String name) { this(AriaJavaJNI.new_ArUrg__SWIG_0(laserNumber, name), true); } public ArUrg(int laserNumber) { this(AriaJavaJNI.new_ArUrg__SWIG_1(laserNumber), true); } public boolean blockingConnect() { return AriaJavaJNI.ArUrg_blockingConnect(swigCPtr, this); } public boolean asyncConnect() { return AriaJavaJNI.ArUrg_asyncConnect(swigCPtr, this); } public boolean disconnect() { return AriaJavaJNI.ArUrg_disconnect(swigCPtr, this); } public boolean isConnected() { return AriaJavaJNI.ArUrg_isConnected(swigCPtr, this); } public boolean isTryingToConnect() { return AriaJavaJNI.ArUrg_isTryingToConnect(swigCPtr, this); } public void log() { AriaJavaJNI.ArUrg_log(swigCPtr, this); } }
Java
/* Definitions for bytecode */ #ifndef Py_COMPILE_H #define Py_COMPILE_H #ifdef __cplusplus extern "C" { #endif /* Bytecode object */ typedef struct { PyObject_HEAD int co_argcount; /* #arguments, except *args */ int co_nlocals; /* #local variables */ int co_stacksize; /* #entries needed for evaluation stack */ int co_flags; /* CO_..., see below */ PyObject *co_code; /* instruction opcodes */ PyObject *co_consts; /* list (constants used) */ PyObject *co_names; /* list of strings (names used) */ PyObject *co_varnames; /* tuple of strings (local variable names) */ PyObject *co_freevars; /* tuple of strings (free variable names) */ PyObject *co_cellvars; /* tuple of strings (cell variable names) */ /* The rest doesn't count for hash/cmp */ PyObject *co_filename; /* string (where it was loaded from) */ PyObject *co_name; /* string (name, for reference) */ int co_firstlineno; /* first source line number */ PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) */ } PyCodeObject; /* Masks for co_flags above */ #define CO_OPTIMIZED 0x0001 #define CO_NEWLOCALS 0x0002 #define CO_VARARGS 0x0004 #define CO_VARKEYWORDS 0x0008 #define CO_NESTED 0x0010 #define CO_GENERATOR 0x0020 /* The CO_NOFREE flag is set if there are no free or cell variables. This information is redundant, but it allows a single flag test to determine whether there is any extra work to be done when the call frame it setup. */ #define CO_NOFREE 0x0040 /* XXX Temporary hack. Until generators are a permanent part of the language, we need a way for a code object to record that generators were *possible* when it was compiled. This is so code dynamically compiled *by* a code object knows whether to allow yield stmts. In effect, this passes on the "from __future__ import generators" state in effect when the code block was compiled. */ #define CO_GENERATOR_ALLOWED 0x1000 /* no longer used in an essential way */ #define CO_FUTURE_DIVISION 0x2000 PyAPI_DATA(PyTypeObject) PyCode_Type; #define PyCode_Check(op) ((op)->ob_type == &PyCode_Type) #define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) #define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ /* Public interface */ struct _node; /* Declare the existence of this type */ PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); PyAPI_FUNC(PyCodeObject *) PyCode_New( int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); /* same as struct above */ PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); /* Future feature support */ typedef struct { int ff_found_docstring; int ff_last_lineno; int ff_features; } PyFutureFeatures; PyAPI_FUNC(PyFutureFeatures *) PyNode_Future(struct _node *, const char *); PyAPI_FUNC(PyCodeObject *) PyNode_CompileFlags(struct _node *, const char *, PyCompilerFlags *); #define FUTURE_NESTED_SCOPES "nested_scopes" #define FUTURE_GENERATORS "generators" #define FUTURE_DIVISION "division" /* for internal use only */ #define _PyCode_GETCODEPTR(co, pp) \ ((*(co)->co_code->ob_type->tp_as_buffer->bf_getreadbuffer) \ ((co)->co_code, 0, (void **)(pp))) #ifdef __cplusplus } #endif #endif /* !Py_COMPILE_H */
Java
#include <Instrument.h> // the base class for this instrument #include <vector> using std::vector; class PHASER : public Instrument { public: PHASER(); virtual ~PHASER(); virtual int init(double *, int); virtual int configure(); virtual int run(); private: void doupdate(); float *_in; int _nargs, _inchan, _branch; float _amp, _wetdry, _pan, _lfofreq, _reverbtime; int _insamps; int _numfilters; Ooscili *lfo; Oallpassi *allpassptr; // temporary pointer to initialize vector vector<Oallpassi*> _filtervector; // array of allpass filters };
Java
<HTML> <CENTER><A HREF = "http://lammps.sandia.gov">LAMMPS WWW Site</A> - <A HREF = "Manual.html">LAMMPS Documentation</A> - <A HREF = "Section_commands.html#comm">LAMMPS Commands</A> </CENTER> <HR> <H3>compute smd/ulsph_stress command </H3> <P><B>Syntax:</B> </P> <PRE>compute ID group-ID smd/ulsph_stress </PRE> <UL><LI>ID, group-ID are documented in <A HREF = "compute.html">compute</A> command <LI>smd/ulsph_stress = style name of this compute command </UL> <P><B>Examples:</B> </P> <PRE>compute 1 all smd/ulsph_stress </PRE> <P><B>Description:</B> </P> <P>Define a computation that outputs the Cauchy stress tensor. </P> <P>See <A HREF = "USER/smd/SMD_LAMMPS_userguide.pdf">this PDF guide</A> to using Smooth Mach Dynamics in LAMMPS. </P> <P><B>Output info:</B> </P> <P>This compute calculates a per-particle vector of vectors (tensors), which can be accessed by any command that uses per-particle values from a compute as input. See <A HREF = "Section_howto.html#howto_15">Section_howto 15</A> for an overview of LAMMPS output options. </P> <P>The values will be given in <A HREF = "units.html">units</A> of pressure. </P> <P>The per-particle vector has 7 entries. The first six entries correspond to the xx, yy, zz, xy, xz, yz components of the symmetric Cauchy stress tensor. The seventh entry is the second invariant of the stress tensor, i.e., the von Mises equivalent stress. </P> <P><B>Restrictions:</B> </P> <P>This compute is part of the USER-SMD package. It is only enabled if LAMMPS was built with that package. See the <A HREF = "Section_start.html#start_3">Making LAMMPS</A> section for more info. This compute can only be used for particles which interact with the updated Lagrangian SPH pair style. </P> <P><B>Related commands:</B> </P> <PRE><A HREF = "compute_smd_ulsph_strain.html">smd/ulsph_strain</A>, <A HREF = "compute_smd_ulsph_strain_rate.html">smd/ulsph_strain_rate</A> <A HREF = "compute_smd_tlsph_stress.html">smd/tlsph_stress</A> </PRE> <P><B>Default:</B> none </P> </HTML>
Java
// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // // Olena 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, version 2 of the License. // // Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>. // // As a special exception, you may use this file as part of a free // software project without restriction. Specifically, if other files // instantiate templates or use macros or inline functions from this // file, or you compile this file and link it with other files to produce // an executable, this file does not by itself cause the resulting // executable to be covered by the GNU General Public License. This // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. #include <mln/core/image/image2d.hh> #include <mln/core/image/dmorph/sub_image.hh> #include <mln/core/image/dmorph/image_if.hh> #include <mln/fun/p2b/chess.hh> #include <mln/border/get.hh> #include <mln/literal/origin.hh> struct f_box2d_t : mln::Function_v2b< f_box2d_t > { f_box2d_t(const mln::box2d& b) : b_(b) { } mln::box2d b_; bool operator()(const mln::point2d& p) const { return b_.has(p); } }; int main() { using namespace mln; typedef image2d<int> I; box2d b(literal::origin, point2d(1,1)); f_box2d_t f_b(b); I ima(3,3, 51); mln_assertion(border::get(ima) == 51); mln_assertion(ima.has(point2d(2,2)) == true); sub_image<I, box2d> sub(ima, b); mln_assertion(sub.has(point2d(2,2)) == false && sub.has(point2d(2,2)) == false); mln_assertion(border::get(sub) == 0); image_if<I, f_box2d_t> imaif(ima, f_b); mln_assertion(imaif.has(point2d(2,2)) == false && ima.has(point2d(2,2)) == true); mln_assertion(border::get(imaif) == 0); mln_assertion(border::get((ima | b) | f_b) == 0); }
Java
<?php /** * GISMO block * * @package block_gismo * @copyright eLab Christian Milani * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ // error mode $error_mode = (isset($error_mode) AND in_array($error_mode, array("json", "moodle"))) ? $error_mode : "moodle"; // define constants if (!defined('ROOT')) { //define('ROOT', (realpath(dirname( __FILE__ )) . DIRECTORY_SEPARATOR)); define('ROOT', substr(realpath(dirname(__FILE__)), 0, stripos(realpath(dirname(__FILE__)), "blocks", 0)) . 'blocks/gismo/'); } //$path_base=substr(realpath(dirname( __FILE__ )),0,stripos(realpath(dirname( __FILE__ )),"blocks",0)).'blocks/gismo/'; if (!defined('LIB_DIR')) { define('LIB_DIR', ROOT . "lib" . DIRECTORY_SEPARATOR); //define('LIB_DIR', $path_base . "lib" . DIRECTORY_SEPARATOR); } // include moodle config file require_once realpath(ROOT . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "config.php"); $q = optional_param('q', '', PARAM_TEXT); $srv_data_encoded = required_param('srv_data',PARAM_RAW); // query filter between pages $query = (isset($q)) ? addslashes($q) : ''; // LIBRARIES MANAGEMENT // Please use this section to set server side and cliend side libraries to be included // server side: please note that '.php' extension will be automatically added $server_side_libraries = array("third_parties" => array()); // client side: please note that '.js' extension will NOT be automatically added, in order to allow to create file thgat can be parsed by PHP $client_side_libraries = array("gismo" => array("gismo.js.php", "top_menu.js.php", "left_menu.js.php", "time_line.js", "gismo_util.js"), "third_parties" => array("jquery/jquery-1.10.0.min.js", "jquery-ui-1.10.3/js/jquery-ui-1.10.3.custom.min.js", "jqplot.1.0.8r1250/jquery.jqplot.min.js", "jqplot.1.0.8r1250/plugins/jqplot.barRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.canvasAxisLabelRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.canvasAxisTickRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.canvasTextRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.categoryAxisRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.dateAxisRenderer.min.js", "jqplot.1.0.8r1250/plugins/jqplot.highlighter.min.js", "jqplot.1.0.8r1250/plugins/jqplot.pointLabels.min.js", "simpleFadeSlideShow/fadeSlideShow.min.js" )); // include server-side libraries libraries if (is_array($server_side_libraries) AND count($server_side_libraries) > 0) { foreach ($server_side_libraries as $key => $server_side_libs) { if (is_array($server_side_libs) AND count($server_side_libs) > 0) { foreach ($server_side_libs as $server_side_lib) { $lib_full_path = LIB_DIR . $key . DIRECTORY_SEPARATOR . "server_side" . DIRECTORY_SEPARATOR . $server_side_lib . ".php"; if (is_file($lib_full_path) AND is_readable($lib_full_path)) { require_once $lib_full_path; } } } } } // check input data if (!isset($srv_data_encoded)) { block_gismo\GISMOutil::gismo_error('err_srv_data_not_set', $error_mode); exit; } $srv_data = (object) unserialize(base64_decode(urldecode($srv_data_encoded))); // course id if (!property_exists($srv_data, "course_id")) { block_gismo\GISMOutil::gismo_error('err_course_not_set', $error_mode); exit; } // block instance id if (!property_exists($srv_data, "block_instance_id")) { block_gismo\GISMOutil::gismo_error('err_block_instance_id_not_set', $error_mode); exit; } // check authentication switch ($error_mode) { case "json": try { require_login($srv_data->course_id, false, NULL, true, true); } catch (Exception $e) { block_gismo\GISMOutil::gismo_error("err_authentication", $error_mode); exit; } break; case "moodle": default: require_login(); break; } // extract the course if (!$course = $DB->get_record("course", array("id" => intval($srv_data->course_id)))) { block_gismo\GISMOutil::gismo_error('err_course_not_set', $error_mode); exit; } // context $context_obj = context_block::instance(intval($srv_data->block_instance_id)); //Get block_gismo settings $gismoconfig = get_config('block_gismo'); if ($gismoconfig->student_reporting === "false") { // check authorization require_capability('block/gismo:view', $context_obj); } // get gismo settings $gismo_settings = $DB->get_field("block_instances", "configdata", array("id" => intval($srv_data->block_instance_id))); if (is_null($gismo_settings) OR $gismo_settings === "") { $gismo_settings = get_object_vars(block_gismo\GISMOutil::get_default_options()); } else { $gismo_settings = get_object_vars(unserialize(base64_decode($gismo_settings))); if (is_array($gismo_settings) AND count($gismo_settings) > 0) { foreach ($gismo_settings as $key => $value) { if (is_numeric($value)) { if (strval(intval($value)) === strval($value)) { $gismo_settings[$key] = intval($value); } else if (strval(floatval($value)) === strval($value)) { $gismo_settings[$key] = floatval($value); } } } } // include_hidden_items if (!array_key_exists("include_hidden_items", $gismo_settings)) { $gismo_settings["include_hidden_items"] = 1; } } $block_gismo_config = json_encode($gismo_settings); // actor (teacher or student) $actor = "student"; if (has_capability("block/gismo:trackuser", $context_obj)) { $actor = "student"; } if (has_capability("block/gismo:trackteacher", $context_obj)) { $actor = "teacher"; } ?>
Java
#!/usr/bin/env python """ gateway tests - Users Copyright 2009 Glencoe Software, Inc. All rights reserved. Use is subject to license terms supplied in LICENSE.txt """ import unittest import omero import gatewaytest.library as lib from omero.gateway.scripts import dbhelpers class UserTest (lib.GTest): def testUsers (self): self.loginAsUser() # Try reconnecting without disconnect self._has_connected = False self.doConnect() self.loginAsAuthor() self.loginAsAdmin() def testSaveAs (self): for u in (self.AUTHOR, self.ADMIN): # Test image should be owned by author self.loginAsAuthor() image = self.getTestImage() ownername = image.getOwnerOmeName() # Now login as author or admin self.doLogin(u) self.gateway.SERVICE_OPTS.setOmeroGroup('-1') image = self.getTestImage() self.assertEqual(ownername, self.AUTHOR.name) # Create some object param = omero.sys.Parameters() param.map = {'ns': omero.rtypes.rstring('weblitz.UserTest.testSaveAs')} anns = self.gateway.getQueryService().findAllByQuery('from CommentAnnotation as a where a.ns=:ns', param) self.assertEqual(len(anns), 0) self.gateway.SERVICE_OPTS.setOmeroGroup() ann = omero.gateway.CommentAnnotationWrapper(conn=self.gateway) ann.setNs(param.map['ns'].val) ann.setValue('foo') ann.saveAs(image.getDetails()) # Annotations are owned by author self.loginAsAuthor() try: anns = self.gateway.getQueryService().findAllByQuery('from CommentAnnotation as a where a.ns=:ns', param) self.assertEqual(len(anns), 1) self.assertEqual(omero.gateway.CommentAnnotationWrapper(self.gateway, anns[0]).getOwnerOmeName(), self.AUTHOR.name) finally: self.gateway.getUpdateService().deleteObject(ann._obj) anns = self.gateway.getQueryService().findAllByQuery('from CommentAnnotation as a where a.ns=:ns', param) self.assertEqual(len(anns), 0) def testCrossGroupSave (self): self.loginAsUser() uid = self.gateway.getUserId() self.loginAsAdmin() self.gateway.SERVICE_OPTS.setOmeroGroup('-1') d = self.getTestDataset() did = d.getId() g = d.getDetails().getGroup() admin = self.gateway.getAdminService() admin.addGroups(omero.model.ExperimenterI(uid, False), [g._obj]) self.gateway.SERVICE_OPTS.setOmeroGroup('-1') # make sure the group is groupwrite enabled perms = str(d.getDetails().getGroup().getDetails().permissions) admin.changePermissions(g._obj, omero.model.PermissionsI('rwrw--')) d = self.getTestDataset() g = d.getDetails().getGroup() self.assert_(g.getDetails().permissions.isGroupWrite()) self.loginAsUser() # User is now a member of the group to which testDataset belongs, which has groupWrite==True # But the default group for User is diferent try: self.gateway.SERVICE_OPTS.setOmeroGroup('-1') d = self.getTestDataset() did = d.getId() n = d.getName() d.setName(n+'_1') d.save() d = self.gateway.getObject('dataset', did) self.assertEqual(d.getName(), n+'_1') d.setName(n) d.save() d = self.gateway.getObject('dataset', did) self.assertEqual(d.getName(), n) finally: self.loginAsAdmin() admin = self.gateway.getAdminService() # Revert group permissions and remove user from group admin.changePermissions(g._obj, omero.model.PermissionsI(perms)) admin.removeGroups(omero.model.ExperimenterI(uid, False), [g._obj]) def testCrossGroupRead (self): self.loginAsAuthor() u = self.gateway.getUpdateService() p = self.getTestProject() self.assertEqual(str(p.getDetails().permissions)[4], '-') d = p.getDetails() g = d.getGroup() self.loginAsUser() self.gateway.SERVICE_OPTS.setOmeroGroup('-1') self.assert_(not g.getId() in self.gateway.getEventContext().memberOfGroups) self.assertEqual(self.gateway.getObject('project', p.getId()), None) def testGroupOverObjPermissions (self): """ Object accesss must be dependent only of group permissions """ ns = 'omero.test.ns' # Author self.loginAsAuthor() # create group with rw---- # create project and annotation in that group p = dbhelpers.ProjectEntry('testAnnotationPermissions', None, create_group='testAnnotationPermissions', group_perms='rw----') try: p = p.create(self.gateway) except dbhelpers.BadGroupPermissionsException: self.loginAsAdmin() admin = self.gateway.getAdminService() admin.changePermissions(admin.lookupGroup('testAnnotationPermissions'), omero.model.PermissionsI('rw----')) self.loginAsAuthor() p = p.create(self.gateway) pid = p.getId() g = p.getDetails().getGroup()._obj try: # Admin # add User to group self.loginAsUser() uid = self.gateway.getUserId() self.loginAsAdmin() admin = self.gateway.getAdminService() admin.addGroups(omero.model.ExperimenterI(uid, False), [g]) # User # try to read project and annotation, which fails self.loginAsUser() self.gateway.SERVICE_OPTS.setOmeroGroup('-1') self.assertEqual(self.gateway.getObject('project', pid), None) # Admin # Chmod project to rwrw-- self.loginAsAdmin() admin = self.gateway.getAdminService() admin.changePermissions(g, omero.model.PermissionsI('rwrw--')) # Author # check project has proper permissions self.loginAsAuthor() self.gateway.SERVICE_OPTS.setOmeroGroup('-1') pa = self.gateway.getObject('project', pid) self.assertNotEqual(pa, None) # User # read project and annotation self.loginAsUser() self.gateway.SERVICE_OPTS.setOmeroGroup('-1') self.assertNotEqual(self.gateway.getObject('project', pid), None) finally: self.loginAsAuthor() handle = self.gateway.deleteObjects('Project', [p.getId()], deleteAnns=True, deleteChildren=True) self.waitOnCmd(self.gateway.c, handle) if __name__ == '__main__': unittest.main()
Java
<?php /** * The following variables are available in this template: * - $this: the CrudCode object */ ?> <div id="mainPage" class="main"> <?php echo "<?php\n"; $nameColumn = $this->guessNameColumn($this->tableSchema->columns); $label = $this->pluralize($this->class2name($this->modelClass)); echo "\$this->breadcrumbs=array( '$label'=>array('index'), \$model->{$nameColumn}=>array('view','id'=>\$model->{$this->tableSchema->primaryKey}), 'Update', );\n"; ?> $title=Yii::t('default', 'Update <?php echo $this->modelClass ?>: '); $contextDesc = Yii::t('default', 'Available actions that may be taken on <?php echo $this->modelClass; ?>.'); $this->menu=array( array('label'=> Yii::t('default', 'Create a new <?php echo $this->modelClass; ?>'), 'url'=>array('create'),'description' => Yii::t('default', 'This action create a new <?php echo $this->modelClass; ?>')), array('label'=> Yii::t('default', 'List <?php echo $this->modelClass; ?>'), 'url'=>array('index'),'description' => Yii::t('default', 'This action list all <?php echo $this->pluralize($this->class2name($this->modelClass)) ?>, you can search, delete and update')), ); ?> <div class="twoColumn"> <div class="columnone" style="padding-right: 1em"> <?php echo "<?php echo \$this->renderPartial('_form', array('model'=>\$model,'title'=>\$title)); ?>"; ?> </div> <div class="columntwo"> <?php echo "<?php echo \$this->renderPartial('////common/defaultcontext', array('contextDesc'=>\$contextDesc)); ?>"; ?> </div> </div> </div>
Java
/* Copyright 2007-2011 David Robillard <http://drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #define _XOPEN_SOURCE 500 #include <assert.h> #include <locale.h> #include <stdlib.h> #include <string.h> #include "lilv_internal.h" static void lilv_node_set_numerics_from_string(LilvNode* val) { char* locale; char* endptr; switch (val->type) { case LILV_VALUE_URI: case LILV_VALUE_BLANK: case LILV_VALUE_STRING: break; case LILV_VALUE_INT: // FIXME: locale kludge, need a locale independent strtol locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); setlocale(LC_NUMERIC, "POSIX"); val->val.int_val = strtol(val->str_val, &endptr, 10); setlocale(LC_NUMERIC, locale); free(locale); break; case LILV_VALUE_FLOAT: // FIXME: locale kludge, need a locale independent strtod locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); setlocale(LC_NUMERIC, "POSIX"); val->val.float_val = strtod(val->str_val, &endptr); setlocale(LC_NUMERIC, locale); free(locale); break; case LILV_VALUE_BOOL: val->val.bool_val = (!strcmp(val->str_val, "true")); break; } } /** Note that if @a type is numeric or boolean, the returned value is corrupt * until lilv_node_set_numerics_from_string is called. It is not * automatically called from here to avoid overhead and imprecision when the * exact string value is known. */ LilvNode* lilv_node_new(LilvWorld* world, LilvNodeType type, const char* str) { LilvNode* val = malloc(sizeof(struct LilvNodeImpl)); val->world = world; val->type = type; switch (type) { case LILV_VALUE_URI: val->val.uri_val = sord_new_uri(world->world, (const uint8_t*)str); val->str_val = (char*)sord_node_get_string(val->val.uri_val); break; case LILV_VALUE_BLANK: val->val.uri_val = sord_new_blank(world->world, (const uint8_t*)str); val->str_val = (char*)sord_node_get_string(val->val.uri_val); case LILV_VALUE_STRING: case LILV_VALUE_INT: case LILV_VALUE_FLOAT: case LILV_VALUE_BOOL: val->str_val = lilv_strdup(str); break; } return val; } /** Create a new LilvNode from @a node, or return NULL if impossible */ LilvNode* lilv_node_new_from_node(LilvWorld* world, const SordNode* node) { LilvNode* result = NULL; SordNode* datatype_uri = NULL; LilvNodeType type = LILV_VALUE_STRING; switch (sord_node_get_type(node)) { case SORD_URI: result = malloc(sizeof(struct LilvNodeImpl)); result->world = (LilvWorld*)world; result->type = LILV_VALUE_URI; result->val.uri_val = sord_node_copy(node); result->str_val = (char*)sord_node_get_string(result->val.uri_val); break; case SORD_BLANK: result = malloc(sizeof(struct LilvNodeImpl)); result->world = (LilvWorld*)world; result->type = LILV_VALUE_BLANK; result->val.uri_val = sord_node_copy(node); result->str_val = (char*)sord_node_get_string(result->val.uri_val); break; case SORD_LITERAL: datatype_uri = sord_node_get_datatype(node); if (datatype_uri) { if (sord_node_equals(datatype_uri, world->xsd_boolean_node)) type = LILV_VALUE_BOOL; else if (sord_node_equals(datatype_uri, world->xsd_decimal_node) || sord_node_equals(datatype_uri, world->xsd_double_node)) type = LILV_VALUE_FLOAT; else if (sord_node_equals(datatype_uri, world->xsd_integer_node)) type = LILV_VALUE_INT; else LILV_ERRORF("Unknown datatype `%s'\n", sord_node_get_string(datatype_uri)); } result = lilv_node_new(world, type, (const char*)sord_node_get_string(node)); switch (result->type) { case LILV_VALUE_INT: case LILV_VALUE_FLOAT: case LILV_VALUE_BOOL: lilv_node_set_numerics_from_string(result); default: break; } break; default: assert(false); } return result; } LILV_API LilvNode* lilv_new_uri(LilvWorld* world, const char* uri) { return lilv_node_new(world, LILV_VALUE_URI, uri); } LILV_API LilvNode* lilv_new_string(LilvWorld* world, const char* str) { return lilv_node_new(world, LILV_VALUE_STRING, str); } LILV_API LilvNode* lilv_new_int(LilvWorld* world, int val) { char str[32]; snprintf(str, sizeof(str), "%d", val); LilvNode* ret = lilv_node_new(world, LILV_VALUE_INT, str); ret->val.int_val = val; return ret; } LILV_API LilvNode* lilv_new_float(LilvWorld* world, float val) { char str[32]; snprintf(str, sizeof(str), "%f", val); LilvNode* ret = lilv_node_new(world, LILV_VALUE_FLOAT, str); ret->val.float_val = val; return ret; } LILV_API LilvNode* lilv_new_bool(LilvWorld* world, bool val) { LilvNode* ret = lilv_node_new(world, LILV_VALUE_BOOL, val ? "true" : "false"); ret->val.bool_val = val; return ret; } LILV_API LilvNode* lilv_node_duplicate(const LilvNode* val) { if (val == NULL) return NULL; LilvNode* result = malloc(sizeof(struct LilvNodeImpl)); result->world = val->world; result->type = val->type; switch (val->type) { case LILV_VALUE_URI: case LILV_VALUE_BLANK: result->val.uri_val = sord_node_copy(val->val.uri_val); result->str_val = (char*)sord_node_get_string(result->val.uri_val); break; default: result->str_val = lilv_strdup(val->str_val); result->val = val->val; } return result; } LILV_API void lilv_node_free(LilvNode* val) { if (val) { switch (val->type) { case LILV_VALUE_URI: case LILV_VALUE_BLANK: sord_node_free(val->world->world, val->val.uri_val); break; default: free(val->str_val); } free(val); } } LILV_API bool lilv_node_equals(const LilvNode* value, const LilvNode* other) { if (value == NULL && other == NULL) return true; else if (value == NULL || other == NULL) return false; else if (value->type != other->type) return false; switch (value->type) { case LILV_VALUE_URI: return sord_node_equals(value->val.uri_val, other->val.uri_val); case LILV_VALUE_BLANK: case LILV_VALUE_STRING: return !strcmp(value->str_val, other->str_val); case LILV_VALUE_INT: return (value->val.int_val == other->val.int_val); case LILV_VALUE_FLOAT: return (value->val.float_val == other->val.float_val); case LILV_VALUE_BOOL: return (value->val.bool_val == other->val.bool_val); } return false; /* shouldn't get here */ } LILV_API char* lilv_node_get_turtle_token(const LilvNode* value) { size_t len = 0; char* result = NULL; char* locale = NULL; switch (value->type) { case LILV_VALUE_URI: len = strlen(value->str_val) + 3; result = calloc(len, 1); snprintf(result, len, "<%s>", value->str_val); break; case LILV_VALUE_BLANK: len = strlen(value->str_val) + 3; result = calloc(len, 1); snprintf(result, len, "_:%s", value->str_val); break; case LILV_VALUE_STRING: case LILV_VALUE_BOOL: result = lilv_strdup(value->str_val); break; case LILV_VALUE_INT: // INT64_MAX is 9223372036854775807 (19 digits) + 1 for sign // FIXME: locale kludge, need a locale independent snprintf locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); len = 20; result = calloc(len, 1); setlocale(LC_NUMERIC, "POSIX"); snprintf(result, len, "%d", value->val.int_val); setlocale(LC_NUMERIC, locale); break; case LILV_VALUE_FLOAT: // FIXME: locale kludge, need a locale independent snprintf locale = lilv_strdup(setlocale(LC_NUMERIC, NULL)); len = 20; // FIXME: proper maximum value? result = calloc(len, 1); setlocale(LC_NUMERIC, "POSIX"); snprintf(result, len, "%f", value->val.float_val); setlocale(LC_NUMERIC, locale); break; } free(locale); return result; } LILV_API bool lilv_node_is_uri(const LilvNode* value) { return (value && value->type == LILV_VALUE_URI); } LILV_API const char* lilv_node_as_uri(const LilvNode* value) { assert(lilv_node_is_uri(value)); return value->str_val; } const SordNode* lilv_node_as_node(const LilvNode* value) { assert(lilv_node_is_uri(value)); return value->val.uri_val; } LILV_API bool lilv_node_is_blank(const LilvNode* value) { return (value && value->type == LILV_VALUE_BLANK); } LILV_API const char* lilv_node_as_blank(const LilvNode* value) { assert(lilv_node_is_blank(value)); return value->str_val; } LILV_API bool lilv_node_is_literal(const LilvNode* value) { if (!value) return false; switch (value->type) { case LILV_VALUE_STRING: case LILV_VALUE_INT: case LILV_VALUE_FLOAT: return true; default: return false; } } LILV_API bool lilv_node_is_string(const LilvNode* value) { return (value && value->type == LILV_VALUE_STRING); } LILV_API const char* lilv_node_as_string(const LilvNode* value) { return value->str_val; } LILV_API bool lilv_node_is_int(const LilvNode* value) { return (value && value->type == LILV_VALUE_INT); } LILV_API int lilv_node_as_int(const LilvNode* value) { assert(value); assert(lilv_node_is_int(value)); return value->val.int_val; } LILV_API bool lilv_node_is_float(const LilvNode* value) { return (value && value->type == LILV_VALUE_FLOAT); } LILV_API float lilv_node_as_float(const LilvNode* value) { assert(lilv_node_is_float(value) || lilv_node_is_int(value)); if (lilv_node_is_float(value)) return value->val.float_val; else // lilv_node_is_int(value) return (float)value->val.int_val; } LILV_API bool lilv_node_is_bool(const LilvNode* value) { return (value && value->type == LILV_VALUE_BOOL); } LILV_API bool lilv_node_as_bool(const LilvNode* value) { assert(value); assert(lilv_node_is_bool(value)); return value->val.bool_val; }
Java
/* * #%L * BSD implementations of Bio-Formats readers and writers * %% * Copyright (C) 2005 - 2016 Open Microscopy Environment: * - Board of Regents of the University of Wisconsin-Madison * - Glencoe Software, Inc. * - University of Dundee * %% * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 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. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS 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 COPYRIGHT HOLDERS OR 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. * #L% */ package loci.formats.codec; import java.io.IOException; import java.util.Vector; import loci.common.ByteArrayHandle; import loci.common.DataTools; import loci.common.RandomAccessInputStream; import loci.formats.FormatException; import loci.formats.UnsupportedCompressionException; /** * Decompresses lossless JPEG images. * * @author Melissa Linkert melissa at glencoesoftware.com */ public class LosslessJPEGCodec extends BaseCodec { // -- Constants -- // Start of Frame markers - non-differential, Huffman coding private static final int SOF0 = 0xffc0; // baseline DCT private static final int SOF1 = 0xffc1; // extended sequential DCT private static final int SOF2 = 0xffc2; // progressive DCT private static final int SOF3 = 0xffc3; // lossless (sequential) // Start of Frame markers - differential, Huffman coding private static final int SOF5 = 0xffc5; // differential sequential DCT private static final int SOF6 = 0xffc6; // differential progressive DCT private static final int SOF7 = 0xffc7; // differential lossless (sequential) // Start of Frame markers - non-differential, arithmetic coding private static final int JPG = 0xffc8; // reserved for JPEG extensions private static final int SOF9 = 0xffc9; // extended sequential DCT private static final int SOF10 = 0xffca; // progressive DCT private static final int SOF11 = 0xffcb; // lossless (sequential) // Start of Frame markers - differential, arithmetic coding private static final int SOF13 = 0xffcd; // differential sequential DCT private static final int SOF14 = 0xffce; // differential progressive DCT private static final int SOF15 = 0xffcf; // differential lossless (sequential) private static final int DHT = 0xffc4; // define Huffman table(s) private static final int DAC = 0xffcc; // define arithmetic coding conditions // Restart interval termination private static final int RST_0 = 0xffd0; private static final int RST_1 = 0xffd1; private static final int RST_2 = 0xffd2; private static final int RST_3 = 0xffd3; private static final int RST_4 = 0xffd4; private static final int RST_5 = 0xffd5; private static final int RST_6 = 0xffd6; private static final int RST_7 = 0xffd7; private static final int SOI = 0xffd8; // start of image private static final int EOI = 0xffd9; // end of image private static final int SOS = 0xffda; // start of scan private static final int DQT = 0xffdb; // define quantization table(s) private static final int DNL = 0xffdc; // define number of lines private static final int DRI = 0xffdd; // define restart interval private static final int DHP = 0xffde; // define hierarchical progression private static final int EXP = 0xffdf; // expand reference components private static final int COM = 0xfffe; // comment // -- Codec API methods -- /* @see Codec#compress(byte[], CodecOptions) */ @Override public byte[] compress(byte[] data, CodecOptions options) throws FormatException { throw new UnsupportedCompressionException( "Lossless JPEG compression not supported"); } /** * The CodecOptions parameter should have the following fields set: * {@link CodecOptions#interleaved interleaved} * {@link CodecOptions#littleEndian littleEndian} * * @see Codec#decompress(RandomAccessInputStream, CodecOptions) */ @Override public byte[] decompress(RandomAccessInputStream in, CodecOptions options) throws FormatException, IOException { if (in == null) throw new IllegalArgumentException("No data to decompress."); if (options == null) options = CodecOptions.getDefaultOptions(); byte[] buf = new byte[0]; int width = 0, height = 0; int bitsPerSample = 0, nComponents = 0, bytesPerSample = 0; int[] horizontalSampling = null, verticalSampling = null; int[] quantizationTable = null; short[][] huffmanTables = null; int startPredictor = 0, endPredictor = 0; int pointTransform = 0; int[] dcTable = null, acTable = null; while (in.getFilePointer() < in.length() - 1) { int code = in.readShort() & 0xffff; int length = in.readShort() & 0xffff; long fp = in.getFilePointer(); if (length > 0xff00) { length = 0; in.seek(fp - 2); } else if (code == SOS) { nComponents = in.read(); dcTable = new int[nComponents]; acTable = new int[nComponents]; for (int i=0; i<nComponents; i++) { int componentSelector = in.read(); int tableSelector = in.read(); dcTable[i] = (tableSelector & 0xf0) >> 4; acTable[i] = tableSelector & 0xf; } startPredictor = in.read(); endPredictor = in.read(); pointTransform = in.read() & 0xf; // read image data byte[] toDecode = new byte[(int) (in.length() - in.getFilePointer())]; in.read(toDecode); // scrub out byte stuffing ByteVector b = new ByteVector(); for (int i=0; i<toDecode.length; i++) { byte val = toDecode[i]; if (val == (byte) 0xff) { if (toDecode[i + 1] == 0) b.add(val); i++; } else { b.add(val); } } toDecode = b.toByteArray(); RandomAccessInputStream bb = new RandomAccessInputStream( new ByteArrayHandle(toDecode)); HuffmanCodec huffman = new HuffmanCodec(); HuffmanCodecOptions huffmanOptions = new HuffmanCodecOptions(); huffmanOptions.bitsPerSample = bitsPerSample; huffmanOptions.maxBytes = buf.length / nComponents; int nextSample = 0; while (nextSample < buf.length / nComponents) { for (int i=0; i<nComponents; i++) { huffmanOptions.table = huffmanTables[dcTable[i]]; int v = 0; if (huffmanTables != null) { v = huffman.getSample(bb, huffmanOptions); if (nextSample == 0) { v += (int) Math.pow(2, bitsPerSample - 1); } } else { throw new UnsupportedCompressionException( "Arithmetic coding not supported"); } // apply predictor to the sample int predictor = startPredictor; if (nextSample < width * bytesPerSample) predictor = 1; else if ((nextSample % (width * bytesPerSample)) == 0) { predictor = 2; } int componentOffset = i * (buf.length / nComponents); int indexA = nextSample - bytesPerSample + componentOffset; int indexB = nextSample - width * bytesPerSample + componentOffset; int indexC = nextSample - (width + 1) * bytesPerSample + componentOffset; int sampleA = indexA < 0 ? 0 : DataTools.bytesToInt(buf, indexA, bytesPerSample, false); int sampleB = indexB < 0 ? 0 : DataTools.bytesToInt(buf, indexB, bytesPerSample, false); int sampleC = indexC < 0 ? 0 : DataTools.bytesToInt(buf, indexC, bytesPerSample, false); if (nextSample > 0) { int pred = 0; switch (predictor) { case 1: pred = sampleA; break; case 2: pred = sampleB; break; case 3: pred = sampleC; break; case 4: pred = sampleA + sampleB + sampleC; break; case 5: pred = sampleA + ((sampleB - sampleC) / 2); break; case 6: pred = sampleB + ((sampleA - sampleC) / 2); break; case 7: pred = (sampleA + sampleB) / 2; break; } v += pred; } int offset = componentOffset + nextSample; DataTools.unpackBytes(v, buf, offset, bytesPerSample, false); } nextSample += bytesPerSample; } bb.close(); } else { length -= 2; // stored length includes length param if (length == 0) continue; if (code == EOI) { } else if (code == SOF3) { // lossless w/Huffman coding bitsPerSample = in.read(); height = in.readShort(); width = in.readShort(); nComponents = in.read(); horizontalSampling = new int[nComponents]; verticalSampling = new int[nComponents]; quantizationTable = new int[nComponents]; for (int i=0; i<nComponents; i++) { in.skipBytes(1); int s = in.read(); horizontalSampling[i] = (s & 0xf0) >> 4; verticalSampling[i] = s & 0x0f; quantizationTable[i] = in.read(); } bytesPerSample = bitsPerSample / 8; if ((bitsPerSample % 8) != 0) bytesPerSample++; buf = new byte[width * height * nComponents * bytesPerSample]; } else if (code == SOF11) { throw new UnsupportedCompressionException( "Arithmetic coding is not yet supported"); } else if (code == DHT) { if (huffmanTables == null) { huffmanTables = new short[4][]; } int bytesRead = 0; while (bytesRead < length) { int s = in.read(); byte tableClass = (byte) ((s & 0xf0) >> 4); byte destination = (byte) (s & 0xf); int[] nCodes = new int[16]; Vector table = new Vector(); for (int i=0; i<nCodes.length; i++) { nCodes[i] = in.read(); table.add(new Short((short) nCodes[i])); } for (int i=0; i<nCodes.length; i++) { for (int j=0; j<nCodes[i]; j++) { table.add(new Short((short) (in.read() & 0xff))); } } huffmanTables[destination] = new short[table.size()]; for (int i=0; i<huffmanTables[destination].length; i++) { huffmanTables[destination][i] = ((Short) table.get(i)).shortValue(); } bytesRead += table.size() + 1; } } in.seek(fp + length); } } if (options.interleaved && nComponents > 1) { // data is stored in planar (RRR...GGG...BBB...) order byte[] newBuf = new byte[buf.length]; for (int i=0; i<buf.length; i+=nComponents*bytesPerSample) { for (int c=0; c<nComponents; c++) { int src = c * (buf.length / nComponents) + (i / nComponents); int dst = i + c * bytesPerSample; System.arraycopy(buf, src, newBuf, dst, bytesPerSample); } } buf = newBuf; } if (options.littleEndian && bytesPerSample > 1) { // data is stored in big endian order // reverse the bytes in each sample byte[] newBuf = new byte[buf.length]; for (int i=0; i<buf.length; i+=bytesPerSample) { for (int q=0; q<bytesPerSample; q++) { newBuf[i + bytesPerSample - q - 1] = buf[i + q]; } } buf = newBuf; } return buf; } }
Java
<?php /** * The template for displaying all pages * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that * other 'pages' on your WordPress site will use a different template. * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ get_header(); ?> <div id="main-content" class="main-content"> <?php if (is_front_page() && twentyfourteen_has_featured_posts()) { // Include the featured content template. get_template_part('featured-content'); } ?> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <?php // Start the Loop. while (have_posts()) : the_post(); // Include the page content template. get_template_part('content', 'page'); // If comments are open or we have at least one comment, load up the comment template. if (comments_open() || get_comments_number()) { comments_template(); } endwhile; ?> </div> <!-- #content --> </div> <!-- #primary --> <?php get_sidebar('content'); ?> </div><!-- #main-content --> <?php get_sidebar(); get_footer();
Java
\par \chapter{{\tt DenseMtx}: Dense matrix object} \par The {\tt DenseMtx} object contains a dense matrix along with row and column indices. The entries in the matrix can be double precision real or double precision complex. It needs to be able to manage its own storage, much like the {\tt Chv} and {\tt SubMtx} objects that are used during the factor and solves, so we include this capability via a contained {\tt DV} object. A {\tt DenseMtx} object may also be found in a list, so there is a {\tt next} field that points to another {\tt DenseMtx} object. \par The {\tt DenseMtx} object also exists in an MPI environment, where it holds the solution and right hand side matrices. Since each of these two matrices is distributed, a processor {\it owns} only part of the global matrix, and so the need for row and column indices to specify which rows and columns are present on which processor.
Java
# # create TRD geometry from patch file # SOURCE=Create_TRD_Geometry_v13p_3e.C TARGET=Create_TRD_Geometry_v13p_1m.C PATCH=p3etop1m.patch # echo echo cp $SOURCE $TARGET echo patch $TARGET $PATCH echo root -l $TARGET echo # cp $SOURCE $TARGET patch $TARGET $PATCH root -l $TARGET
Java
#ifndef CGITCP_H #define CGITCP_H #include "httpd.h" int cgiTcp(HttpdConnData *connData); #endif
Java
<?php namespace SJBR\StaticInfoTables\Domain\Model; /*************************************************************** * Copyright notice * * (c) 2011-2012 Armin Rüdiger Vieweg <info@professorweb.de> * (c) 2013 Stanislas Rolland <typo3(arobas)sjbr.ca> * * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 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 2 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * * This script 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. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ /** * The Country model * * @copyright Copyright belongs to the respective authors * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later */ class Country extends AbstractEntity { /** * The German short name * @var string */ protected $shortNameDe = ''; /** * Sets the German short name. * * @param string $shortNameDe * * @return void */ public function setShortNameDe($shortNameDe) { $this->shortNameDe = $shortNameDe; } /** * Gets the German short name. * * @return string */ public function getShortNameDe() { return $this->shortNameDe; } } ?>
Java
using System; using System.Reflection; namespace OLPL_API_Server.Areas.HelpPage.ModelDescriptions { public interface IModelDocumentationProvider { string GetDocumentation(MemberInfo member); string GetDocumentation(Type type); } }
Java
#ifndef WSITileGraphicsItem_H #define WSITileGraphicsItem_H #include <QGraphicsItem> #include <memory> class TileManager; class MultiResolutionImage; class WSITileGraphicsItem : public QGraphicsItem { public: // make sure to set `item` to NULL in the constructor WSITileGraphicsItem(QPixmap* item, unsigned int tileX, unsigned int tileY, unsigned int tileSize, unsigned int tileByteSize, unsigned int itemLevel, unsigned int lastRenderLevel, const std::vector<float>& imgDownsamples, TileManager* manager); ~WSITileGraphicsItem(); // you will need to add a destructor // (and probably a copy constructor and assignment operator) QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void debugPrint(); unsigned int getTileX() { return _tileX; } unsigned int getTileY() { return _tileY; } unsigned int getTileLevel() { return _itemLevel; } unsigned int getTileSize() { return _tileSize; } private: // you'll probably want to store information about where you're // going to load the pixmap from, too QPixmap *_item; float _physicalSize; float _upperLOD; float _lowerLOD; unsigned int _itemLevel; unsigned int _tileX; unsigned int _tileY; unsigned int _tileSize; unsigned int _tileByteSize; unsigned int _lastRenderLevel; QRectF _boundingRect; TileManager* _manager; }; #endif
Java
/*************************************************************************** * Copyright (C) 2003 by Roberto Raggi * * roberto@kdevelop.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. * * * ***************************************************************************/ #ifndef __cppsupport_events_h #define __cppsupport_events_h #include "kdevdeepcopy.h" #include <qevent.h> #include <qvaluelist.h> #if QT_VERSION < 0x030100 #include <kdevmutex.h> #else #include <qmutex.h> #endif enum { Event_FileParsed = QEvent::User + 1000 }; class FileParsedEvent: public QCustomEvent { public: FileParsedEvent( const QString& fileName, const QValueList<Problem>& problems, bool fromDisk = false ) : QCustomEvent( Event_FileParsed ), m_fileName( deepCopy( fileName ) ), m_fromDisk( fromDisk ) { // the members are deep copies QValueListConstIterator<Problem> it = problems.begin(); while ( it != problems.end() ) { Problem p = *it; m_problems.append( Problem( deepCopy( p.text() ), p.line(), p.column(), p.level() ) ); m_problems.back().setFileName( deepCopy( p.fileName() ) ); ++it; } } QString fileName() const { return m_fileName; } QValueList<Problem> problems() const { return m_problems; } bool fromDisk() { return m_fromDisk; } private: QString m_fileName; QValueList<Problem> m_problems; bool m_fromDisk; private: FileParsedEvent( const FileParsedEvent& source ); void operator = ( const FileParsedEvent& source ); }; #endif // __cppsupport_events_h // kate: indent-mode csands; tab-width 4;
Java
/* * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.geom.AffineTransform; import java.awt.geom.Path2D; import java.awt.image.BufferedImage; import java.awt.image.Raster; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; /** * Scaled Line Clipping rendering test */ public class ScaleClipTest { static final boolean SAVE_IMAGE = false; static final int SIZE = 50; enum SCALE_MODE { ORTHO, NON_ORTHO, COMPLEX }; public static void main(String[] args) { // First display which renderer is tested: // JDK9 only: System.setProperty("sun.java2d.renderer.verbose", "true"); System.out.println("Testing renderer: "); // Other JDK: String renderer = "undefined"; try { renderer = sun.java2d.pipe.RenderingEngine.getInstance().getClass().getName(); System.out.println(renderer); } catch (Throwable th) { // may fail with JDK9 jigsaw (jake) if (false) { System.err.println("Unable to get RenderingEngine.getInstance()"); th.printStackTrace(); } } System.out.println("ScaleClipTest: size = " + SIZE); final BufferedImage image = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_ARGB); boolean fail = false; // testNegativeScale: for (SCALE_MODE mode : SCALE_MODE.values()) { try { testNegativeScale(image, mode); } catch (IllegalStateException ise) { System.err.println("testNegativeScale[" + mode + "] failed:"); ise.printStackTrace(); fail = true; } } // testMarginScale: for (SCALE_MODE mode : SCALE_MODE.values()) { try { testMarginScale(image, mode); } catch (IllegalStateException ise) { System.err.println("testMarginScale[" + mode + "] failed:"); ise.printStackTrace(); fail = true; } } // Fail at the end: if (fail) { throw new RuntimeException("ScaleClipTest has failures."); } } private static void testNegativeScale(final BufferedImage image, final SCALE_MODE mode) { final Graphics2D g2d = (Graphics2D) image.getGraphics(); try { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g2d.setBackground(Color.WHITE); g2d.clearRect(0, 0, SIZE, SIZE); g2d.setColor(Color.BLACK); // Bug in TransformingPathConsumer2D.adjustClipScale() // non ortho scale only final double scale = -1.0; final AffineTransform at; switch (mode) { default: case ORTHO: at = AffineTransform.getScaleInstance(scale, scale); break; case NON_ORTHO: at = AffineTransform.getScaleInstance(scale, scale + 1e-5); break; case COMPLEX: at = AffineTransform.getScaleInstance(scale, scale); at.concatenate(AffineTransform.getShearInstance(1e-4, 1e-4)); break; } g2d.setTransform(at); // Set cap/join to reduce clip margin: g2d.setStroke(new BasicStroke(2f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); final Path2D p = new Path2D.Double(); p.moveTo(scale * 10, scale * 10); p.lineTo(scale * (SIZE - 10), scale * (SIZE - 10)); g2d.draw(p); if (SAVE_IMAGE) { try { final File file = new File("ScaleClipTest-testNegativeScale-" + mode + ".png"); System.out.println("Writing file: " + file.getAbsolutePath()); ImageIO.write(image, "PNG", file); } catch (IOException ioe) { ioe.printStackTrace(); } } // Check image: // 25, 25 = black checkPixel(image.getData(), 25, 25, Color.BLACK.getRGB()); } finally { g2d.dispose(); } } private static void testMarginScale(final BufferedImage image, final SCALE_MODE mode) { final Graphics2D g2d = (Graphics2D) image.getGraphics(); try { g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g2d.setBackground(Color.WHITE); g2d.clearRect(0, 0, SIZE, SIZE); g2d.setColor(Color.BLACK); // Bug in Stroker.init() // ortho scale only: scale used twice ! final double scale = 1e-2; final AffineTransform at; switch (mode) { default: case ORTHO: at = AffineTransform.getScaleInstance(scale, scale); break; case NON_ORTHO: at = AffineTransform.getScaleInstance(scale, scale + 1e-5); break; case COMPLEX: at = AffineTransform.getScaleInstance(scale, scale); at.concatenate(AffineTransform.getShearInstance(1e-4, 1e-4)); break; } g2d.setTransform(at); final double invScale = 1.0 / scale; // Set cap/join to reduce clip margin: final float w = (float) (3.0 * invScale); g2d.setStroke(new BasicStroke(w, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); final Path2D p = new Path2D.Double(); p.moveTo(invScale * -0.5, invScale * 10); p.lineTo(invScale * -0.5, invScale * (SIZE - 10)); g2d.draw(p); if (SAVE_IMAGE) { try { final File file = new File("ScaleClipTest-testMarginScale-" + mode + ".png"); System.out.println("Writing file: " + file.getAbsolutePath()); ImageIO.write(image, "PNG", file); } catch (IOException ioe) { ioe.printStackTrace(); } } // Check image: // 0, 25 = black checkPixel(image.getData(), 0, 25, Color.BLACK.getRGB()); } finally { g2d.dispose(); } } private static void checkPixel(final Raster raster, final int x, final int y, final int expected) { final int[] rgb = (int[]) raster.getDataElements(x, y, null); if (rgb[0] != expected) { throw new IllegalStateException("bad pixel at (" + x + ", " + y + ") = " + rgb[0] + " expected: " + expected); } } }
Java
<!-- Creator : groff version 1.21 --> <!-- CreationDate: Mon Dec 7 09:14:09 2015 --> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta name="generator" content="groff -Thtml, see www.gnu.org"> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <meta name="Content-Style" content="text/css"> <style type="text/css"> p { margin-top: 0; margin-bottom: 0; vertical-align: top } pre { margin-top: 0; margin-bottom: 0; vertical-align: top } table { margin-top: 0; margin-bottom: 0; vertical-align: top } h1 { text-align: center } </style> <title>NTFSDEBUG</title> </head> <body> <h1 align="center">NTFSDEBUG</h1> <a href="#NAME">NAME</a><br> <a href="#SYNOPSIS">SYNOPSIS</a><br> <a href="#DESCRIPTION">DESCRIPTION</a><br> <a href="#EXIT CODES">EXIT CODES</a><br> <a href="#EXAMPLES">EXAMPLES</a><br> <a href="#KNOWN ISSUES">KNOWN ISSUES</a><br> <a href="#AVAILABILITY">AVAILABILITY</a><br> <hr> <h2>NAME <a name="NAME"></a> </h2> <p style="margin-left:11%; margin-top: 1em">ntfsdebug &minus; Efficiently dump the metadata contents of an NTFS volume.</p> <h2>SYNOPSIS <a name="SYNOPSIS"></a> </h2> <p style="margin-left:11%; margin-top: 1em"><b>ntfsdebug</b> <i>device|image</i></p> <h2>DESCRIPTION <a name="DESCRIPTION"></a> </h2> <p style="margin-left:11%; margin-top: 1em"><i><b>ntfsdebug</b></i> will efficiently extract all relevant metadata from an NTFS volume and dump it to standard output. It works at disk sector level and copies only the used data. Unused disk space becomes zero. <b>ntfsdebug</b> can be useful to exact the metadata snapshot of an NTFS file system for developers to investigate and troubleshoot users&rsquo; issues using the clone without the risk of destroying the original file system.</p> <h2>EXIT CODES <a name="EXIT CODES"></a> </h2> <p style="margin-left:11%; margin-top: 1em">The exit code is 0 on success, non&minus;zero otherwise.</p> <h2>EXAMPLES <a name="EXAMPLES"></a> </h2> <p style="margin-left:11%; margin-top: 1em">Dump NTFS metadata on /dev/sda1 to a compressed metadata image:</p> <p style="margin-left:22%; margin-top: 1em"><b>ntfsdebug /dev/sda1 | bzip2 &gt; sda1.img.bz2</b></p> <p style="margin-left:11%; margin-top: 1em">Dump NTFS metadata to a remote host, using ssh. Please note that ssh may ask for a password.</p> <p style="margin-left:22%; margin-top: 1em"><b>ntfsdebug /dev/sda1 | bzip2 | ssh host &rsquo;cat &gt; sda1.img.bzip2&rsquo;</b></p> <h2>KNOWN ISSUES <a name="KNOWN ISSUES"></a> </h2> <p style="margin-left:11%; margin-top: 1em">If you find a problem then please send an email describing it to ntfs-support@tuxera.com.</p> <h2>AVAILABILITY <a name="AVAILABILITY"></a> </h2> <p style="margin-left:11%; margin-top: 1em"><b>ntfsdebug</b> is part of the <b>Tuxera NTFS</b> package.</p> <hr> </body> </html>
Java
/* SPDX-License-Identifier: GPL-2.0-only */ #ifndef EC_GOOGLE_WILCO_COMMANDS_H #define EC_GOOGLE_WILCO_COMMANDS_H #include <types.h> enum { /* Read and clear power state information */ KB_POWER_SMI = 0x04, /* Read but do not clear power state information */ KB_POWER_STATUS = 0x05, /* Inform the EC about the reason host is turning off */ KB_POWER_OFF = 0x08, /* Control wireless radios */ KB_RADIO_CONTROL = 0x2b, /* Save PS/2 data before S3 suspend */ KB_SAVE = 0x2f, /* Restore PS/2 data after S3 resume */ KB_RESTORE = 0x30, /* Manage the EC control of camera power */ KB_CAMERA = 0x33, /* Retrieve information about the EC */ KB_EC_INFO = 0x38, /* Set ACPI mode on or off */ KB_ACPI = 0x3a, /* Board ID */ KB_BOARD_ID = 0x3d, /* Change ACPI wake up source */ KB_ACPI_WAKEUP_CHANGE = 0x4a, /* Manage the EC power button passthru to the host */ KB_POWER_BUTTON_TO_HOST = 0x3e, /* Manage the EC control of speaker mute */ KB_HW_MUTE_CONTROL = 0x60, /* Inform the EC that the host is about to enter S3 */ KB_SLP_EN = 0x64, /* Inform the EC about BIOS boot progress */ KB_BIOS_PROGRESS = 0xc2, /* Inform the EC that a fatal error occurred */ KB_ERR_CODE = 0x7b, /* Set CPU ID */ KB_CPU_ID = 0xbf, }; enum ec_ram_addr { /* Indicate if EC uses signed firmware */ EC_RAM_SIGNED_FW = 0x5c, /* Indicate support for S0ix */ EC_RAM_S0IX_SUPPORT = 0xb8, }; enum set_acpi_mode_cmd { ACPI_OFF = 0, ACPI_ON }; enum bios_progress_code { BIOS_PROGRESS_BEFORE_MEMORY = 0x00, BIOS_PROGRESS_MEMORY_INIT = 0x01, BIOS_PROGRESS_VIDEO_INIT = 0x02, BIOS_PROGRESS_LOGO_DISPLAYED = 0x03, BIOS_PROGRESS_POST_COMPLETE = 0x04, }; enum ec_audio_mute { AUDIO_MUTE = 0, /* Mute speakers immediately */ AUDIO_UNMUTE_125MS, /* Unmute in 125ms */ }; enum ec_radio { RADIO_WIFI = 0, RADIO_WWAN, RADIO_BT, }; enum ec_radio_action { RADIO_READ = 1, RADIO_WRITE, RADIO_TOGGLE, }; enum ec_camera { CAMERA_ON = 0, CAMERA_OFF }; enum ec_err_code { DLED_MEMORY = 0x03, DLED_PANEL = 0x10, DLED_ROM = 0x19, }; /** * wilco_ec_radio_control() - Control wireless radios. * @ec_radio: Wireless radio type. * @state: Turn radio on or off. * Return: 0 if successful or negative error code on failure. */ int wilco_ec_radio_control(enum ec_radio radio, uint8_t state); /* * EC Information */ enum get_ec_info_cmd { GET_EC_LABEL = 0, GET_EC_SVN_REV, GET_EC_MODEL_NO, GET_EC_BUILD_DATE }; #define EC_INFO_MAX_SIZE 9 struct ec_response_get_ec_info { char data[EC_INFO_MAX_SIZE]; /* ASCII NUL terminated string */ }; /** * wilco_ec_get_info * * Read a specific information string from the EC and return it in * the caller-provided buffer of at least EC_INFO_MAX_SIZE bytes. * * @cmd: Information to retrieve * @info: Character array of EC_INFO_MAX_SIZE bytes * * Returns 0 if successful and resulting string is in 'info' * Returns -1 if the EC command fails */ int wilco_ec_get_info(enum get_ec_info_cmd cmd, char *info); /** * wilco_ec_print_all_info * * Retrieve and print all the information strings from the EC: * * GET_EC_LABEL * GET_EC_SVN_REV * GET_EC_MODEL_NO * GET_EC_BUILD_DATE */ void wilco_ec_print_all_info(void); /* * EC Power State */ enum ec_power_off_reason { EC_PWROFF_FLASH = 0x11, EC_PWROFF_AC_REMOVED = 0x12, EC_PWROFF_BAT_REMOVED = 0x13, EC_PWROFF_LOBAT = 0x15, EC_PWROFF_PWRB_IN_POST = 0x16, EC_PWROFF_FORCE_IMMEDIATE = 0x18, EC_PWROFF_WDT = 0x1b, EC_PWROFF_FORCE_THERMAL = 0x22, EC_PWROFF_ERR_CODE = 0x23, EC_PWROFF_PAID_PWRGD = 0x27, EC_PWROFF_PAID_CPU = 0x28, EC_PWROFF_PAID_GFX = 0x29, EC_PWROFF_PAID_CLK = 0x2a, EC_PWROFF_PAID_NOMEMORY = 0x2b, EC_PWROFF_PAID_MEMORY_ERR = 0x2c, EC_PWROFF_PAID_MEMORY_SPD = 0x2d, EC_SWOFF_ACPI = 0x31, EC_SWOFF_BOOT_PASSWORD = 0x33, EC_SWOFF_DISK_PASSWORD = 0x34, EC_SWOFF_POWER_CYCLE = 0x37, EC_SWOFF_HARD_RESET = 0x3b, EC_SWOFF_FSMI = 0x3f, EC_PWRLOG_THERMTRIP = 0x41, EC_PWRLOG_NO_S5 = 0x42, EC_PWROFF_4S_PWRB = 0x44, EC_PWROFF_ASF2_FORCEOFF = 0x45, EC_PWROFF_PWRB_THERMAL = 0x48, EC_PWROFF_AOAC_TIMER = 0x4b, }; /** * wilco_ec_power_off * * Tell the EC why the host is about to power off. */ void wilco_ec_power_off(enum ec_power_off_reason reason); /** * wilco_ec_slp_en * * Tell the EC that the host is entering a sleep state. */ void wilco_ec_slp_en(void); enum ec_pm1_state { EC_PM1_AC_AVAIL = BIT(0), /* AC available */ EC_PM1_BAT_AVAIL = BIT(1), /* Battery available */ EC_PM1_LO_BAT1 = BIT(2), /* Battery 1 low */ EC_PM1_LO_BAT2 = BIT(3), /* Battery 2 low */ EC_PM1_LID_OPEN = BIT(4), /* Lid is open */ EC_PM1_LCD_POWER = BIT(5), /* LCD is powered */ EC_PM1_OVER_TEMP = BIT(6), /* CPU is over temperature */ EC_PM1_DOCKED = BIT(7), /* System is docked */ }; enum ec_pm2_state { EC_PM2_SYS_MB_PCIE = BIT(0), /* MB has PCIe */ EC_PM2_SYS_MB_SATA = BIT(1), /* MB has SATA */ EC_PM2_PWRB_PRESSED = BIT(2), /* Power button is pressed */ EC_PM2_TURBO_MODE = BIT(3), /* Turbo mode */ }; enum ec_pm3_state { EC_PM3_BAT1_PRES = BIT(2), /* Battery 1 is present */ EC_PM3_BAT2_PRES = BIT(3), /* Battery 2 is present */ EC_PM3_LOWER_PSTATE = BIT(6), /* EC requests lower P-state */ EC_PM3_CPU_THROTTLE = BIT(7), /* EC requests CPU throttle */ }; enum ec_pm4_state { EC_PM4_BAT1_CHG = BIT(0), /* Battery 1 is being charged */ EC_PM4_BAT2_CHG = BIT(1), /* Battery 2 is being charged */ EC_PM4_BAT1_PWR = BIT(2), /* Battery 1 is powering the system */ EC_PM4_BAT2_PWR = BIT(3), /* Battery 2 is powering the system */ EC_PM4_PANEL_STATE = BIT(5), /* Panel power state */ }; enum ec_pm5_state { EC_PM5_INT_HD_SATA = BIT(7), /* Internal SATA HDD */ }; enum ec_pm6_state { EC_PM6_WLAN_SWITCH = BIT(0), /* Wireless switch */ EC_PM6_SYS_MB_MODEM = BIT(1), /* MB has modem */ EC_PM6_ETH_STATE = BIT(2), /* Ethernet cable state */ EC_PM6_AC_UPDATE = BIT(3), /* Update AC information */ }; enum ec_pm1_event { EC_EV1_PWRB_PRESSED = BIT(0), /* Power button was pressed */ EC_EV1_HOTKEY_PRESSED = BIT(1), /* Hotkey was pressed */ EC_EV1_STATE_CHANGED = BIT(2), /* PMx state changed */ }; enum ec_pm2_event { EC_EV2_ACPI_MONSWITCH = BIT(0), /* Monitor switch status */ }; struct ec_pm_event_state { uint8_t event[2]; /* ec_pm{1,2}_event */ uint8_t state[6]; /* ec_pm{1,2,3,4,5,6}_state */ uint8_t hotkey; /* Hotkey, if pressed */ uint16_t ac_type; /* AC adapter information */ }; /** * wilco_ec_get_pm * * Retrieve power and event information from the EC. * * @pm: Power event state structure to fill out * @clear: Clear EC event state after reading * * Returns 0 if EC command was successful * Returns -1 if EC command failed */ int wilco_ec_get_pm(struct ec_pm_event_state *pm, bool clear); /** * wilco_ec_get_lid_state * * Retrieve the lid state without clearing it in the EC. * * Returns 1 if the lid is open, 0 if it is closed * Returns -1 if the EC command failed */ int wilco_ec_get_lid_state(void); /** * wilco_ec_get_board_id * * Retrieve the board ID value from the EC. * @id: Pointer to variable to store the ID read from the EC. * * Returns number of bytes transferred from the EC * Returns -1 if the EC command failed */ int wilco_ec_get_board_id(uint8_t *id); enum ec_wake_change { WAKE_OFF = 0, WAKE_ON }; /** * wilco_ec_change_wake_source * * Change acpi wake up source. * @source: Wake up source that can be enabled/disabled. * @ec_wake_change: On/off switch. * * Returns -1 if the EC command failed */ int wilco_ec_change_wake(uint8_t source, enum ec_wake_change change); enum ec_acpi_wake_events { EC_ACPI_WAKE_PWRB = BIT(0), /* Wake up by power button */ EC_ACPI_WAKE_LID = BIT(1), /* Wake up by lid switch */ EC_ACPI_WAKE_RTC = BIT(5), /* Wake up by RTC */ }; /** * wilco_ec_signed_fw * * Indicate if the EC uses signed firmware. * * Returns 1 if EC uses signed firmware, otherwise returns 0 */ int wilco_ec_signed_fw(void); /** * wilco_ec_save_post_code * * Save this post code as the most recent progress step. If the boot fails * and calls die_notify() this post code will be used to send an error code * to the EC indicating the failure. * * @post_code: Post code to save */ void wilco_ec_save_post_code(uint8_t post_code); /** * wilco_ec_set_cpuid * * Set CPU ID to EC. * * @cpuid: read CPU ID from cpu_eax(1) * @cpu_cores: cores of CPU * @gpu_cores: cores of GPU * * Returns 0 if EC command was successful * Returns -1 if EC command failed */ int wilco_ec_set_cpuid(uint32_t cpuid, uint8_t cpu_cores, uint8_t gpu_cores); #endif /* EC_GOOGLE_WILCO_COMMANDS_H */
Java
# Twisted, the Framework of Your Internet # Copyright (C) 2001 Matthew W. Lefkowitz # # This library is free software; you can redistribute it and/or # modify it under the terms of version 2.1 of the GNU Lesser General Public # License as published by the Free Software Foundation. # # 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 """Standard input/out/err support. API Stability: semi-stable Future Plans: support for stderr, perhaps Maintainer: U{Itamar Shtull-Trauring<mailto:twisted@itamarst.org>} """ # system imports import sys, os, select, errno # Sibling Imports import abstract, fdesc, protocol from main import CONNECTION_LOST _stdio_in_use = 0 class StandardIOWriter(abstract.FileDescriptor): connected = 1 ic = 0 def __init__(self): abstract.FileDescriptor.__init__(self) self.fileno = sys.__stdout__.fileno fdesc.setNonBlocking(self.fileno()) def writeSomeData(self, data): try: return os.write(self.fileno(), data) return rv except IOError, io: if io.args[0] == errno.EAGAIN: return 0 elif io.args[0] == errno.EPERM: return 0 return CONNECTION_LOST except OSError, ose: if ose.errno == errno.EPIPE: return CONNECTION_LOST if ose.errno == errno.EAGAIN: return 0 raise def connectionLost(self, reason): abstract.FileDescriptor.connectionLost(self, reason) os.close(self.fileno()) class StandardIO(abstract.FileDescriptor): """I can connect Standard IO to a twisted.protocol I act as a selectable for sys.stdin, and provide a write method that writes to stdout. """ def __init__(self, protocol): """Create me with a protocol. This will fail if a StandardIO has already been instantiated. """ abstract.FileDescriptor.__init__(self) global _stdio_in_use if _stdio_in_use: raise RuntimeError, "Standard IO already in use." _stdio_in_use = 1 self.fileno = sys.__stdin__.fileno fdesc.setNonBlocking(self.fileno()) self.protocol = protocol self.startReading() self.writer = StandardIOWriter() self.protocol.makeConnection(self) def write(self, data): """Write some data to standard output. """ self.writer.write(data) def doRead(self): """Some data's readable from standard input. """ return fdesc.readFromFD(self.fileno(), self.protocol.dataReceived) def closeStdin(self): """Close standard input. """ self.writer.loseConnection() def connectionLost(self, reason): """The connection was lost. """ self.protocol.connectionLost()
Java
/** Copyright 2008, 2009 UFPE - Universidade Federal de Pernambuco Este arquivo é parte do programa Amadeus Sistema de Gestão de Aprendizagem, ou simplesmente Amadeus LMS O Amadeus LMS é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença. Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software Livre (FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. **/ package br.ufpe.cin.amadeus.amadeus_mobile.util; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile; import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Forum; import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Game; import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject; import br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll; public class Conversor { /** * Method that converts AMADeUs Course object into Mobile Course object * @param curso - AMADeUs Course to be converted * @return - Converted Mobile Course object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile converterCurso(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course curso){ br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile(); retorno.setId(curso.getId()); retorno.setName(curso.getName()); retorno.setContent(curso.getContent()); retorno.setObjectives(curso.getObjectives()); retorno.setModules(converterModulos(curso.getModules())); retorno.setKeywords(converterKeywords(curso.getKeywords())); ArrayList<String> nomes = new ArrayList<String>(); nomes.add(curso.getProfessor().getName()); retorno.setTeachers(nomes); retorno.setCount(0); retorno.setMaxAmountStudents(curso.getMaxAmountStudents()); retorno.setFinalCourseDate(curso.getFinalCourseDate()); retorno.setInitialCourseDate(curso.getInitialCourseDate()); return retorno; } /** * Method that converts a AMADeUs Course object list into Mobile Course object list * @param cursos - AMADeUs Course object list to be converted * @return - Converted Mobile Course object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile> converterCursos(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course> cursos){ ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.CourseMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Course c : cursos){ retorno.add(Conversor.converterCurso(c)); } return retorno; } /** * Method that converts AMADeUs Module object into Mobile Module object * @param modulo - AMADeUs Module object to be converted * @return - Converted Mobile Module object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile converterModulo(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module modulo){ br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile mod = new br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile(modulo.getId(), modulo.getName()); List<HomeworkMobile> listHomeworks = new ArrayList<HomeworkMobile>(); for (Poll poll : modulo.getPolls()) { listHomeworks.add( Conversor.converterPollToHomework(poll) ); } for (Forum forum : modulo.getForums()) { listHomeworks.add( Conversor.converterForumToHomework(forum) ); } for(Game game : modulo.getGames()){ listHomeworks.add( Conversor.converterGameToHomework(game) ); } for(LearningObject learning : modulo.getLearningObjects()){ listHomeworks.add( Conversor.converterLearningObjectToHomework(learning) ); } mod.setHomeworks(listHomeworks); mod.setMaterials(converterMaterials(modulo.getMaterials())); return mod; } /** * Mothod that converts a AMADeUs Module object list into Mobile Module object list * @param modulos - AMADeUs Module object list to be converted * @return - Converted Mobile Module object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile> converterModulos(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module> modulos){ ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ModuleMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Module m : modulos){ retorno.add(Conversor.converterModulo(m)); } return retorno; } /** * Method that converts AMADeUs Homework object into Mobile Homework object * @param home - AMADeUs Homework object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework home){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(home.getId()); retorno.setName(home.getName()); retorno.setDescription(home.getDescription()); retorno.setInitDate(home.getInitDate()); retorno.setDeadline(home.getDeadline()); retorno.setAlowPostponing(home.getAllowPostponing()); retorno.setInfoExtra(""); retorno.setTypeActivity(HomeworkMobile.HOMEWORK); return retorno; } /** * Method that converts AMADeUs Game object into Mobile Homework object * @param game - AMADeUs Game object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterGameToHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Game game){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(game.getId()); retorno.setName(game.getName()); retorno.setDescription(game.getDescription()); retorno.setInfoExtra(game.getUrl()); retorno.setTypeActivity(HomeworkMobile.GAME); return retorno; } /** * Method that converts AMADeUs Forum object into Mobile Homework object * @param forum - AMADeUs Forum object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterForumToHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Forum forum){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(forum.getId()); retorno.setName(forum.getName()); retorno.setDescription(forum.getDescription()); retorno.setInitDate(forum.getCreationDate()); retorno.setInfoExtra(""); retorno.setTypeActivity(HomeworkMobile.FORUM); return retorno; } /** * Method that converts AMADeUs Poll object into Mobile Homework object * @param poll - AMADeUs Poll object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterPollToHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll poll){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(poll.getId()); retorno.setName(poll.getName()); retorno.setDescription(poll.getQuestion()); retorno.setInitDate(poll.getCreationDate()); retorno.setDeadline(poll.getFinishDate()); retorno.setInfoExtra(""); retorno.setTypeActivity(HomeworkMobile.POLL); return retorno; } /** * Method that converts AMADeUs Multimedia object into Mobile Homework object * @param media - AMADeUs Multimedia object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterMultimediaToHomework(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Multimedia media){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(media.getId()); retorno.setName(media.getName()); retorno.setDescription(media.getDescription()); retorno.setInfoExtra(media.getUrl()); retorno.setTypeActivity(HomeworkMobile.MULTIMEDIA); return retorno; } /** * Method that converts AMADeUs Video object into Mobile Homework object * @param video - AMADeUs Video object to be converted * @return - Converted Mobile Homework object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterVideoToHomework(br.ufpe.cin.amadeus.amadeus_sdmm.dao.Video video){ br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(video.getId()); retorno.setName(video.getName()); retorno.setDescription(video.getDescription()); retorno.setInitDate(video.getDateinsertion()); retorno.setInfoExtra(video.getTags()); retorno.setTypeActivity(HomeworkMobile.VIDEO); return retorno; } public static br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile converterLearningObjectToHomework( br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject learning) { br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile(); retorno.setId(learning.getId()); retorno.setName(learning.getName()); retorno.setUrl(learning.getUrl()); retorno.setDescription(learning.getDescription()); retorno.setDeadline(learning.getCreationDate()); retorno.setTypeActivity(HomeworkMobile.LEARNING_OBJECT); return retorno; } /** * Method that converts AMADeUs Homework object list into Mobile Homework object list * @param homes - AMADeUs Homework object list to be converted * @return - Converted Mobile Homework object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile> converterHomeworks(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework> homes){ ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.HomeworkMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Homework h : homes){ retorno.add(Conversor.converterHomework(h)); } return retorno; } /** * Method that converts AMADeUs Material object into Mobile Material object * @param mat - AMADeUs Material object to be converted * @return - Mobile Material object converted */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile converterMaterial(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material mat){ br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile(); retorno.setId(mat.getId()); retorno.setName(mat.getArchiveName()); retorno.setAuthor(converterPerson(mat.getAuthor())); retorno.setPostDate(mat.getCreationDate()); return retorno; } /** * Method that converts AMADeUs Mobile Material object list into Mobile Material object list * @param mats - AMADeUs Material object list * @return - Mobile Material object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile> converterMaterials(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material> mats){ ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.MaterialMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Material mat : mats){ retorno.add(Conversor.converterMaterial(mat)); } return retorno; } /** * Method that converts AMADeUs Keyword object into Mobile Keyword object * @param key - AMADeUs Keyword object to be converted * @return - Converted Keywork object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile converterKeyword(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword key){ br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile(); retorno.setId(key.getId()); retorno.setName(key.getName()); retorno.setPopularity(key.getPopularity()); return retorno; } /** * Method that converts AMADeUs Keyword object list into a Mobile Keyword HashSet object * @param keys - AMADeUs Keyword object list to be converted * @return - Mobile Keywork HashSet object list */ public static HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile> converterKeywords(Set<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword> keys){ HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile> retorno = new HashSet<br.ufpe.cin.amadeus.amadeus_mobile.basics.KeywordMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Keyword k : keys){ retorno.add(Conversor.converterKeyword(k)); } return retorno; } /** * Method that converts AMADeUs Choice object into Mobile Choice object * @param ch - AMADeUs Choice object to be converted * @return - Converted Mobile Choice object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile converterChoice(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice ch){ br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile(); retorno.setId(ch.getId()); retorno.setAlternative(ch.getAlternative()); retorno.setVotes(ch.getVotes()); retorno.setPercentage(ch.getPercentage()); return retorno; } /** * Method that converts AMADeUs Choice object list into Mobile Choice object list * @param chs - AMADeUs Choice object list to be converted * @return - Converted Mobile Choice object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> converterChoices(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> chs){ List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice c : chs){ retorno.add(Conversor.converterChoice(c)); } return retorno; } /** * Method that converts AMADeUs Poll object into Mobile Poll Object * @param p - AMADeUs Poll object to be converted * @return - Converted Mobile Poll object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile converterPool(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll p){ br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile(); retorno.setId(p.getId()); retorno.setName(p.getName()); retorno.setQuestion(p.getQuestion()); retorno.setInitDate(p.getCreationDate()); retorno.setFinishDate(p.getFinishDate()); retorno.setAnswered(false); retorno.setChoices(converterChoices(p.getChoices())); retorno.setAnsewered(converterAnswers(p.getAnswers())); return retorno; } public static br.ufpe.cin.amadeus.amadeus_mobile.basics.LearningObjectMobile converterLearningObject (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.LearningObject learning){ br.ufpe.cin.amadeus.amadeus_mobile.basics.LearningObjectMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.LearningObjectMobile(); retorno.setId(learning.getId()); retorno.setName(learning.getName()); retorno.setDescription(learning.getDescription()); retorno.setDatePublication(learning.getCreationDate()); retorno.setUrl(learning.getUrl()); return retorno; } /** * Method that converts AMADeUs Poll object list into Mobile Poll object list * @param pls - AMADeUs Poll object list * @return - Converted Mobile object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile> converterPools(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll> pls){ List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll p : pls){ retorno.add(Conversor.converterPool(p)); } return retorno; } /** * Method that converts AMADeUs Answer object into Mobile Answer object * @param ans - AMADeUs Answer object to be converted * @return - Converted Mobile Answer object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile converterAnswer(br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer ans){ br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile retorno = new br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile(); retorno.setId(ans.getId()); retorno.setAnswerDate(ans.getAnswerDate()); retorno.setPerson(converterPerson(ans.getPerson())); return retorno; } /** * Method that converts AMADeUs Answer object list into Mobile Answer object list * @param anss - AMADeUs Answer object list * @return - Converted Mobile object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> converterAnswers(List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> anss){ List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer an : anss){ retorno.add(Conversor.converterAnswer(an)); } return retorno; } /** * Method that converts AMADeUs Person object into Mobile Person object * @param p - AMADeUs Person object to be converted * @return - Converted Mobile Person object */ public static br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile converterPerson(br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p){ return new br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile(p.getId(), p.getAccessInfo().getLogin(), p.getPhoneNumber()); } /** * Method that converts AMADeUs Person object list into Mobile Person object list * @param persons - AMADeUs Person object list to be converted * @return - Converted Mobile Person object list */ public static List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile> converterPersons(List<br.ufpe.cin.amadeus.amadeus_web.domain.register.Person> persons){ List<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile>(); for (br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p : persons){ retorno.add(Conversor.converterPerson(p)); } return retorno; } /** * Method that converts Mobile Poll object into AMADeUs Poll Object * @param p - Mobile Poll object to be converted * @return - Converted AMADeUs Poll object */ public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll converterPool(br.ufpe.cin.amadeus.amadeus_mobile.basics.PollMobile p){ br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Poll(); retorno.setId(p.getId()); retorno.setName(p.getName()); retorno.setQuestion(p.getQuestion()); retorno.setCreationDate(p.getInitDate()); retorno.setFinishDate(p.getFinishDate()); retorno.setChoices(converterChoices2(p.getChoices())); retorno.setAnswers(converterAnswers2(p.getAnsewered())); return retorno; } /** * Method that converts Mobile Choice object into AMADeUs Choice object * @param ch - Mobile Choice object to be converted * @return - Converted AMADeUs Choice object */ public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice converterChoice(br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile ch){ br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice(); retorno.setId(ch.getId()); retorno.setAlternative(ch.getAlternative()); retorno.setVotes(ch.getVotes()); retorno.setPercentage(ch.getPercentage()); return retorno; } /** * Method that converts Mobile Choiceobject list into AMADeUs Choice object list * @param chs - Mobile Choice object list to be converted * @return - Converted AMADeUs Choice object list */ public static List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> converterChoices2(List<br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile> chs){ List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Choice>(); for (br.ufpe.cin.amadeus.amadeus_mobile.basics.ChoiceMobile c : chs){ retorno.add(Conversor.converterChoice(c)); } return retorno; } /** * Method that converts Mobile Answer object into AMADeUs Answer object * @param ans - Mobile Answer object to be converted * @return - Converted AMADeUs Answer object */ public static br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer converterAnswer(br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile ans){ br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer retorno = new br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer(); retorno.setId(ans.getId()); retorno.setAnswerDate(ans.getAnswerDate()); retorno.setPerson(converterPerson(ans.getPerson())); return retorno; } /** * Method that converts Mobile Answer object list into AMADeUs Answer object list * @param anss - Mobile Answer object list * @return - Converted AMADeUs Answer object list */ public static List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> converterAnswers2(List<br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile> anss){ List<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer> retorno = new ArrayList<br.ufpe.cin.amadeus.amadeus_web.domain.content_management.Answer>(); for (br.ufpe.cin.amadeus.amadeus_mobile.basics.AnswerMobile an : anss){ retorno.add(Conversor.converterAnswer(an)); } return retorno; } /** * Method that converts Mobile Person object into AMADeUs Person object * @param p - Mobile Person object to be converted * @return - Converted AMADeUs Person object */ public static br.ufpe.cin.amadeus.amadeus_web.domain.register.Person converterPerson(br.ufpe.cin.amadeus.amadeus_mobile.basics.PersonMobile p){ br.ufpe.cin.amadeus.amadeus_web.domain.register.Person p1 = new br.ufpe.cin.amadeus.amadeus_web.domain.register.Person(); p1.setId(p.getId()); p1.setName(p.getName()); p1.setPhoneNumber(p.getPhoneNumber()); return p1; } }
Java
package net.sf.memoranda.ui.htmleditor; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import net.sf.memoranda.ui.htmleditor.util.Local; /** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author unascribed * @version 1.0 */ public class ImageDialog extends JDialog implements WindowListener { /** * */ private static final long serialVersionUID = 5326851249529076804L; JPanel headerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); JLabel header = new JLabel(); JPanel areaPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc; JLabel jLabel1 = new JLabel(); public JTextField fileField = new JTextField(); JButton browseB = new JButton(); JLabel jLabel2 = new JLabel(); public JTextField altField = new JTextField(); JLabel jLabel3 = new JLabel(); public JTextField widthField = new JTextField(); JLabel jLabel4 = new JLabel(); public JTextField heightField = new JTextField(); JLabel jLabel5 = new JLabel(); public JTextField hspaceField = new JTextField(); JLabel jLabel6 = new JLabel(); public JTextField vspaceField = new JTextField(); JLabel jLabel7 = new JLabel(); public JTextField borderField = new JTextField(); JLabel jLabel8 = new JLabel(); String[] aligns = {"left", "right", "top", "middle", "bottom", "absmiddle", "texttop", "baseline"}; // Note: align values are not localized because they are HTML keywords public JComboBox<String> alignCB = new JComboBox<String>(aligns); JLabel jLabel9 = new JLabel(); public JTextField urlField = new JTextField(); JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); JButton okB = new JButton(); JButton cancelB = new JButton(); public boolean CANCELLED = false; public ImageDialog(Frame frame) { super(frame, Local.getString("Image"), true); try { jbInit(); pack(); } catch (Exception ex) { ex.printStackTrace(); } super.addWindowListener(this); } public ImageDialog() { this(null); } void jbInit() throws Exception { this.setResizable(false); // three Panels, so used BorderLayout for this dialog. headerPanel.setBorder(new EmptyBorder(new Insets(0, 5, 0, 5))); headerPanel.setBackground(Color.WHITE); header.setFont(new java.awt.Font("Dialog", 0, 20)); header.setForeground(new Color(0, 0, 124)); header.setText(Local.getString("Image")); header.setIcon(new ImageIcon( net.sf.memoranda.ui.htmleditor.ImageDialog.class.getResource( "resources/icons/imgbig.png"))); headerPanel.add(header); this.getContentPane().add(headerPanel, BorderLayout.NORTH); areaPanel.setBorder(new EtchedBorder(Color.white, new Color(142, 142, 142))); jLabel1.setText(Local.getString("Image file")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.insets = new Insets(10, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel1, gbc); fileField.setMinimumSize(new Dimension(200, 25)); fileField.setPreferredSize(new Dimension(285, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 5; gbc.insets = new Insets(10, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; areaPanel.add(fileField, gbc); browseB.setMinimumSize(new Dimension(25, 25)); browseB.setPreferredSize(new Dimension(25, 25)); browseB.setIcon(new ImageIcon( net.sf.memoranda.ui.htmleditor.ImageDialog.class.getResource( "resources/icons/fileopen16.png"))); browseB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { browseB_actionPerformed(e); } }); gbc = new GridBagConstraints(); gbc.gridx = 6; gbc.gridy = 0; gbc.insets = new Insets(10, 5, 5, 10); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(browseB, gbc); jLabel2.setText(Local.getString("ALT text")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.insets = new Insets(5, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel2, gbc); altField.setPreferredSize(new Dimension(315, 25)); altField.setMinimumSize(new Dimension(200, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 6; gbc.insets = new Insets(5, 5, 5, 10); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; areaPanel.add(altField, gbc); jLabel3.setText(Local.getString("Width")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.insets = new Insets(5, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel3, gbc); widthField.setPreferredSize(new Dimension(30, 25)); widthField.setMinimumSize(new Dimension(30, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(widthField, gbc); jLabel4.setText(Local.getString("Height")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 2; gbc.insets = new Insets(5, 50, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel4, gbc); heightField.setMinimumSize(new Dimension(30, 25)); heightField.setPreferredSize(new Dimension(30, 25)); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 2; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(heightField, gbc); jLabel5.setText(Local.getString("H. space")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.insets = new Insets(5, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel5, gbc); hspaceField.setMinimumSize(new Dimension(30, 25)); hspaceField.setPreferredSize(new Dimension(30, 25)); hspaceField.setText("0"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(hspaceField, gbc); jLabel6.setText(Local.getString("V. space")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 3; gbc.insets = new Insets(5, 50, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel6, gbc); vspaceField.setMinimumSize(new Dimension(30, 25)); vspaceField.setPreferredSize(new Dimension(30, 25)); vspaceField.setText("0"); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 3; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(vspaceField, gbc); jLabel7.setText(Local.getString("Border")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.insets = new Insets(5, 10, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel7, gbc); borderField.setMinimumSize(new Dimension(30, 25)); borderField.setPreferredSize(new Dimension(30, 25)); borderField.setText("0"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(borderField, gbc); jLabel8.setText(Local.getString("Align")); gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = 4; gbc.insets = new Insets(5, 50, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel8, gbc); alignCB.setBackground(new Color(230, 230, 230)); alignCB.setFont(new java.awt.Font("Dialog", 1, 10)); alignCB.setPreferredSize(new Dimension(100, 25)); alignCB.setSelectedIndex(0); gbc = new GridBagConstraints(); gbc.gridx = 3; gbc.gridy = 4; gbc.gridwidth = 2; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(alignCB, gbc); jLabel9.setText(Local.getString("Hyperlink")); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 5; gbc.insets = new Insets(5, 10, 10, 5); gbc.anchor = GridBagConstraints.WEST; areaPanel.add(jLabel9, gbc); urlField.setPreferredSize(new Dimension(315, 25)); urlField.setMinimumSize(new Dimension(200, 25)); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 5; gbc.gridwidth = 6; gbc.insets = new Insets(5, 5, 10, 10); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; areaPanel.add(urlField, gbc); this.getContentPane().add(areaPanel, BorderLayout.CENTER); okB.setMaximumSize(new Dimension(100, 26)); okB.setMinimumSize(new Dimension(100, 26)); okB.setPreferredSize(new Dimension(100, 26)); okB.setText(Local.getString("Ok")); okB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { okB_actionPerformed(e); } }); this.getRootPane().setDefaultButton(okB); cancelB.setMaximumSize(new Dimension(100, 26)); cancelB.setMinimumSize(new Dimension(100, 26)); cancelB.setPreferredSize(new Dimension(100, 26)); cancelB.setText(Local.getString("Cancel")); cancelB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { cancelB_actionPerformed(e); } }); buttonsPanel.add(okB, null); buttonsPanel.add(cancelB, null); this.getContentPane().add(buttonsPanel, BorderLayout.SOUTH); } void okB_actionPerformed(ActionEvent e) { this.dispose(); } void cancelB_actionPerformed(ActionEvent e) { CANCELLED = true; this.dispose(); } private ImageIcon getPreviewIcon(java.io.File file) { ImageIcon tmpIcon = new ImageIcon(file.getPath()); ImageIcon thmb = null; if (tmpIcon.getIconHeight() > 48) { thmb = new ImageIcon(tmpIcon.getImage() .getScaledInstance( -1, 48, Image.SCALE_DEFAULT)); } else { thmb = tmpIcon; } if (thmb.getIconWidth() > 350) { return new ImageIcon(thmb.getImage() .getScaledInstance(350, -1, Image.SCALE_DEFAULT)); } else { return thmb; } } public void updatePreview() { try { if (!(new java.net.URL(fileField.getText()).getPath()).equals("")) header.setIcon(getPreviewIcon(new java.io.File( new java.net.URL(fileField.getText()).getPath()))); } catch (Exception ex) { ex.printStackTrace(); } } public void windowOpened(WindowEvent e) { } public void windowClosing(WindowEvent e) { CANCELLED = true; this.dispose(); } public void windowClosed(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } void browseB_actionPerformed(ActionEvent e) { // Fix until Sun's JVM supports more locales... UIManager.put("FileChooser.lookInLabelText", Local .getString("Look in:")); UIManager.put("FileChooser.upFolderToolTipText", Local.getString( "Up One Level")); UIManager.put("FileChooser.newFolderToolTipText", Local.getString( "Create New Folder")); UIManager.put("FileChooser.listViewButtonToolTipText", Local .getString("List")); UIManager.put("FileChooser.detailsViewButtonToolTipText", Local .getString("Details")); UIManager.put("FileChooser.fileNameLabelText", Local.getString( "File Name:")); UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString( "Files of Type:")); UIManager.put("FileChooser.openButtonText", Local.getString("Open")); UIManager.put("FileChooser.openButtonToolTipText", Local.getString( "Open selected file")); UIManager .put("FileChooser.cancelButtonText", Local.getString("Cancel")); UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString( "Cancel")); JFileChooser chooser = new JFileChooser(); chooser.setFileHidingEnabled(false); chooser.setDialogTitle(Local.getString("Choose an image file")); chooser.setAcceptAllFileFilterUsed(false); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.addChoosableFileFilter( new net.sf.memoranda.ui.htmleditor.filechooser.ImageFilter()); chooser.setAccessory( new net.sf.memoranda.ui.htmleditor.filechooser.ImagePreview( chooser)); chooser.setPreferredSize(new Dimension(550, 375)); java.io.File lastSel = (java.io.File) Context.get( "LAST_SELECTED_IMG_FILE"); if (lastSel != null) chooser.setCurrentDirectory(lastSel); if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { try { fileField.setText(chooser.getSelectedFile().toURI().toURL().toString()); header.setIcon(getPreviewIcon(chooser.getSelectedFile())); Context .put("LAST_SELECTED_IMG_FILE", chooser .getSelectedFile()); } catch (Exception ex) { fileField.setText(chooser.getSelectedFile().getPath()); } try { ImageIcon img = new ImageIcon(chooser.getSelectedFile() .getPath()); widthField.setText(new Integer(img.getIconWidth()).toString()); heightField .setText(new Integer(img.getIconHeight()).toString()); } catch (Exception ex) { ex.printStackTrace(); } } } }
Java
/* * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.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, see <http://www.gnu.org/licenses/>. */ #ifndef OUTDOOR_PVP_TF_ #define OUTDOOR_PVP_TF_ #include "OutdoorPvP.h" const uint8 OutdoorPvPTFBuffZonesNum = 5; const uint32 OutdoorPvPTFBuffZones[OutdoorPvPTFBuffZonesNum] = { 3519 /*Terokkar Forest*/, 3791 /*Sethekk Halls*/, 3789 /*Shadow Labyrinth*/, 3792 /*Mana-Tombs*/, 3790 /*Auchenai Crypts*/ }; // locked for 6 hours after capture const uint32 TF_LOCK_TIME = 3600 * 6 * 1000; // update lock timer every 1/4 minute (overkill, but this way it's sure the timer won't "jump" 2 minutes at once.) const uint32 TF_LOCK_TIME_UPDATE = 15000; // blessing of auchindoun #define TF_CAPTURE_BUFF 33377 const uint32 TF_ALLY_QUEST = 11505; const uint32 TF_HORDE_QUEST = 11506; enum OutdoorPvPTF_TowerType { TF_TOWER_NW = 0, TF_TOWER_N, TF_TOWER_NE, TF_TOWER_SE, TF_TOWER_S, TF_TOWER_NUM }; const go_type TFCapturePoints[TF_TOWER_NUM] = { {183104, 530, -3081.65f, 5335.03f, 17.1853f, -2.14675f, 0.0f, 0.0f, 0.878817f, -0.477159f}, {183411, 530, -2939.9f, 4788.73f, 18.987f, 2.77507f, 0.0f, 0.0f, 0.983255f, 0.182236f}, {183412, 530, -3174.94f, 4440.97f, 16.2281f, 1.86750f, 0.0f, 0.0f, 0.803857f, 0.594823f}, {183413, 530, -3603.31f, 4529.15f, 20.9077f, 0.994838f, 0.0f, 0.0f, 0.477159f, 0.878817f}, {183414, 530, -3812.37f, 4899.3f, 17.7249f, 0.087266f, 0.0f, 0.0f, 0.043619f, 0.999048f} }; struct tf_tower_world_state { uint32 n; uint32 h; uint32 a; }; const tf_tower_world_state TFTowerWorldStates[TF_TOWER_NUM] = { {0xa79, 0xa7a, 0xa7b}, {0xa7e, 0xa7d, 0xa7c}, {0xa82, 0xa81, 0xa80}, {0xa88, 0xa87, 0xa86}, {0xa85, 0xa84, 0xa83} }; const uint32 TFTowerPlayerEnterEvents[TF_TOWER_NUM] = { 12226, 12497, 12486, 12499, 12501 }; const uint32 TFTowerPlayerLeaveEvents[TF_TOWER_NUM] = { 12225, 12496, 12487, 12498, 12500 }; enum TFWorldStates { TF_UI_TOWER_SLIDER_POS = 0xa41, TF_UI_TOWER_SLIDER_N = 0xa40, TF_UI_TOWER_SLIDER_DISPLAY = 0xa3f, TF_UI_TOWER_COUNT_H = 0xa3e, TF_UI_TOWER_COUNT_A = 0xa3d, TF_UI_TOWERS_CONTROLLED_DISPLAY = 0xa3c, TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT = 0x9d0, TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT = 0x9ce, TF_UI_LOCKED_TIME_HOURS = 0x9cd, TF_UI_LOCKED_DISPLAY_NEUTRAL = 0x9cc, TF_UI_LOCKED_DISPLAY_HORDE = 0xad0, TF_UI_LOCKED_DISPLAY_ALLIANCE = 0xacf }; enum TFTowerStates { TF_TOWERSTATE_N = 1, TF_TOWERSTATE_H = 2, TF_TOWERSTATE_A = 4 }; class OPvPCapturePointTF : public OPvPCapturePoint { public: OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType type); bool Update(uint32 diff); void ChangeState(); void SendChangePhase(); void FillInitialWorldStates(WorldPacket & data); // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player); void HandlePlayerLeave(Player* player); void UpdateTowerState(); protected: OutdoorPvPTF_TowerType m_TowerType; uint32 m_TowerState; }; class OutdoorPvPTF : public OutdoorPvP { public: OutdoorPvPTF(); bool SetupOutdoorPvP(); void HandlePlayerEnterZone(Player* player, uint32 zone); void HandlePlayerLeaveZone(Player* player, uint32 zone); bool Update(uint32 diff); void FillInitialWorldStates(WorldPacket &data); void SendRemoveWorldStates(Player* player); uint32 GetAllianceTowersControlled() const; void SetAllianceTowersControlled(uint32 count); uint32 GetHordeTowersControlled() const; void SetHordeTowersControlled(uint32 count); bool IsLocked() const; private: bool m_IsLocked; uint32 m_LockTimer; uint32 m_LockTimerUpdate; uint32 m_AllianceTowersControlled; uint32 m_HordeTowersControlled; uint32 hours_left, second_digit, first_digit; }; #endif
Java
/* * QEMU Audio subsystem header * * Copyright (c) 2003-2005 Vassili Karpov (malc) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef QEMU_AUDIO_H #define QEMU_AUDIO_H #include "qemu/queue.h" #include "qapi/qapi-types-audio.h" typedef void (*audio_callback_fn) (void *opaque, int avail); #ifdef HOST_WORDS_BIGENDIAN #define AUDIO_HOST_ENDIANNESS 1 #else #define AUDIO_HOST_ENDIANNESS 0 #endif typedef struct audsettings { int freq; int nchannels; AudioFormat fmt; int endianness; } audsettings; audsettings audiodev_to_audsettings(AudiodevPerDirectionOptions *pdo); int audioformat_bytes_per_sample(AudioFormat fmt); int audio_buffer_frames(AudiodevPerDirectionOptions *pdo, audsettings *as, int def_usecs); int audio_buffer_samples(AudiodevPerDirectionOptions *pdo, audsettings *as, int def_usecs); int audio_buffer_bytes(AudiodevPerDirectionOptions *pdo, audsettings *as, int def_usecs); typedef enum { AUD_CNOTIFY_ENABLE, AUD_CNOTIFY_DISABLE } audcnotification_e; struct audio_capture_ops { void (*notify) (void *opaque, audcnotification_e cmd); void (*capture) (void *opaque, void *buf, int size); void (*destroy) (void *opaque); }; struct capture_ops { void (*info) (void *opaque); void (*destroy) (void *opaque); }; typedef struct CaptureState { void *opaque; struct capture_ops ops; QLIST_ENTRY (CaptureState) entries; } CaptureState; typedef struct SWVoiceOut SWVoiceOut; typedef struct CaptureVoiceOut CaptureVoiceOut; typedef struct SWVoiceIn SWVoiceIn; typedef struct QEMUSoundCard { char *name; QLIST_ENTRY (QEMUSoundCard) entries; } QEMUSoundCard; typedef struct QEMUAudioTimeStamp { uint64_t old_ts; } QEMUAudioTimeStamp; void AUD_vlog (const char *cap, const char *fmt, va_list ap) GCC_FMT_ATTR(2, 0); void AUD_log (const char *cap, const char *fmt, ...) GCC_FMT_ATTR(2, 3); void AUD_register_card (const char *name, QEMUSoundCard *card); void AUD_remove_card (QEMUSoundCard *card); CaptureVoiceOut *AUD_add_capture ( struct audsettings *as, struct audio_capture_ops *ops, void *opaque ); void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque); SWVoiceOut *AUD_open_out ( QEMUSoundCard *card, SWVoiceOut *sw, const char *name, void *callback_opaque, audio_callback_fn callback_fn, struct audsettings *settings ); void AUD_close_out (QEMUSoundCard *card, SWVoiceOut *sw); int AUD_write (SWVoiceOut *sw, void *pcm_buf, int size); int AUD_get_buffer_size_out (SWVoiceOut *sw); void AUD_set_active_out (SWVoiceOut *sw, int on); int AUD_is_active_out (SWVoiceOut *sw); void AUD_init_time_stamp_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); uint64_t AUD_get_elapsed_usec_out (SWVoiceOut *sw, QEMUAudioTimeStamp *ts); void AUD_set_volume_out (SWVoiceOut *sw, int mute, uint8_t lvol, uint8_t rvol); void AUD_set_volume_in (SWVoiceIn *sw, int mute, uint8_t lvol, uint8_t rvol); SWVoiceIn *AUD_open_in ( QEMUSoundCard *card, SWVoiceIn *sw, const char *name, void *callback_opaque, audio_callback_fn callback_fn, struct audsettings *settings ); void AUD_close_in (QEMUSoundCard *card, SWVoiceIn *sw); int AUD_read (SWVoiceIn *sw, void *pcm_buf, int size); void AUD_set_active_in (SWVoiceIn *sw, int on); int AUD_is_active_in (SWVoiceIn *sw); void AUD_init_time_stamp_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); uint64_t AUD_get_elapsed_usec_in (SWVoiceIn *sw, QEMUAudioTimeStamp *ts); static inline void *advance (void *p, int incr) { uint8_t *d = p; return (d + incr); } #ifdef __GNUC__ #define audio_MIN(a, b) ( __extension__ ({ \ __typeof (a) ta = a; \ __typeof (b) tb = b; \ ((ta)>(tb)?(tb):(ta)); \ })) #define audio_MAX(a, b) ( __extension__ ({ \ __typeof (a) ta = a; \ __typeof (b) tb = b; \ ((ta)<(tb)?(tb):(ta)); \ })) #else #define audio_MIN(a, b) ((a)>(b)?(b):(a)) #define audio_MAX(a, b) ((a)<(b)?(b):(a)) #endif int wav_start_capture (CaptureState *s, const char *path, int freq, int bits, int nchannels); bool audio_is_cleaning_up(void); void audio_cleanup(void); void audio_sample_to_uint64(void *samples, int pos, uint64_t *left, uint64_t *right); void audio_sample_from_uint64(void *samples, int pos, uint64_t left, uint64_t right); void audio_parse_option(const char *opt); void audio_init_audiodevs(void); void audio_legacy_help(void); #endif /* QEMU_AUDIO_H */
Java
/* Copyright (C) 2008-2016 Vana Development 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; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "party.hpp" #include "channel_server/channel_server.hpp" #include "channel_server/instance.hpp" #include "channel_server/map_packet.hpp" #include "channel_server/maps.hpp" #include "channel_server/party_packet.hpp" #include "channel_server/player.hpp" #include "channel_server/player_data_provider.hpp" #include "channel_server/player_packet.hpp" #include "channel_server/player_skills.hpp" #include "channel_server/world_server_packet.hpp" namespace vana { namespace channel_server { party::party(game_party_id party_id) : m_party_id{party_id} { } auto party::set_leader(game_player_id player_id, bool show_packet) -> void { m_leader_id = player_id; if (show_packet) { run_function([this, player_id](ref_ptr<player> player) { player->send(packets::party::set_leader(this, player_id)); }); } } namespace functors { struct join_party_update { auto operator()(ref_ptr<player> target) -> void { target->send(packets::party::join_party(target->get_map_id(), party, player)); } party *party; string player; }; } auto party::add_member(ref_ptr<player> player_value, bool first) -> void { m_members[player_value->get_id()] = player_value; player_value->set_party(this); show_hp_bar(player_value); receive_hp_bar(player_value); if (!first) { // This must be executed first in case the player has an open door already // The town position will need to change upon joining player_value->get_skills()->on_join_party(this, player_value); run_function([&](ref_ptr<player> party_member) { if (party_member != player_value) { party_member->get_skills()->on_join_party(this, player_value); } }); functors::join_party_update func = {this, player_value->get_name()}; run_function(func); } } auto party::add_member(game_player_id id, const string &name, bool first) -> void { m_members[id] = nullptr; if (!first) { functors::join_party_update func = {this, name}; run_function(func); } } auto party::set_member(game_player_id player_id, ref_ptr<player> player) -> void { m_members[player_id] = player; } namespace functors { struct leave_party_update { auto operator()(ref_ptr<player> target) -> void { target->send(packets::party::leave_party(target->get_map_id(), party, player_id, player, kicked)); } party *party; game_player_id player_id; string player; bool kicked; }; } auto party::delete_member(ref_ptr<player> player_value, bool kicked) -> void { player_value->get_skills()->on_leave_party(this, player_value, kicked); m_members.erase(player_value->get_id()); player_value->set_party(nullptr); if (instance *inst = get_instance()) { inst->remove_party_member(get_id(), player_value->get_id()); } run_function([&](ref_ptr<player> party_member) { if (party_member != player_value) { party_member->get_skills()->on_leave_party(this, player_value, kicked); } }); functors::leave_party_update func = {this, player_value->get_id(), player_value->get_name(), kicked}; func(player_value); run_function(func); } auto party::delete_member(game_player_id id, const string &name, bool kicked) -> void { if (instance *inst = get_instance()) { inst->remove_party_member(get_id(), id); } m_members.erase(id); functors::leave_party_update func = {this, id, name, kicked}; run_function(func); } auto party::disband() -> void { if (instance *inst = get_instance()) { inst->party_disband(get_id()); set_instance(nullptr); } run_function([&](ref_ptr<player> party_member) { party_member->get_skills()->on_party_disband(this); }); auto temp = m_members; for (const auto &kvp : temp) { if (auto player = kvp.second) { player->set_party(nullptr); player->send(packets::party::disband_party(this)); } m_members.erase(kvp.first); } } auto party::silent_update() -> void { run_function([this](ref_ptr<player> player) { player->send(packets::party::silent_update(player->get_map_id(), this)); }); } auto party::get_member_by_index(uint8_t one_based_index) -> ref_ptr<player> { ref_ptr<player> member = nullptr; if (one_based_index <= m_members.size()) { uint8_t f = 0; for (const auto &kvp : m_members) { f++; if (f == one_based_index) { member = kvp.second; break; } } } return member; } auto party::get_zero_based_index_by_member(ref_ptr<player> player) -> int8_t { int8_t index = 0; for (const auto &kvp : m_members) { if (kvp.second == player) { return index; } index++; } return -1; } auto party::run_function(function<void(ref_ptr<player>)> func) -> void { for (const auto &kvp : m_members) { if (auto player = kvp.second) { func(player); } } } auto party::get_all_player_ids() -> vector<game_player_id> { vector<game_player_id> player_ids; for (const auto &kvp : m_members) { player_ids.push_back(kvp.first); } return player_ids; } auto party::get_party_members(game_map_id map_id) -> vector<ref_ptr<player>> { vector<ref_ptr<player>> players; run_function([&players, &map_id](ref_ptr<player> player) { if (map_id == -1 || player->get_map_id() == map_id) { players.push_back(player); } }); return players; } auto party::show_hp_bar(ref_ptr<player> player_value) -> void { run_function([&player_value](ref_ptr<player> test_player) { if (test_player != player_value && test_player->get_map_id() == player_value->get_map_id()) { test_player->send(packets::player::show_hp_bar(player_value->get_id(), player_value->get_stats()->get_hp(), player_value->get_stats()->get_max_hp())); } }); } auto party::receive_hp_bar(ref_ptr<player> player_value) -> void { run_function([&player_value](ref_ptr<player> test_player) { if (test_player != player_value && test_player->get_map_id() == player_value->get_map_id()) { player_value->send(packets::player::show_hp_bar(test_player->get_id(), test_player->get_stats()->get_hp(), test_player->get_stats()->get_max_hp())); } }); } auto party::get_member_count_on_map(game_map_id map_id) -> int8_t { int8_t count = 0; for (const auto &kvp : m_members) { if (auto test = kvp.second) { if (test->get_map_id() == map_id) { count++; } } } return count; } auto party::is_within_level_range(game_player_level low_bound, game_player_level high_bound) -> bool { bool ret = true; for (const auto &kvp : m_members) { if (auto test = kvp.second) { if (test->get_stats()->get_level() < low_bound || test->get_stats()->get_level() > high_bound) { ret = false; break; } } } return ret; } auto party::warp_all_members(game_map_id map_id, const string &portal_name) -> void { if (map *destination = maps::get_map(map_id)) { const data::type::portal_info * const destination_portal = destination->query_portal_name(portal_name); run_function([&](ref_ptr<player> test) { test->set_map(map_id, destination_portal); }); } } auto party::check_footholds(int8_t member_count, const vector<vector<game_foothold_id>> &footholds) -> result { // Determines if the players are properly arranged (i.e. 5 people on 5 barrels in Kerning PQ) result winner = result::success; int8_t members_on_footholds = 0; hash_set<size_t> foothold_groups_used; for (size_t group = 0; group < footholds.size(); group++) { const auto &group_footholds = footholds[group]; for (const auto &kvp : m_members) { if (auto test = kvp.second) { for (const auto &foothold : group_footholds) { if (test->get_foothold() == foothold) { if (foothold_groups_used.find(group) != std::end(foothold_groups_used)) { winner = result::failure; } else { foothold_groups_used.insert(group); members_on_footholds++; } break; } } } if (winner == result::failure) { break; } } if (winner == result::failure) { break; } } if (winner == result::success && members_on_footholds != member_count) { // Not all the foothold groups were indexed winner = result::failure; } return winner; } auto party::verify_footholds(const vector<vector<game_foothold_id>> &footholds) -> result { // Determines if the players match your selected footholds result winner = result::success; hash_set<size_t> foothold_groups_used; for (size_t group = 0; group < footholds.size(); group++) { const auto &group_footholds = footholds[group]; for (const auto &kvp : m_members) { if (auto test = kvp.second) { for (const auto &foothold : group_footholds) { if (test->get_foothold() == foothold) { if (foothold_groups_used.find(group) != std::end(foothold_groups_used)) { winner = result::failure; } else { foothold_groups_used.insert(group); } break; } } if (winner == result::failure) { break; } } } if (winner == result::failure) { break; } } if (winner == result::success) { winner = foothold_groups_used.size() == footholds.size() ? result::success : result::failure; } return winner; } } }
Java
/* * Copyright (C) 2013-2014 * Sebastian Schmitz <sschmitz@informatik.uni-siegen.de> * * 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/>. */ #ifndef CHANNEL_H #define CHANNEL_H #include <eq/eq.h> #include "pipe.h" #include <OgreMatrix4.h> namespace vr{ /* * Channel */ class Channel : public eq::Channel { public: Channel(eq::Window *parent); protected: virtual bool configInit(const eq::uint128_t &init_id); virtual void frameDraw(const eq::uint128_t &frame_id); Ogre::Matrix4 calcViewMatrix( Ogre::Vector3 eye, Ogre::Vector3 target, Ogre::Vector3 up ) const; }; } #endif // CHANNEL_H
Java
<?php /** * @package angifw * @copyright Copyright (C) 2009-2013 Nicholas K. Dionysopoulos. All rights reserved. * @author Nicholas K. Dionysopoulos - http://www.dionysopoulos.me * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL v3 or later * * Akeeba Next Generation Installer Framework */ defined('_AKEEBA') or die(); class AModel { /** * Input variables, passed on from the controller, in an associative array * @var array */ protected $input = array(); /** * Should I save the model's state in the session? * @var bool */ protected $_savestate = true; /** * The model (base) name * * @var string */ protected $name; /** * The URL option for the component. * * @var string */ protected $option = null; /** * A state object * * @var string */ protected $state; /** * Are the state variables already set? * * @var bool */ protected $_state_set = false; /** * Returns a new model object. Unless overriden by the $config array, it will * try to automatically populate its state from the request variables. * * @param string $type * @param string $prefix * @param array $config * @return AModel */ public static function &getAnInstance( $type, $prefix = '', $config = array() ) { $type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type); $modelClass = $prefix.ucfirst($type); $result = false; // Guess the component name and include path if (!empty($prefix)) { preg_match('/(.*)Model$/', $prefix, $m); $component = strtolower($m[1]); } else { $component = ''; } if (array_key_exists('input', $config)) { if (!($config['input'] instanceof AInput)) { if (!is_array($config['input'])) { $config['input'] = (array)$config['input']; } $config['input'] = array_merge($_REQUEST, $config['input']); $config['input'] = new AInput($config['input']); } } else { $config['input'] = new AInput(); } if (empty($component)) { $defaultApp = AApplication::getInstance()->getName(); $component = $config['input']->get('option', $defaultApp); } $config['option'] = $component; $needsAView = true; if(array_key_exists('view', $config)) { if (!empty($config['view'])) { $needsAView = false; } } if ($needsAView) { $config['view'] = strtolower($type); } $config['input']->set('option', $config['option']); $config['input']->set('view', $config['view']); // Try to load the requested model class if (!class_exists( $modelClass )) { $include_paths = array( APATH_INSTALLATION . '/' . $component . '/models', ); // Try to load the model file $path = AUtilsPath::find( $include_paths, self::createFileName( 'model', array( 'name' => $type)) ); if ($path) { require_once $path; } } // Fallback to the generic AModel model class if (!class_exists( $modelClass )) { $modelClass = 'AModel'; } $result = new $modelClass($config); return $result; } /** * Returns a new instance of a model, with the state reset to defaults * * @param string $type * @param string $prefix * @param array $config * * @return AModel */ public static function &getTmpInstance($type, $prefix = '', $config = array()) { $ret = self::getAnInstance($type, $prefix, $config) ->getClone() ->clearState() ->clearInput() ->savestate(0); return $ret; } /** * Public class constructor * * @param type $config */ public function __construct($config = array()) { // Get the input if (array_key_exists('input', $config)) { if($config['input'] instanceof AInput) { $this->input = $config['input']; } else { $this->input = new AInput($config['input']); } } else { $this->input = new AInput(); } // Set the $name variable $component = $this->input->getCmd('option','com_foobar'); if (array_key_exists('option', $config)) { $component = $config['option']; } $name = strtolower($component); if(array_key_exists('name', $config)) { $name = $config['name']; } $this->input->set('option', $component); $this->name = $name; $this->option = $component; // Get the view name $className = get_class($this); if ($className == 'AModel') { if (array_key_exists('view', $config)) { $view = $config['view']; } if (empty($view)) { $view = $this->input->getCmd('view', 'cpanel'); } } else { $eliminatePart = ucfirst($name).'Model'; $view = strtolower(str_replace($eliminatePart, '', $className)); } // Set the model state if (array_key_exists('state', $config)) { $this->state = $config['state']; } else { $this->state = new AObject; } // Set the internal state marker - used to ignore setting state from the request if (!empty($config['ignore_request'])) { $this->_state_set = true; } } /** * Create the filename for a resource * * @param string $type The resource type to create the filename for. * @param array $parts An associative array of filename information. * * @return string The filename */ protected static function createFileName($type, $parts = array()) { $filename = ''; switch ($type) { case 'model': $filename = strtolower($parts['name']) . '.php'; break; } return $filename; } /** * Method to get the model name * * The model name. By default parsed using the classname or it can be set * by passing a $config['name'] in the class constructor * * @return string The name of the model */ public function getName() { if (empty($this->name)) { $r = null; if (!preg_match('/Model(.*)/i', get_class($this), $r)) { JError::raiseError(500, AText::_('ANGI_APPLICATION_ERROR_MODEL_GET_NAME')); } $this->name = strtolower($r[1]); } return $this->name; } /** * Get a filtered state variable * @param string $key * @param mixed $default * @param string $filter_type * @return mixed */ public function getState($key = null, $default = null, $filter_type = 'raw') { if(empty($key)) { return $this->internal_getState(); } // Get the savestate status $value = $this->internal_getState($key); if(is_null($value)) { $value = $this->getUserStateFromRequest($key, $key, $value, 'none', $this->_savestate); if(is_null($value)) { return $default; } } if( strtoupper($filter_type) == 'RAW' ) { return $value; } else { $filter = new AFilterInput(); return $filter->clean($value, $filter_type); } } public function getHash() { static $hash = null; if(is_null($hash)) { $defaultApp = AApplication::getInstance()->getName(); $option = $this->input->getCmd('option', $defaultApp); $view = $this->input->getCmd('view', 'cpanel'); $hash = "$option.$view."; } return $hash; } /** * Gets the value of a user state variable. * * @access public * @param string The key of the user state variable. * @param string The name of the variable passed in a request. * @param string The default value for the variable if not found. Optional. * @param string Filter for the variable, for valid values see {@link JFilterInput::clean()}. Optional. * @param bool Should I save the variable in the user state? Default: true. Optional. * @return The request user state. */ protected function getUserStateFromRequest( $key, $request, $default = null, $type = 'none', $setUserState = true ) { $session = ASession::getInstance(); $hash = $this->getHash(); $old_state = $session->get($hash.$key, null); $cur_state = (!is_null($old_state)) ? $old_state : $default; $new_state = $this->input->get($request, null, $type); // Save the new value only if it was set in this request if($setUserState) { if ($new_state !== null) { $session->set($hash.$key, $new_state); } else { $new_state = $cur_state; } } elseif (is_null($new_state)) { $new_state = $cur_state; } return $new_state; } /** * Method to get model state variables * * @param string $property Optional parameter name * @param mixed $default Optional default value * * @return object The property where specified, the state object where omitted */ private function internal_getState($property = null, $default = null) { if (!$this->_state_set) { // Protected method to auto-populate the model state. $this->populateState(); // Set the model state set flag to true. $this->_state_set = true; } return $property === null ? $this->state : $this->state->get($property, $default); } /** * Method to auto-populate the model state. * * This method should only be called once per instantiation and is designed * to be called on the first call to the getState() method unless the model * configuration flag to ignore the request is set. * * @return void * * @note Calling getState in this method will result in recursion. */ protected function populateState() { } /** * Method to set model state variables * * @param string $property The name of the property. * @param mixed $value The value of the property to set or null. * * @return mixed The previous value of the property or null if not set. */ public function setState($property, $value = null) { return $this->state->set($property, $value); } /** * Clears the model state, but doesn't touch the internal lists of records, * record tables or record id variables. To clear these values, please use * reset(). * * @return AModel */ public function clearState() { $this->state = new AObject(); return $this; } /** * Clears the input array. * * @return AModel */ public function clearInput() { $this->input = new AInput(array()); return $this; } /** * Clones the model object and returns the clone * @return AModel */ public function &getClone() { $clone = clone($this); return $clone; } /** * Magic getter; allows to use the name of model state keys as properties * @param string $name * @return mixed */ public function __get($name) { return $this->getState($name); } /** * Magic setter; allows to use the name of model state keys as properties * @param string $name * @return mixed */ public function __set($name, $value) { return $this->setState($name, $value); } /** * Magic caller; allows to use the name of model state keys as methods to * set their values. * * @param string $name * @param mixed $arguments * @return AModel */ public function __call($name, $arguments) { $arg1 = array_shift($arguments); $this->setState($name, $arg1); return $this; } /** * Sets the model state auto-save status. By default the model is set up to * save its state to the session. * * @param bool $newState True to save the state, false to not save it. */ public function &savestate($newState) { $this->_savestate = $newState ? true : false; return $this; } public function populateSavesate() { if(is_null($this->_savestate)) { $savestate = $this->input->getInt('savestate', -999); if($savestate == -999) { $savestate = true; } $this->savestate($savestate); } } }
Java
// SPDX-License-Identifier: GPL-2.0 #include "color.h" #include <QMap> #include <array> // Note that std::array<QColor, 2> is in every respect equivalent to QColor[2], // but allows assignment, comparison, can be returned from functions, etc. static QMap<color_index_t, std::array<QColor, 2>> profile_color = { { SAC_1, {{ FUNGREEN1, BLACK1_LOW_TRANS }} }, { SAC_2, {{ APPLE1, BLACK1_LOW_TRANS }} }, { SAC_3, {{ ATLANTIS1, BLACK1_LOW_TRANS }} }, { SAC_4, {{ ATLANTIS2, BLACK1_LOW_TRANS }} }, { SAC_5, {{ EARLSGREEN1, BLACK1_LOW_TRANS }} }, { SAC_6, {{ HOKEYPOKEY1, BLACK1_LOW_TRANS }} }, { SAC_7, {{ TUSCANY1, BLACK1_LOW_TRANS }} }, { SAC_8, {{ CINNABAR1, BLACK1_LOW_TRANS }} }, { SAC_9, {{ REDORANGE1, BLACK1_LOW_TRANS }} }, { VELO_STABLE, {{ CAMARONE1, BLACK1_LOW_TRANS }} }, { VELO_SLOW, {{ LIMENADE1, BLACK1_LOW_TRANS }} }, { VELO_MODERATE, {{ RIOGRANDE1, BLACK1_LOW_TRANS }} }, { VELO_FAST, {{ PIRATEGOLD1, BLACK1_LOW_TRANS }} }, { VELO_CRAZY, {{ RED1, BLACK1_LOW_TRANS }} }, { PO2, {{ APPLE1, BLACK1_LOW_TRANS }} }, { PO2_ALERT, {{ RED1, BLACK1_LOW_TRANS }} }, { PN2, {{ BLACK1_LOW_TRANS, BLACK1_LOW_TRANS }} }, { PN2_ALERT, {{ RED1, BLACK1_LOW_TRANS }} }, { PHE, {{ PEANUT, BLACK1_LOW_TRANS }} }, { PHE_ALERT, {{ RED1, BLACK1_LOW_TRANS }} }, { O2SETPOINT, {{ PIRATEGOLD1_MED_TRANS, BLACK1_LOW_TRANS }} }, { CCRSENSOR1, {{ TUNDORA1_MED_TRANS, BLACK1_LOW_TRANS }} }, { CCRSENSOR2, {{ ROYALBLUE2_LOW_TRANS, BLACK1_LOW_TRANS }} }, { CCRSENSOR3, {{ PEANUT, BLACK1_LOW_TRANS }} }, { SCR_OCPO2, {{ PIRATEGOLD1_MED_TRANS, BLACK1_LOW_TRANS }} }, { PP_LINES, {{ BLACK1_HIGH_TRANS, BLACK1_LOW_TRANS }} }, { TEXT_BACKGROUND, {{ CONCRETE1_LOWER_TRANS, WHITE1 }} }, { ALERT_BG, {{ BROOM1_LOWER_TRANS, BLACK1_LOW_TRANS }} }, { ALERT_FG, {{ BLACK1_LOW_TRANS, WHITE1 }} }, { EVENTS, {{ REDORANGE1, BLACK1_LOW_TRANS }} }, { SAMPLE_DEEP, {{ QColor(Qt::red).darker(), BLACK1 }} }, { SAMPLE_SHALLOW, {{ QColor(Qt::red).lighter(), BLACK1_LOW_TRANS }} }, { SMOOTHED, {{ REDORANGE1_HIGH_TRANS, BLACK1_LOW_TRANS }} }, { MINUTE, {{ MEDIUMREDVIOLET1_HIGHER_TRANS, BLACK1_LOW_TRANS }} }, { TIME_GRID, {{ WHITE1, BLACK1_HIGH_TRANS }} }, { TIME_TEXT, {{ FORESTGREEN1, BLACK1 }} }, { DEPTH_GRID, {{ WHITE1, BLACK1_HIGH_TRANS }} }, { MEAN_DEPTH, {{ REDORANGE1_MED_TRANS, BLACK1_LOW_TRANS }} }, { HR_PLOT, {{ REDORANGE1_MED_TRANS, BLACK1_LOW_TRANS }} }, { HR_TEXT, {{ REDORANGE1_MED_TRANS, BLACK1_LOW_TRANS }} }, { HR_AXIS, {{ MED_GRAY_HIGH_TRANS, MED_GRAY_HIGH_TRANS }} }, { DEPTH_BOTTOM, {{ GOVERNORBAY1_MED_TRANS, BLACK1_HIGH_TRANS }} }, { DEPTH_TOP, {{ MERCURY1_MED_TRANS, WHITE1_MED_TRANS }} }, { TEMP_TEXT, {{ GOVERNORBAY2, BLACK1_LOW_TRANS }} }, { TEMP_PLOT, {{ ROYALBLUE2_LOW_TRANS, BLACK1_LOW_TRANS }} }, { SAC_DEFAULT, {{ WHITE1, BLACK1_LOW_TRANS }} }, { BOUNDING_BOX, {{ WHITE1, BLACK1_LOW_TRANS }} }, { PRESSURE_TEXT, {{ KILLARNEY1, BLACK1_LOW_TRANS }} }, { BACKGROUND, {{ SPRINGWOOD1, WHITE1 }} }, { BACKGROUND_TRANS, {{ SPRINGWOOD1_MED_TRANS, WHITE1_MED_TRANS }} }, { CEILING_SHALLOW, {{ REDORANGE1_HIGH_TRANS, BLACK1_HIGH_TRANS }} }, { CEILING_DEEP, {{ RED1_MED_TRANS, BLACK1_HIGH_TRANS }} }, { CALC_CEILING_SHALLOW, {{ FUNGREEN1_HIGH_TRANS, BLACK1_HIGH_TRANS }} }, { CALC_CEILING_DEEP, {{ APPLE1_HIGH_TRANS, BLACK1_HIGH_TRANS }} }, { TISSUE_PERCENTAGE, {{ GOVERNORBAY2, BLACK1_LOW_TRANS }} }, { DURATION_LINE, {{ BLACK1, BLACK1_LOW_TRANS }} } }; QColor getColor(const color_index_t i, bool isGrayscale) { if (profile_color.count() > i && i >= 0) return profile_color[i][isGrayscale ? 1 : 0]; return QColor(Qt::black); } QColor getSacColor(int sac, int avg_sac) { int sac_index = 0; int delta = sac - avg_sac + 7000; sac_index = delta / 2000; if (sac_index < 0) sac_index = 0; if (sac_index > SAC_COLORS - 1) sac_index = SAC_COLORS - 1; return getColor((color_index_t)(SAC_COLORS_START_IDX + sac_index), false); } QColor getPressureColor(double density) { QColor color; int h = ((int) (180.0 - 180.0 * density / 8.0)); while (h < 0) h += 360; color.setHsv(h , 255, 255); return color; }
Java
/* Operating system support for run-time dynamic linker. Hurd version. Copyright (C) 1995-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* In the static library, this is all handled by dl-support.c or by the vanilla definitions in the rest of the C library. */ #ifdef SHARED #include <hurd.h> #include <link.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/mman.h> #include <ldsodefs.h> #include <sys/wait.h> #include <assert.h> #include <sysdep.h> #include <mach/mig_support.h> #include "hurdstartup.h" #include <hurd/lookup.h> #include <hurd/auth.h> #include <hurd/term.h> #include <stdarg.h> #include <ctype.h> #include <sys/stat.h> #include <sys/uio.h> #include <entry.h> #include <dl-machine.h> #include <dl-procinfo.h> extern void __mach_init (void); extern int _dl_argc; extern char **_dl_argv; extern char **_environ; int __libc_enable_secure = 0; INTVARDEF(__libc_enable_secure) int __libc_multiple_libcs = 0; /* Defining this here avoids the inclusion of init-first. */ /* This variable contains the lowest stack address ever used. */ void *__libc_stack_end; #if HP_TIMING_AVAIL hp_timing_t _dl_cpuclock_offset; #endif /* TODO: this is never properly initialized in here. */ void *_dl_random attribute_relro = NULL; struct hurd_startup_data *_dl_hurd_data; #define FMH defined(__i386__) #if ! FMH # define fmh() ((void)0) # define unfmh() ((void)0) #else /* XXX loser kludge for vm_map kernel bug */ #undef ELF_MACHINE_USER_ADDRESS_MASK #define ELF_MACHINE_USER_ADDRESS_MASK 0 static vm_address_t fmha; static vm_size_t fmhs; static void unfmh(void){ __vm_deallocate(__mach_task_self(),fmha,fmhs);} static void fmh(void) { error_t err;int x;mach_port_t p; vm_address_t a=0x08000000U,max=VM_MAX_ADDRESS; while (!(err=__vm_region(__mach_task_self(),&a,&fmhs,&x,&x,&x,&x,&p,&x))){ __mach_port_deallocate(__mach_task_self(),p); if (a+fmhs>=0x80000000U){ max=a; break;} fmha=a+=fmhs;} if (err) assert(err==KERN_NO_SPACE); if (!fmha) fmhs=0; else while (1) { fmhs=max-fmha; if (fmhs == 0) break; err = __vm_map (__mach_task_self (), &fmha, fmhs, 0, 0, MACH_PORT_NULL, 0, 1, VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY); if (!err) break; if (err != KERN_INVALID_ADDRESS && err != KERN_NO_SPACE) assert_perror(err); vm_address_t new_max = (max - 1) & 0xf0000000U; if (new_max >= max) { fmhs = 0; fmha = 0; break; } max = new_max; } } /* XXX loser kludge for vm_map kernel bug */ #endif ElfW(Addr) _dl_sysdep_start (void **start_argptr, void (*dl_main) (const ElfW(Phdr) *phdr, ElfW(Word) phent, ElfW(Addr) *user_entry, ElfW(auxv_t) *auxv)) { void go (intptr_t *argdata) { char **p; /* Cache the information in various global variables. */ _dl_argc = *argdata; _dl_argv = 1 + (char **) argdata; _environ = &_dl_argv[_dl_argc + 1]; for (p = _environ; *p++;); /* Skip environ pointers and terminator. */ if ((void *) p == _dl_argv[0]) { static struct hurd_startup_data nodata; _dl_hurd_data = &nodata; nodata.user_entry = (vm_address_t) ENTRY_POINT; } else _dl_hurd_data = (void *) p; INTUSE(__libc_enable_secure) = _dl_hurd_data->flags & EXEC_SECURE; if (_dl_hurd_data->flags & EXEC_STACK_ARGS && _dl_hurd_data->user_entry == 0) _dl_hurd_data->user_entry = (vm_address_t) ENTRY_POINT; unfmh(); /* XXX */ #if 0 /* XXX make this work for real someday... */ if (_dl_hurd_data->user_entry == (vm_address_t) ENTRY_POINT) /* We were invoked as a command, not as the program interpreter. The generic ld.so code supports this: it will parse the args as "ld.so PROGRAM [ARGS...]". For booting the Hurd, we support an additional special syntax: ld.so [-LIBS...] PROGRAM [ARGS...] Each LIBS word consists of "FILENAME=MEMOBJ"; for example "-/lib/libc.so=123" says that the contents of /lib/libc.so are found in a memory object whose port name in our task is 123. */ while (_dl_argc > 2 && _dl_argv[1][0] == '-' && _dl_argv[1][1] != '-') { char *lastslash, *memobjname, *p; struct link_map *l; mach_port_t memobj; error_t err; ++_dl_skip_args; --_dl_argc; p = _dl_argv++[1] + 1; memobjname = strchr (p, '='); if (! memobjname) _dl_sysdep_fatal ("Bogus library spec: ", p, "\n", NULL); *memobjname++ = '\0'; memobj = 0; while (*memobjname != '\0') memobj = (memobj * 10) + (*memobjname++ - '0'); /* Add a user reference on the memory object port, so we will still have one after _dl_map_object_from_fd calls our `close'. */ err = __mach_port_mod_refs (__mach_task_self (), memobj, MACH_PORT_RIGHT_SEND, +1); assert_perror (err); lastslash = strrchr (p, '/'); l = _dl_map_object_from_fd (lastslash ? lastslash + 1 : p, memobj, strdup (p), 0); /* Squirrel away the memory object port where it can be retrieved by the program later. */ l->l_info[DT_NULL] = (void *) memobj; } #endif /* Call elf/rtld.c's main program. It will set everything up and leave us to transfer control to USER_ENTRY. */ (*dl_main) ((const ElfW(Phdr) *) _dl_hurd_data->phdr, _dl_hurd_data->phdrsz / sizeof (ElfW(Phdr)), &_dl_hurd_data->user_entry, NULL); /* The call above might screw a few things up. First of all, if _dl_skip_args is nonzero, we are ignoring the first few arguments. However, if we have no Hurd startup data, it is the magical convention that ARGV[0] == P. The startup code in init-first.c will get confused if this is not the case, so we must rearrange things to make it so. We'll overwrite the origional ARGV[0] at P with ARGV[_dl_skip_args]. Secondly, if we need to be secure, it removes some dangerous environment variables. If we have no Hurd startup date this changes P (since that's the location after the terminating NULL in the list of environment variables). We do the same thing as in the first case but make sure we recalculate P. If we do have Hurd startup data, we have to move the data such that it starts just after the terminating NULL in the environment list. We use memmove, since the locations might overlap. */ if (INTUSE(__libc_enable_secure) || _dl_skip_args) { char **newp; for (newp = _environ; *newp++;); if (_dl_argv[-_dl_skip_args] == (char *) p) { if ((char *) newp != _dl_argv[0]) { assert ((char *) newp < _dl_argv[0]); _dl_argv[0] = memmove ((char *) newp, _dl_argv[0], strlen (_dl_argv[0]) + 1); } } else { if ((void *) newp != _dl_hurd_data) memmove (newp, _dl_hurd_data, sizeof (*_dl_hurd_data)); } } { extern void _dl_start_user (void); /* Unwind the stack to ARGDATA and simulate a return from _dl_start to the RTLD_START code which will run the user's entry point. */ RETURN_TO (argdata, &_dl_start_user, _dl_hurd_data->user_entry); } } /* Set up so we can do RPCs. */ __mach_init (); /* Initialize frequently used global variable. */ GLRO(dl_pagesize) = __getpagesize (); #if HP_TIMING_AVAIL HP_TIMING_NOW (_dl_cpuclock_offset); #endif fmh(); /* XXX */ /* See hurd/hurdstartup.c; this deals with getting information from the exec server and slicing up the arguments. Then it will call `go', above. */ _hurd_startup (start_argptr, &go); LOSE; abort (); } void internal_function _dl_sysdep_start_cleanup (void) { /* Deallocate the reply port and task port rights acquired by __mach_init. We are done with them now, and the user will reacquire them for himself when he wants them. */ __mig_dealloc_reply_port (MACH_PORT_NULL); __mach_port_deallocate (__mach_task_self (), __mach_task_self_); } /* Minimal open/close/mmap implementation sufficient for initial loading of shared libraries. These are weak definitions so that when the dynamic linker re-relocates itself to be user-visible (for -ldl), it will get the user's definition (i.e. usually libc's). */ /* Open FILE_NAME and return a Hurd I/O for it in *PORT, or return an error. If STAT is non-zero, stat the file into that stat buffer. */ static error_t open_file (const char *file_name, int flags, mach_port_t *port, struct stat64 *stat) { enum retry_type doretry; char retryname[1024]; /* XXX string_t LOSES! */ file_t startdir; error_t err; error_t use_init_port (int which, error_t (*operate) (file_t)) { return (which < _dl_hurd_data->portarraysize ? ((*operate) (_dl_hurd_data->portarray[which])) : EGRATUITOUS); } file_t get_dtable_port (int fd) { if ((unsigned int) fd < _dl_hurd_data->dtablesize && _dl_hurd_data->dtable[fd] != MACH_PORT_NULL) { __mach_port_mod_refs (__mach_task_self (), _dl_hurd_data->dtable[fd], MACH_PORT_RIGHT_SEND, +1); return _dl_hurd_data->dtable[fd]; } errno = EBADF; return MACH_PORT_NULL; } assert (!(flags & ~(O_READ | O_CLOEXEC))); startdir = _dl_hurd_data->portarray[file_name[0] == '/' ? INIT_PORT_CRDIR : INIT_PORT_CWDIR]; while (file_name[0] == '/') file_name++; err = __dir_lookup (startdir, (char *)file_name, O_RDONLY, 0, &doretry, retryname, port); if (!err) err = __hurd_file_name_lookup_retry (use_init_port, get_dtable_port, __dir_lookup, doretry, retryname, O_RDONLY, 0, port); if (!err && stat) { err = __io_stat (*port, stat); if (err) __mach_port_deallocate (__mach_task_self (), *port); } return err; } int weak_function __open (const char *file_name, int mode, ...) { mach_port_t port; error_t err = open_file (file_name, mode, &port, 0); if (err) return __hurd_fail (err); else return (int)port; } int weak_function __close (int fd) { if (fd != (int) MACH_PORT_NULL) __mach_port_deallocate (__mach_task_self (), (mach_port_t) fd); return 0; } __ssize_t weak_function __libc_read (int fd, void *buf, size_t nbytes) { error_t err; char *data; mach_msg_type_number_t nread; data = buf; nread = nbytes; err = __io_read ((mach_port_t) fd, &data, &nread, -1, nbytes); if (err) return __hurd_fail (err); if (data != buf) { memcpy (buf, data, nread); __vm_deallocate (__mach_task_self (), (vm_address_t) data, nread); } return nread; } libc_hidden_weak (__libc_read) __ssize_t weak_function __libc_write (int fd, const void *buf, size_t nbytes) { error_t err; mach_msg_type_number_t nwrote; assert (fd < _hurd_init_dtablesize); err = __io_write (_hurd_init_dtable[fd], buf, nbytes, -1, &nwrote); if (err) return __hurd_fail (err); return nwrote; } libc_hidden_weak (__libc_write) /* This is only used for printing messages (see dl-misc.c). */ __ssize_t weak_function __writev (int fd, const struct iovec *iov, int niov) { if (fd >= _hurd_init_dtablesize) { errno = EBADF; return -1; } int i; size_t total = 0; for (i = 0; i < niov; ++i) total += iov[i].iov_len; if (total != 0) { char buf[total], *bufp = buf; error_t err; mach_msg_type_number_t nwrote; for (i = 0; i < niov; ++i) bufp = (memcpy (bufp, iov[i].iov_base, iov[i].iov_len) + iov[i].iov_len); err = __io_write (_hurd_init_dtable[fd], buf, total, -1, &nwrote); if (err) return __hurd_fail (err); return nwrote; } return 0; } off64_t weak_function __libc_lseek64 (int fd, off64_t offset, int whence) { error_t err; err = __io_seek ((mach_port_t) fd, offset, whence, &offset); if (err) return __hurd_fail (err); return offset; } __ptr_t weak_function __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) { error_t err; vm_prot_t vmprot; vm_address_t mapaddr; mach_port_t memobj_rd, memobj_wr; vmprot = VM_PROT_NONE; if (prot & PROT_READ) vmprot |= VM_PROT_READ; if (prot & PROT_WRITE) vmprot |= VM_PROT_WRITE; if (prot & PROT_EXEC) vmprot |= VM_PROT_EXECUTE; if (flags & MAP_ANON) memobj_rd = MACH_PORT_NULL; else { assert (!(flags & MAP_SHARED)); err = __io_map ((mach_port_t) fd, &memobj_rd, &memobj_wr); if (err) return __hurd_fail (err), MAP_FAILED; __mach_port_deallocate (__mach_task_self (), memobj_wr); } mapaddr = (vm_address_t) addr; err = __vm_map (__mach_task_self (), &mapaddr, (vm_size_t) len, ELF_MACHINE_USER_ADDRESS_MASK, !(flags & MAP_FIXED), memobj_rd, (vm_offset_t) offset, flags & (MAP_COPY|MAP_PRIVATE), vmprot, VM_PROT_ALL, (flags & MAP_SHARED) ? VM_INHERIT_SHARE : VM_INHERIT_COPY); if (err == KERN_NO_SPACE && (flags & MAP_FIXED)) { /* XXX this is not atomic as it is in unix! */ /* The region is already allocated; deallocate it first. */ err = __vm_deallocate (__mach_task_self (), mapaddr, len); if (! err) err = __vm_map (__mach_task_self (), &mapaddr, (vm_size_t) len, ELF_MACHINE_USER_ADDRESS_MASK, !(flags & MAP_FIXED), memobj_rd, (vm_offset_t) offset, flags & (MAP_COPY|MAP_PRIVATE), vmprot, VM_PROT_ALL, (flags & MAP_SHARED) ? VM_INHERIT_SHARE : VM_INHERIT_COPY); } if ((flags & MAP_ANON) == 0) __mach_port_deallocate (__mach_task_self (), memobj_rd); if (err) return __hurd_fail (err), MAP_FAILED; return (__ptr_t) mapaddr; } int weak_function __fxstat64 (int vers, int fd, struct stat64 *buf) { error_t err; assert (vers == _STAT_VER); err = __io_stat ((mach_port_t) fd, buf); if (err) return __hurd_fail (err); return 0; } libc_hidden_def (__fxstat64) int weak_function __xstat64 (int vers, const char *file, struct stat64 *buf) { error_t err; mach_port_t port; assert (vers == _STAT_VER); err = open_file (file, 0, &port, buf); if (err) return __hurd_fail (err); __mach_port_deallocate (__mach_task_self (), port); return 0; } libc_hidden_def (__xstat64) /* This function is called by the dynamic linker (rtld.c) to check whether debugging malloc is allowed even for SUID binaries. This stub will always fail, which means that malloc-debugging is always disabled for SUID binaries. */ int weak_function __access (const char *file, int type) { errno = ENOSYS; return -1; } pid_t weak_function __getpid (void) { pid_t pid, ppid; int orphaned; if (__proc_getpids (_dl_hurd_data->portarray[INIT_PORT_PROC], &pid, &ppid, &orphaned)) return -1; return pid; } /* This is called only in some strange cases trying to guess a value for $ORIGIN for the executable. The dynamic linker copes with getcwd failing (dl-object.c), and it's too much hassle to include the functionality here. (We could, it just requires duplicating or reusing getcwd.c's code but using our special lookup function as in `open', above.) */ char * weak_function __getcwd (char *buf, size_t size) { errno = ENOSYS; return NULL; } void weak_function attribute_hidden _exit (int status) { __proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC], W_EXITCODE (status, 0), 0); while (__task_terminate (__mach_task_self ())) __mach_task_self_ = (__mach_task_self) (); } /* We need this alias to satisfy references from libc_pic.a objects that were affected by the libc_hidden_proto declaration for _exit. */ strong_alias (_exit, __GI__exit) /* Try to get a machine dependent instruction which will make the program crash. This is used in case everything else fails. */ #include <abort-instr.h> #ifndef ABORT_INSTRUCTION /* No such instruction is available. */ # define ABORT_INSTRUCTION #endif void weak_function abort (void) { /* Try to abort using the system specific command. */ ABORT_INSTRUCTION; /* If the abort instruction failed, exit. */ _exit (127); /* If even this fails, make sure we never return. */ while (1) /* Try for ever and ever. */ ABORT_INSTRUCTION; } /* We need this alias to satisfy references from libc_pic.a objects that were affected by the libc_hidden_proto declaration for abort. */ strong_alias (abort, __GI_abort) /* This function is called by interruptible RPC stubs. For initial dynamic linking, just use the normal mach_msg. Since this defn is weak, the real defn in libc.so will override it if we are linked into the user program (-ldl). */ error_t weak_function _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg, mach_msg_option_t option, mach_msg_size_t send_size, mach_msg_size_t rcv_size, mach_port_t rcv_name, mach_msg_timeout_t timeout, mach_port_t notify) { return __mach_msg (msg, option, send_size, rcv_size, rcv_name, timeout, notify); } void internal_function _dl_show_auxv (void) { /* There is nothing to print. Hurd has no auxiliary vector. */ } void weak_function _dl_init_first (int argc, ...) { /* This no-op definition only gets used if libc is not linked in. */ } #endif /* SHARED */
Java
/*************************************************************************** * (C) Copyright 2003-2015 - Stendhal * *************************************************************************** *************************************************************************** * * * 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. * * * ***************************************************************************/ package games.stendhal.server.actions.chat; import static org.junit.Assert.assertEquals; import games.stendhal.server.entity.player.Player; import marauroa.common.game.RPAction; import org.junit.Test; import utilities.PlayerTestHelper; public class AwayActionTest { /** * Tests for playerIsNull. */ @Test(expected = NullPointerException.class) public void testPlayerIsNull() { final RPAction action = new RPAction(); action.put("type", "away"); final AwayAction aa = new AwayAction(); aa.onAction(null, action); } /** * Tests for onAction. */ @Test public void testOnAction() { final Player bob = PlayerTestHelper.createPlayer("bob"); final RPAction action = new RPAction(); action.put("type", "away"); final AwayAction aa = new AwayAction(); aa.onAction(bob, action); assertEquals(null, bob.getAwayMessage()); action.put("message", "bla"); aa.onAction(bob, action); assertEquals("\"bla\"", bob.getAwayMessage()); } /** * Tests for onInvalidAction. */ @Test public void testOnInvalidAction() { final Player bob = PlayerTestHelper.createPlayer("bob"); bob.clearEvents(); final RPAction action = new RPAction(); action.put("type", "bla"); action.put("message", "bla"); final AwayAction aa = new AwayAction(); aa.onAction(bob, action); assertEquals(null, bob.getAwayMessage()); } }
Java
# Mustang Lite * **Theme URI:** http://www.webmandesign.eu/mustang-lite/ * **Author:** WebMan * **Author URI:** http://www.webmandesign.eu/ * **License:** GNU General Public License v3 * **License URI:** http://www.gnu.org/licenses/gpl-3.0.html ## Description Mustang Lite WordPress Theme lets you create beautiful, professional responsive and HiDPI (Retina) ready websites. With this theme you can create also a single one-page websites with ease! Mustang Lite is suitable for creative portfolio, business and corporate website projects, personal presentations and much more. You can set a custom design with background images and colors for every section of the theme. As the theme is translation ready and supports right-to-left languages as well, you can localize it for your multilingual website. By default you get the basic blog design which can be extended to full power of the theme with WebMan Amplifier plugin activation. This theme is a free, lite version of premium Mustang Multipurpose WordPress Theme by WebMan. The differences from paid version can be found at http://www.webmandesign.eu/mustan-lite/. Check out themes by WebMan at www.webmandesign.eu. Thank you for using one of WebMan's themes! Follow WebMan on Twitter [https://twitter.com/webmandesigneu] or become a fan on Facebook [https://www.facebook.com/webmandesigneu]. Full theme demo website at [http://themedemos.webmandesign.eu/mustang/]. Theme user manual with demo data at [http://www.webmandesign.eu/manual/mustang/]. ## Demo http://themedemos.webmandesign.eu/mustang/ ## Changelog *See the `changelog.md` file.* ## Documentation User manual available at http://www.webmandesign.eu/manual/mustang/ ## Copyright **Mustang Lite WordPress Theme** Copyright 2014 WebMan [http://www.webmandesign.eu/] Distributed under the terms of the GNU GPL **Animate.css** Copyright (c) 2014 Daniel Eden Licensed under the MIT license - http://opensource.org/licenses/MIT http://daneden.me/animate **Normalize.css** Copyright (c) Nicolas Gallagher and Jonathan Neal Licensed under the MIT license - http://opensource.org/licenses/MIT git.io/normalize **imagesLoaded** Copyright (c) 2014 Tomas Sardyha (@Darsain) and David DeSandro (@desandro) Licensed under the MIT license - http://opensource.org/licenses/MIT https://github.com/desandro/imagesloaded **jquery.appear.js** Copyright (c) 2012 Andrey Sidorov Licensed under MIT https://github.com/morr/jquery.appear/ **jquery.prettyPhoto.js** Copyright, Stephane Caron Licensed under Creative Commons 2.5 [http://creativecommons.org/licenses/by/2.5/] or GPLV2 license [http://www.gnu.org/licenses/gpl-2.0.html] Please see assets/js/prettyphoto/README file for more info. http://www.no-margin-for-errors.com **jquery.viewport.js** Copyright (c) 2008-2009 Mika Tuupola Licensed under the MIT license http://www.appelsiini.net/projects/viewport **Fontello font icons** Please see assets/font/basic-icons/LICENCE.txt file for more info.
Java
/* SPDX-License-Identifier: GPL-2.0+ */ /* * Configuation settings for the Renesas Technology R0P7785LC0011RL board * * Copyright (C) 2008 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> */ #ifndef __SH7785LCR_H #define __SH7785LCR_H #define CONFIG_CPU_SH7785 1 #define CONFIG_EXTRA_ENV_SETTINGS \ "bootdevice=0:1\0" \ "usbload=usb reset;usbboot;usb stop;bootm\0" #define CONFIG_DISPLAY_BOARDINFO #undef CONFIG_SHOW_BOOT_PROGRESS /* MEMORY */ #if defined(CONFIG_SH_32BIT) /* 0x40000000 - 0x47FFFFFF does not use */ #define CONFIG_SH_SDRAM_OFFSET (0x8000000) #define SH7785LCR_SDRAM_PHYS_BASE (0x40000000 + CONFIG_SH_SDRAM_OFFSET) #define SH7785LCR_SDRAM_BASE (0x80000000 + CONFIG_SH_SDRAM_OFFSET) #define SH7785LCR_SDRAM_SIZE (384 * 1024 * 1024) #define SH7785LCR_FLASH_BASE_1 (0xa0000000) #define SH7785LCR_FLASH_BANK_SIZE (64 * 1024 * 1024) #define SH7785LCR_USB_BASE (0xa6000000) #else #define SH7785LCR_SDRAM_BASE (0x08000000) #define SH7785LCR_SDRAM_SIZE (128 * 1024 * 1024) #define SH7785LCR_FLASH_BASE_1 (0xa0000000) #define SH7785LCR_FLASH_BANK_SIZE (64 * 1024 * 1024) #define SH7785LCR_USB_BASE (0xb4000000) #endif #define CONFIG_SYS_PBSIZE 256 #define CONFIG_SYS_BAUDRATE_TABLE { 115200 } /* SCIF */ #define CONFIG_CONS_SCIF1 1 #define CONFIG_SCIF_EXT_CLOCK 1 #define CONFIG_SYS_MEMTEST_START (SH7785LCR_SDRAM_BASE) #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + \ (SH7785LCR_SDRAM_SIZE) - \ 4 * 1024 * 1024) #undef CONFIG_SYS_MEMTEST_SCRATCH #undef CONFIG_SYS_LOADS_BAUD_CHANGE #define CONFIG_SYS_SDRAM_BASE (SH7785LCR_SDRAM_BASE) #define CONFIG_SYS_SDRAM_SIZE (SH7785LCR_SDRAM_SIZE) #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 16 * 1024 * 1024) #define CONFIG_SYS_MONITOR_BASE (SH7785LCR_FLASH_BASE_1) #define CONFIG_SYS_MONITOR_LEN (512 * 1024) #define CONFIG_SYS_MALLOC_LEN (512 * 1024) #define CONFIG_SYS_BOOTMAPSZ (8 * 1024 * 1024) /* FLASH */ #define CONFIG_FLASH_CFI_DRIVER #define CONFIG_SYS_FLASH_CFI #undef CONFIG_SYS_FLASH_QUIET_TEST #define CONFIG_SYS_FLASH_EMPTY_INFO #define CONFIG_SYS_FLASH_BASE (SH7785LCR_FLASH_BASE_1) #define CONFIG_SYS_MAX_FLASH_SECT 512 #define CONFIG_SYS_MAX_FLASH_BANKS 1 #define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE + \ (0 * SH7785LCR_FLASH_BANK_SIZE) } #define CONFIG_SYS_FLASH_ERASE_TOUT (3 * 1000) #define CONFIG_SYS_FLASH_WRITE_TOUT (3 * 1000) #define CONFIG_SYS_FLASH_LOCK_TOUT (3 * 1000) #define CONFIG_SYS_FLASH_UNLOCK_TOUT (3 * 1000) #undef CONFIG_SYS_FLASH_PROTECTION #undef CONFIG_SYS_DIRECT_FLASH_TFTP /* R8A66597 */ #define CONFIG_USB_R8A66597_HCD #define CONFIG_R8A66597_BASE_ADDR SH7785LCR_USB_BASE #define CONFIG_R8A66597_XTAL 0x0000 /* 12MHz */ #define CONFIG_R8A66597_LDRV 0x8000 /* 3.3V */ #define CONFIG_R8A66597_ENDIAN 0x0000 /* little */ /* PCI Controller */ #define CONFIG_SH4_PCI #define CONFIG_SH7780_PCI #if defined(CONFIG_SH_32BIT) #define CONFIG_SH7780_PCI_LSR 0x1ff00001 #define CONFIG_SH7780_PCI_LAR 0x5f000000 #define CONFIG_SH7780_PCI_BAR 0x5f000000 #else #define CONFIG_SH7780_PCI_LSR 0x07f00001 #define CONFIG_SH7780_PCI_LAR CONFIG_SYS_SDRAM_SIZE #define CONFIG_SH7780_PCI_BAR CONFIG_SYS_SDRAM_SIZE #endif #define CONFIG_PCI_SCAN_SHOW 1 #define CONFIG_PCI_MEM_BUS 0xFD000000 /* Memory space base addr */ #define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS #define CONFIG_PCI_MEM_SIZE 0x01000000 /* Size of Memory window */ #define CONFIG_PCI_IO_BUS 0xFE200000 /* IO space base address */ #define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS #define CONFIG_PCI_IO_SIZE 0x00200000 /* Size of IO window */ #if defined(CONFIG_SH_32BIT) #define CONFIG_PCI_SYS_PHYS SH7785LCR_SDRAM_PHYS_BASE #else #define CONFIG_PCI_SYS_PHYS CONFIG_SYS_SDRAM_BASE #endif #define CONFIG_PCI_SYS_BUS CONFIG_SYS_SDRAM_BASE #define CONFIG_PCI_SYS_SIZE CONFIG_SYS_SDRAM_SIZE /* ENV setting */ #define CONFIG_ENV_OVERWRITE 1 #define CONFIG_ENV_SECT_SIZE (256 * 1024) #define CONFIG_ENV_SIZE (CONFIG_ENV_SECT_SIZE) #define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN) #define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE) #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SECT_SIZE) /* Board Clock */ /* The SCIF used external clock. system clock only used timer. */ #define CONFIG_SYS_CLK_FREQ 50000000 #define CONFIG_SH_TMU_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SH_SCIF_CLK_FREQ CONFIG_SYS_CLK_FREQ #define CONFIG_SYS_TMU_CLK_DIV 4 #endif /* __SH7785LCR_H */
Java
//============================================================================= // MuseScore // Music Composition & Notation // $Id: keyfinder.h 4515 2011-07-13 09:56:53Z wschweer $ // // Copyright (C) 2002-2011 Werner Schweer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 // as published by the Free Software Foundation and appearing in // the file LICENCE.GPL //============================================================================= #ifndef __KEYFINDER_H__ #define __KEYFINDER_H__ class MidiTrack; namespace AL { class TimeSigMap; }; // extern int findKey(MidiTrack*, AL::TimeSigMap*); #endif
Java
select#newfesti_docs_versions_parent, label[for='parent'], select#parent.postform { display: none; } body table.wp-list-table.tags { table-layout: auto; } .festi-user-role-prices .festi-user-role-prices-section { margin: 0; } .festi-user-role-prices-message#message { margin-left:0; } .festi-user-role-prices .festi-user-role-prices-form-table { width: 100%; } .festi-user-role-prices-form-table tr.festi-user-role-prices-top-border td, .festi-user-role-prices-form-table tr.festi-user-role-prices-top-border th { border-top: 1px solid #eee; } .festi-user-role-prices .festi-user-role-prices-form-table td, .festi-user-role-prices .festi-user-role-prices-form-table th { padding: 5px; padding-bottom: 20px; padding-top: 20px; line-height: 20px; vertical-align: top; text-align: left; font-size: 15px; } .festi-user-role-prices .festi-user-role-prices-help-tip { cursor: help; vertical-align: middle; } .festi-user-role-prices .festi-user-role-prices-form-table th { width: 280px; } .festi-user-role-prices .festi-user-role-prices-lable { } input[type="text"], .festi-user-role-prices input[type="number"], .festi-user-role-prices select { height: 30px; } .festi-user-role-prices input[type="text"], .festi-user-role-prices input[type="number"], .festi-user-role-prices input[type="checkbox"], .festi-user-role-prices select { background-color: #ffffff; border: 1px solid #cccccc; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; -moz-transition: border linear 0.2s, box-shadow linear 0.2s; -o-transition: border linear 0.2s, box-shadow linear 0.2s; transition: border linear 0.2s, box-shadow linear 0.2s; } input[type="text"]:focus, .festi-user-role-prices input[type="number"]:focus, .festi-user-role-prices input[type="checkbox"]:focus, .festi-user-role-prices select:focus { border-color: rgba(82, 168, 236, 0.8); outline: 0; outline: thin dotted \9; /* IE6-9 */ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); } .festi-user-role-prices .festi-user-role-prices-add-on { display: inline-block; width: 26px; height: 24px !important; min-width: 16px; font-size: 14px; font-weight: normal; line-height: 22px; position:relative; right: 8px; padding:2px; top: 1px; text-align: center; text-shadow: 0 1px 0 #ffffff; background-color: #eeeeee; border: 1px solid #ccc; -webkit-border-top-right-radius: 5px; -moz-border-top-right-radius: 5px; border-top-right-radius: 5px; -webkit-border-bottom-right-radius: 5px; -moz-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; vertical-align: top; } .festi-user-role-prices tr.festi-user-role-prices-divider th { text-align:left; background-color: #789bb3; padding: 10px; text-transform: uppercase; color: #ffffff; } a.festi-user-role-prices-delete-role { text-decoration: none; font-size: 26px; font-weight: bold; margin-left: 5px; vertical-align: middle; color: #ff5c5c; } a.festi-user-role-prices-delete-role:hover { color: #ff0000; } .festi-user-role-prices .festi-user-role-prices-hidden { display:none; } fieldset.festi-user-role-prices-grouped-roles table th { font-weight: normal; } .festi-user-role-prices-save-button-block { } .festi-user-role-prices .festi-user-role-prices-save-button { float: right; } fieldset.festi-user-role-prices-options { display: inline-block; border: 1px solid #eeeeee; padding: 20px; margin-bottom: 30px; margin-top:20px; min-width: 820px; padding-top: 25px; padding-bottom: 10px; background-color: #ffffff; } .festi-user-role-prices h2 { font-size: 22px; font-weight: 400; padding: 9px 15px 4px 0; } fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles tr, fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles th, fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles td { border: 0; padding: 5px; margin: 0; vertical-align: middle; } fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles th { width:40%; } fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles td label { margin-left: 20px; margin-right: 5px; } fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles span { font-size: 15px; font-weight: normal; } fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles td input { width: 75px; text-align: left; vertical-align: middle; } .festi-user-role-prices { } .festi-content { display: inline-block; } fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles td input, fieldset.festi-user-role-prices-options #festi-user-role-prices-discount-roles td select { height: 28px; } div#festi-import-report .festi-import-report-title { text-transform: uppercase; } .festi-user-role-prices { } div#festi-import-report p.festi-import-report-text { font-weight: normal; } div#festi-import-report p.festi-import-report-text { margin-left: 20px; } .festi-color-selector { position: relative; top: 0; left: -3px; width: 36px; height: 36px; } .festi-color-selector div { position: relative; top: 4px; left: 4px; width: 28px; height: 28px; background: url(../../images/color_picker/select2.png) center; } div.colorpicker input { height: 15px !important; border: 0 !important; } body div.colorpicker { z-index: 10; } /*Import Page*/ .festi-user-role-prices-import-url { width: 400px; }
Java
#ifndef RBKIT_APPSTATE_H #define RBKIT_APPSTATE_H #include <QObject> #include <QMutex> #include <QHash> #include <QVariant> namespace RBKit { class AppState { QMutex mutex; QHash<QString, QVariant> appState; QHash<int, QString> snapshotNames; AppState(); static AppState *singleton; QString protocolVersion; public: const QVariant getState(const QString& ket); void setAppState(const QString key, const QVariant value); void setSnapshotName(int key, QString snapShotName); QString getSnapshotName(int key) const; void removeSnapshotName(int key); static AppState* getInstance(); QString getProtocolVersion() const; void setProtocolVersion(const QString &value); }; } // namespace RBKit #endif // RBKIT_APPSTATE_H
Java
// Copyright 2013 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #include <sstream> #include <unordered_map> #include "Common/GL/GLInterfaceBase.h" #include "Common/GL/GLExtensions/GLExtensions.h" #include "Common/Logging/Log.h" #if defined(__linux__) || defined(__APPLE__) #include <dlfcn.h> #endif // gl_1_1 PFNDOLCLEARINDEXPROC dolClearIndex; PFNDOLCLEARCOLORPROC dolClearColor; PFNDOLCLEARPROC dolClear; PFNDOLINDEXMASKPROC dolIndexMask; PFNDOLCOLORMASKPROC dolColorMask; PFNDOLALPHAFUNCPROC dolAlphaFunc; PFNDOLBLENDFUNCPROC dolBlendFunc; PFNDOLLOGICOPPROC dolLogicOp; PFNDOLCULLFACEPROC dolCullFace; PFNDOLFRONTFACEPROC dolFrontFace; PFNDOLPOINTSIZEPROC dolPointSize; PFNDOLLINEWIDTHPROC dolLineWidth; PFNDOLLINESTIPPLEPROC dolLineStipple; PFNDOLPOLYGONMODEPROC dolPolygonMode; PFNDOLPOLYGONOFFSETPROC dolPolygonOffset; PFNDOLPOLYGONSTIPPLEPROC dolPolygonStipple; PFNDOLGETPOLYGONSTIPPLEPROC dolGetPolygonStipple; PFNDOLEDGEFLAGPROC dolEdgeFlag; PFNDOLEDGEFLAGVPROC dolEdgeFlagv; PFNDOLSCISSORPROC dolScissor; PFNDOLCLIPPLANEPROC dolClipPlane; PFNDOLGETCLIPPLANEPROC dolGetClipPlane; PFNDOLDRAWBUFFERPROC dolDrawBuffer; PFNDOLREADBUFFERPROC dolReadBuffer; PFNDOLENABLEPROC dolEnable; PFNDOLDISABLEPROC dolDisable; PFNDOLISENABLEDPROC dolIsEnabled; PFNDOLENABLECLIENTSTATEPROC dolEnableClientState; PFNDOLDISABLECLIENTSTATEPROC dolDisableClientState; PFNDOLGETBOOLEANVPROC dolGetBooleanv; PFNDOLGETDOUBLEVPROC dolGetDoublev; PFNDOLGETFLOATVPROC dolGetFloatv; PFNDOLGETINTEGERVPROC dolGetIntegerv; PFNDOLPUSHATTRIBPROC dolPushAttrib; PFNDOLPOPATTRIBPROC dolPopAttrib; PFNDOLPUSHCLIENTATTRIBPROC dolPushClientAttrib; PFNDOLPOPCLIENTATTRIBPROC dolPopClientAttrib; PFNDOLRENDERMODEPROC dolRenderMode; PFNDOLGETERRORPROC dolGetError; PFNDOLGETSTRINGPROC dolGetString; PFNDOLFINISHPROC dolFinish; PFNDOLFLUSHPROC dolFlush; PFNDOLHINTPROC dolHint; PFNDOLCLEARDEPTHPROC dolClearDepth; PFNDOLDEPTHFUNCPROC dolDepthFunc; PFNDOLDEPTHMASKPROC dolDepthMask; PFNDOLDEPTHRANGEPROC dolDepthRange; PFNDOLCLEARACCUMPROC dolClearAccum; PFNDOLACCUMPROC dolAccum; PFNDOLMATRIXMODEPROC dolMatrixMode; PFNDOLORTHOPROC dolOrtho; PFNDOLFRUSTUMPROC dolFrustum; PFNDOLVIEWPORTPROC dolViewport; PFNDOLPUSHMATRIXPROC dolPushMatrix; PFNDOLPOPMATRIXPROC dolPopMatrix; PFNDOLLOADIDENTITYPROC dolLoadIdentity; PFNDOLLOADMATRIXDPROC dolLoadMatrixd; PFNDOLLOADMATRIXFPROC dolLoadMatrixf; PFNDOLMULTMATRIXDPROC dolMultMatrixd; PFNDOLMULTMATRIXFPROC dolMultMatrixf; PFNDOLROTATEDPROC dolRotated; PFNDOLROTATEFPROC dolRotatef; PFNDOLSCALEDPROC dolScaled; PFNDOLSCALEFPROC dolScalef; PFNDOLTRANSLATEDPROC dolTranslated; PFNDOLTRANSLATEFPROC dolTranslatef; PFNDOLISLISTPROC dolIsList; PFNDOLDELETELISTSPROC dolDeleteLists; PFNDOLGENLISTSPROC dolGenLists; PFNDOLNEWLISTPROC dolNewList; PFNDOLENDLISTPROC dolEndList; PFNDOLCALLLISTPROC dolCallList; PFNDOLCALLLISTSPROC dolCallLists; PFNDOLLISTBASEPROC dolListBase; PFNDOLBEGINPROC dolBegin; PFNDOLENDPROC dolEnd; PFNDOLVERTEX2DPROC dolVertex2d; PFNDOLVERTEX2FPROC dolVertex2f; PFNDOLVERTEX2IPROC dolVertex2i; PFNDOLVERTEX2SPROC dolVertex2s; PFNDOLVERTEX3DPROC dolVertex3d; PFNDOLVERTEX3FPROC dolVertex3f; PFNDOLVERTEX3IPROC dolVertex3i; PFNDOLVERTEX3SPROC dolVertex3s; PFNDOLVERTEX4DPROC dolVertex4d; PFNDOLVERTEX4FPROC dolVertex4f; PFNDOLVERTEX4IPROC dolVertex4i; PFNDOLVERTEX4SPROC dolVertex4s; PFNDOLVERTEX2DVPROC dolVertex2dv; PFNDOLVERTEX2FVPROC dolVertex2fv; PFNDOLVERTEX2IVPROC dolVertex2iv; PFNDOLVERTEX2SVPROC dolVertex2sv; PFNDOLVERTEX3DVPROC dolVertex3dv; PFNDOLVERTEX3FVPROC dolVertex3fv; PFNDOLVERTEX3IVPROC dolVertex3iv; PFNDOLVERTEX3SVPROC dolVertex3sv; PFNDOLVERTEX4DVPROC dolVertex4dv; PFNDOLVERTEX4FVPROC dolVertex4fv; PFNDOLVERTEX4IVPROC dolVertex4iv; PFNDOLVERTEX4SVPROC dolVertex4sv; PFNDOLNORMAL3BPROC dolNormal3b; PFNDOLNORMAL3DPROC dolNormal3d; PFNDOLNORMAL3FPROC dolNormal3f; PFNDOLNORMAL3IPROC dolNormal3i; PFNDOLNORMAL3SPROC dolNormal3s; PFNDOLNORMAL3BVPROC dolNormal3bv; PFNDOLNORMAL3DVPROC dolNormal3dv; PFNDOLNORMAL3FVPROC dolNormal3fv; PFNDOLNORMAL3IVPROC dolNormal3iv; PFNDOLNORMAL3SVPROC dolNormal3sv; PFNDOLINDEXDPROC dolIndexd; PFNDOLINDEXFPROC dolIndexf; PFNDOLINDEXIPROC dolIndexi; PFNDOLINDEXSPROC dolIndexs; PFNDOLINDEXUBPROC dolIndexub; PFNDOLINDEXDVPROC dolIndexdv; PFNDOLINDEXFVPROC dolIndexfv; PFNDOLINDEXIVPROC dolIndexiv; PFNDOLINDEXSVPROC dolIndexsv; PFNDOLINDEXUBVPROC dolIndexubv; PFNDOLCOLOR3BPROC dolColor3b; PFNDOLCOLOR3DPROC dolColor3d; PFNDOLCOLOR3FPROC dolColor3f; PFNDOLCOLOR3IPROC dolColor3i; PFNDOLCOLOR3SPROC dolColor3s; PFNDOLCOLOR3UBPROC dolColor3ub; PFNDOLCOLOR3UIPROC dolColor3ui; PFNDOLCOLOR3USPROC dolColor3us; PFNDOLCOLOR4BPROC dolColor4b; PFNDOLCOLOR4DPROC dolColor4d; PFNDOLCOLOR4FPROC dolColor4f; PFNDOLCOLOR4IPROC dolColor4i; PFNDOLCOLOR4SPROC dolColor4s; PFNDOLCOLOR4UBPROC dolColor4ub; PFNDOLCOLOR4UIPROC dolColor4ui; PFNDOLCOLOR4USPROC dolColor4us; PFNDOLCOLOR3BVPROC dolColor3bv; PFNDOLCOLOR3DVPROC dolColor3dv; PFNDOLCOLOR3FVPROC dolColor3fv; PFNDOLCOLOR3IVPROC dolColor3iv; PFNDOLCOLOR3SVPROC dolColor3sv; PFNDOLCOLOR3UBVPROC dolColor3ubv; PFNDOLCOLOR3UIVPROC dolColor3uiv; PFNDOLCOLOR3USVPROC dolColor3usv; PFNDOLCOLOR4BVPROC dolColor4bv; PFNDOLCOLOR4DVPROC dolColor4dv; PFNDOLCOLOR4FVPROC dolColor4fv; PFNDOLCOLOR4IVPROC dolColor4iv; PFNDOLCOLOR4SVPROC dolColor4sv; PFNDOLCOLOR4UBVPROC dolColor4ubv; PFNDOLCOLOR4UIVPROC dolColor4uiv; PFNDOLCOLOR4USVPROC dolColor4usv; PFNDOLTEXCOORD1DPROC dolTexCoord1d; PFNDOLTEXCOORD1FPROC dolTexCoord1f; PFNDOLTEXCOORD1IPROC dolTexCoord1i; PFNDOLTEXCOORD1SPROC dolTexCoord1s; PFNDOLTEXCOORD2DPROC dolTexCoord2d; PFNDOLTEXCOORD2FPROC dolTexCoord2f; PFNDOLTEXCOORD2IPROC dolTexCoord2i; PFNDOLTEXCOORD2SPROC dolTexCoord2s; PFNDOLTEXCOORD3DPROC dolTexCoord3d; PFNDOLTEXCOORD3FPROC dolTexCoord3f; PFNDOLTEXCOORD3IPROC dolTexCoord3i; PFNDOLTEXCOORD3SPROC dolTexCoord3s; PFNDOLTEXCOORD4DPROC dolTexCoord4d; PFNDOLTEXCOORD4FPROC dolTexCoord4f; PFNDOLTEXCOORD4IPROC dolTexCoord4i; PFNDOLTEXCOORD4SPROC dolTexCoord4s; PFNDOLTEXCOORD1DVPROC dolTexCoord1dv; PFNDOLTEXCOORD1FVPROC dolTexCoord1fv; PFNDOLTEXCOORD1IVPROC dolTexCoord1iv; PFNDOLTEXCOORD1SVPROC dolTexCoord1sv; PFNDOLTEXCOORD2DVPROC dolTexCoord2dv; PFNDOLTEXCOORD2FVPROC dolTexCoord2fv; PFNDOLTEXCOORD2IVPROC dolTexCoord2iv; PFNDOLTEXCOORD2SVPROC dolTexCoord2sv; PFNDOLTEXCOORD3DVPROC dolTexCoord3dv; PFNDOLTEXCOORD3FVPROC dolTexCoord3fv; PFNDOLTEXCOORD3IVPROC dolTexCoord3iv; PFNDOLTEXCOORD3SVPROC dolTexCoord3sv; PFNDOLTEXCOORD4DVPROC dolTexCoord4dv; PFNDOLTEXCOORD4FVPROC dolTexCoord4fv; PFNDOLTEXCOORD4IVPROC dolTexCoord4iv; PFNDOLTEXCOORD4SVPROC dolTexCoord4sv; PFNDOLRASTERPOS2DPROC dolRasterPos2d; PFNDOLRASTERPOS2FPROC dolRasterPos2f; PFNDOLRASTERPOS2IPROC dolRasterPos2i; PFNDOLRASTERPOS2SPROC dolRasterPos2s; PFNDOLRASTERPOS3DPROC dolRasterPos3d; PFNDOLRASTERPOS3FPROC dolRasterPos3f; PFNDOLRASTERPOS3IPROC dolRasterPos3i; PFNDOLRASTERPOS3SPROC dolRasterPos3s; PFNDOLRASTERPOS4DPROC dolRasterPos4d; PFNDOLRASTERPOS4FPROC dolRasterPos4f; PFNDOLRASTERPOS4IPROC dolRasterPos4i; PFNDOLRASTERPOS4SPROC dolRasterPos4s; PFNDOLRASTERPOS2DVPROC dolRasterPos2dv; PFNDOLRASTERPOS2FVPROC dolRasterPos2fv; PFNDOLRASTERPOS2IVPROC dolRasterPos2iv; PFNDOLRASTERPOS2SVPROC dolRasterPos2sv; PFNDOLRASTERPOS3DVPROC dolRasterPos3dv; PFNDOLRASTERPOS3FVPROC dolRasterPos3fv; PFNDOLRASTERPOS3IVPROC dolRasterPos3iv; PFNDOLRASTERPOS3SVPROC dolRasterPos3sv; PFNDOLRASTERPOS4DVPROC dolRasterPos4dv; PFNDOLRASTERPOS4FVPROC dolRasterPos4fv; PFNDOLRASTERPOS4IVPROC dolRasterPos4iv; PFNDOLRASTERPOS4SVPROC dolRasterPos4sv; PFNDOLRECTDPROC dolRectd; PFNDOLRECTFPROC dolRectf; PFNDOLRECTIPROC dolRecti; PFNDOLRECTSPROC dolRects; PFNDOLRECTDVPROC dolRectdv; PFNDOLRECTFVPROC dolRectfv; PFNDOLRECTIVPROC dolRectiv; PFNDOLRECTSVPROC dolRectsv; PFNDOLVERTEXPOINTERPROC dolVertexPointer; PFNDOLNORMALPOINTERPROC dolNormalPointer; PFNDOLCOLORPOINTERPROC dolColorPointer; PFNDOLINDEXPOINTERPROC dolIndexPointer; PFNDOLTEXCOORDPOINTERPROC dolTexCoordPointer; PFNDOLEDGEFLAGPOINTERPROC dolEdgeFlagPointer; PFNDOLGETPOINTERVPROC dolGetPointerv; PFNDOLARRAYELEMENTPROC dolArrayElement; PFNDOLDRAWARRAYSPROC dolDrawArrays; PFNDOLDRAWELEMENTSPROC dolDrawElements; PFNDOLINTERLEAVEDARRAYSPROC dolInterleavedArrays; PFNDOLSHADEMODELPROC dolShadeModel; PFNDOLLIGHTFPROC dolLightf; PFNDOLLIGHTIPROC dolLighti; PFNDOLLIGHTFVPROC dolLightfv; PFNDOLLIGHTIVPROC dolLightiv; PFNDOLGETLIGHTFVPROC dolGetLightfv; PFNDOLGETLIGHTIVPROC dolGetLightiv; PFNDOLLIGHTMODELFPROC dolLightModelf; PFNDOLLIGHTMODELIPROC dolLightModeli; PFNDOLLIGHTMODELFVPROC dolLightModelfv; PFNDOLLIGHTMODELIVPROC dolLightModeliv; PFNDOLMATERIALFPROC dolMaterialf; PFNDOLMATERIALIPROC dolMateriali; PFNDOLMATERIALFVPROC dolMaterialfv; PFNDOLMATERIALIVPROC dolMaterialiv; PFNDOLGETMATERIALFVPROC dolGetMaterialfv; PFNDOLGETMATERIALIVPROC dolGetMaterialiv; PFNDOLCOLORMATERIALPROC dolColorMaterial; PFNDOLPIXELZOOMPROC dolPixelZoom; PFNDOLPIXELSTOREFPROC dolPixelStoref; PFNDOLPIXELSTOREIPROC dolPixelStorei; PFNDOLPIXELTRANSFERFPROC dolPixelTransferf; PFNDOLPIXELTRANSFERIPROC dolPixelTransferi; PFNDOLPIXELMAPFVPROC dolPixelMapfv; PFNDOLPIXELMAPUIVPROC dolPixelMapuiv; PFNDOLPIXELMAPUSVPROC dolPixelMapusv; PFNDOLGETPIXELMAPFVPROC dolGetPixelMapfv; PFNDOLGETPIXELMAPUIVPROC dolGetPixelMapuiv; PFNDOLGETPIXELMAPUSVPROC dolGetPixelMapusv; PFNDOLBITMAPPROC dolBitmap; PFNDOLREADPIXELSPROC dolReadPixels; PFNDOLDRAWPIXELSPROC dolDrawPixels; PFNDOLCOPYPIXELSPROC dolCopyPixels; PFNDOLSTENCILFUNCPROC dolStencilFunc; PFNDOLSTENCILMASKPROC dolStencilMask; PFNDOLSTENCILOPPROC dolStencilOp; PFNDOLCLEARSTENCILPROC dolClearStencil; PFNDOLTEXGENDPROC dolTexGend; PFNDOLTEXGENFPROC dolTexGenf; PFNDOLTEXGENIPROC dolTexGeni; PFNDOLTEXGENDVPROC dolTexGendv; PFNDOLTEXGENFVPROC dolTexGenfv; PFNDOLTEXGENIVPROC dolTexGeniv; PFNDOLGETTEXGENDVPROC dolGetTexGendv; PFNDOLGETTEXGENFVPROC dolGetTexGenfv; PFNDOLGETTEXGENIVPROC dolGetTexGeniv; PFNDOLTEXENVFPROC dolTexEnvf; PFNDOLTEXENVIPROC dolTexEnvi; PFNDOLTEXENVFVPROC dolTexEnvfv; PFNDOLTEXENVIVPROC dolTexEnviv; PFNDOLGETTEXENVFVPROC dolGetTexEnvfv; PFNDOLGETTEXENVIVPROC dolGetTexEnviv; PFNDOLTEXPARAMETERFPROC dolTexParameterf; PFNDOLTEXPARAMETERIPROC dolTexParameteri; PFNDOLTEXPARAMETERFVPROC dolTexParameterfv; PFNDOLTEXPARAMETERIVPROC dolTexParameteriv; PFNDOLGETTEXPARAMETERFVPROC dolGetTexParameterfv; PFNDOLGETTEXPARAMETERIVPROC dolGetTexParameteriv; PFNDOLGETTEXLEVELPARAMETERFVPROC dolGetTexLevelParameterfv; PFNDOLGETTEXLEVELPARAMETERIVPROC dolGetTexLevelParameteriv; PFNDOLTEXIMAGE1DPROC dolTexImage1D; PFNDOLTEXIMAGE2DPROC dolTexImage2D; PFNDOLGETTEXIMAGEPROC dolGetTexImage; PFNDOLGENTEXTURESPROC dolGenTextures; PFNDOLDELETETEXTURESPROC dolDeleteTextures; PFNDOLBINDTEXTUREPROC dolBindTexture; PFNDOLPRIORITIZETEXTURESPROC dolPrioritizeTextures; PFNDOLARETEXTURESRESIDENTPROC dolAreTexturesResident; PFNDOLISTEXTUREPROC dolIsTexture; PFNDOLTEXSUBIMAGE1DPROC dolTexSubImage1D; PFNDOLTEXSUBIMAGE2DPROC dolTexSubImage2D; PFNDOLCOPYTEXIMAGE1DPROC dolCopyTexImage1D; PFNDOLCOPYTEXIMAGE2DPROC dolCopyTexImage2D; PFNDOLCOPYTEXSUBIMAGE1DPROC dolCopyTexSubImage1D; PFNDOLCOPYTEXSUBIMAGE2DPROC dolCopyTexSubImage2D; PFNDOLMAP1DPROC dolMap1d; PFNDOLMAP1FPROC dolMap1f; PFNDOLMAP2DPROC dolMap2d; PFNDOLMAP2FPROC dolMap2f; PFNDOLGETMAPDVPROC dolGetMapdv; PFNDOLGETMAPFVPROC dolGetMapfv; PFNDOLGETMAPIVPROC dolGetMapiv; PFNDOLEVALCOORD1DPROC dolEvalCoord1d; PFNDOLEVALCOORD1FPROC dolEvalCoord1f; PFNDOLEVALCOORD1DVPROC dolEvalCoord1dv; PFNDOLEVALCOORD1FVPROC dolEvalCoord1fv; PFNDOLEVALCOORD2DPROC dolEvalCoord2d; PFNDOLEVALCOORD2FPROC dolEvalCoord2f; PFNDOLEVALCOORD2DVPROC dolEvalCoord2dv; PFNDOLEVALCOORD2FVPROC dolEvalCoord2fv; PFNDOLMAPGRID1DPROC dolMapGrid1d; PFNDOLMAPGRID1FPROC dolMapGrid1f; PFNDOLMAPGRID2DPROC dolMapGrid2d; PFNDOLMAPGRID2FPROC dolMapGrid2f; PFNDOLEVALPOINT1PROC dolEvalPoint1; PFNDOLEVALPOINT2PROC dolEvalPoint2; PFNDOLEVALMESH1PROC dolEvalMesh1; PFNDOLEVALMESH2PROC dolEvalMesh2; PFNDOLFOGFPROC dolFogf; PFNDOLFOGIPROC dolFogi; PFNDOLFOGFVPROC dolFogfv; PFNDOLFOGIVPROC dolFogiv; PFNDOLFEEDBACKBUFFERPROC dolFeedbackBuffer; PFNDOLPASSTHROUGHPROC dolPassThrough; PFNDOLSELECTBUFFERPROC dolSelectBuffer; PFNDOLINITNAMESPROC dolInitNames; PFNDOLLOADNAMEPROC dolLoadName; PFNDOLPUSHNAMEPROC dolPushName; PFNDOLPOPNAMEPROC dolPopName; // gl_1_2 PFNDOLCOPYTEXSUBIMAGE3DPROC dolCopyTexSubImage3D; PFNDOLDRAWRANGEELEMENTSPROC dolDrawRangeElements; PFNDOLTEXIMAGE3DPROC dolTexImage3D; PFNDOLTEXSUBIMAGE3DPROC dolTexSubImage3D; // gl_1_3 PFNDOLACTIVETEXTUREARBPROC dolActiveTexture; PFNDOLCLIENTACTIVETEXTUREARBPROC dolClientActiveTexture; PFNDOLCOMPRESSEDTEXIMAGE1DPROC dolCompressedTexImage1D; PFNDOLCOMPRESSEDTEXIMAGE2DPROC dolCompressedTexImage2D; PFNDOLCOMPRESSEDTEXIMAGE3DPROC dolCompressedTexImage3D; PFNDOLCOMPRESSEDTEXSUBIMAGE1DPROC dolCompressedTexSubImage1D; PFNDOLCOMPRESSEDTEXSUBIMAGE2DPROC dolCompressedTexSubImage2D; PFNDOLCOMPRESSEDTEXSUBIMAGE3DPROC dolCompressedTexSubImage3D; PFNDOLGETCOMPRESSEDTEXIMAGEPROC dolGetCompressedTexImage; PFNDOLLOADTRANSPOSEMATRIXDARBPROC dolLoadTransposeMatrixd; PFNDOLLOADTRANSPOSEMATRIXFARBPROC dolLoadTransposeMatrixf; PFNDOLMULTTRANSPOSEMATRIXDARBPROC dolMultTransposeMatrixd; PFNDOLMULTTRANSPOSEMATRIXFARBPROC dolMultTransposeMatrixf; PFNDOLMULTITEXCOORD1DARBPROC dolMultiTexCoord1d; PFNDOLMULTITEXCOORD1DVARBPROC dolMultiTexCoord1dv; PFNDOLMULTITEXCOORD1FARBPROC dolMultiTexCoord1f; PFNDOLMULTITEXCOORD1FVARBPROC dolMultiTexCoord1fv; PFNDOLMULTITEXCOORD1IARBPROC dolMultiTexCoord1i; PFNDOLMULTITEXCOORD1IVARBPROC dolMultiTexCoord1iv; PFNDOLMULTITEXCOORD1SARBPROC dolMultiTexCoord1s; PFNDOLMULTITEXCOORD1SVARBPROC dolMultiTexCoord1sv; PFNDOLMULTITEXCOORD2DARBPROC dolMultiTexCoord2d; PFNDOLMULTITEXCOORD2DVARBPROC dolMultiTexCoord2dv; PFNDOLMULTITEXCOORD2FARBPROC dolMultiTexCoord2f; PFNDOLMULTITEXCOORD2FVARBPROC dolMultiTexCoord2fv; PFNDOLMULTITEXCOORD2IARBPROC dolMultiTexCoord2i; PFNDOLMULTITEXCOORD2IVARBPROC dolMultiTexCoord2iv; PFNDOLMULTITEXCOORD2SARBPROC dolMultiTexCoord2s; PFNDOLMULTITEXCOORD2SVARBPROC dolMultiTexCoord2sv; PFNDOLMULTITEXCOORD3DARBPROC dolMultiTexCoord3d; PFNDOLMULTITEXCOORD3DVARBPROC dolMultiTexCoord3dv; PFNDOLMULTITEXCOORD3FARBPROC dolMultiTexCoord3f; PFNDOLMULTITEXCOORD3FVARBPROC dolMultiTexCoord3fv; PFNDOLMULTITEXCOORD3IARBPROC dolMultiTexCoord3i; PFNDOLMULTITEXCOORD3IVARBPROC dolMultiTexCoord3iv; PFNDOLMULTITEXCOORD3SARBPROC dolMultiTexCoord3s; PFNDOLMULTITEXCOORD3SVARBPROC dolMultiTexCoord3sv; PFNDOLMULTITEXCOORD4DARBPROC dolMultiTexCoord4d; PFNDOLMULTITEXCOORD4DVARBPROC dolMultiTexCoord4dv; PFNDOLMULTITEXCOORD4FARBPROC dolMultiTexCoord4f; PFNDOLMULTITEXCOORD4FVARBPROC dolMultiTexCoord4fv; PFNDOLMULTITEXCOORD4IARBPROC dolMultiTexCoord4i; PFNDOLMULTITEXCOORD4IVARBPROC dolMultiTexCoord4iv; PFNDOLMULTITEXCOORD4SARBPROC dolMultiTexCoord4s; PFNDOLMULTITEXCOORD4SVARBPROC dolMultiTexCoord4sv; PFNDOLSAMPLECOVERAGEARBPROC dolSampleCoverage; // gl_1_4 PFNDOLBLENDCOLORPROC dolBlendColor; PFNDOLBLENDEQUATIONPROC dolBlendEquation; PFNDOLBLENDFUNCSEPARATEPROC dolBlendFuncSeparate; PFNDOLFOGCOORDPOINTERPROC dolFogCoordPointer; PFNDOLFOGCOORDDPROC dolFogCoordd; PFNDOLFOGCOORDDVPROC dolFogCoorddv; PFNDOLFOGCOORDFPROC dolFogCoordf; PFNDOLFOGCOORDFVPROC dolFogCoordfv; PFNDOLMULTIDRAWARRAYSPROC dolMultiDrawArrays; PFNDOLMULTIDRAWELEMENTSPROC dolMultiDrawElements; PFNDOLPOINTPARAMETERFPROC dolPointParameterf; PFNDOLPOINTPARAMETERFVPROC dolPointParameterfv; PFNDOLPOINTPARAMETERIPROC dolPointParameteri; PFNDOLPOINTPARAMETERIVPROC dolPointParameteriv; PFNDOLSECONDARYCOLOR3BPROC dolSecondaryColor3b; PFNDOLSECONDARYCOLOR3BVPROC dolSecondaryColor3bv; PFNDOLSECONDARYCOLOR3DPROC dolSecondaryColor3d; PFNDOLSECONDARYCOLOR3DVPROC dolSecondaryColor3dv; PFNDOLSECONDARYCOLOR3FPROC dolSecondaryColor3f; PFNDOLSECONDARYCOLOR3FVPROC dolSecondaryColor3fv; PFNDOLSECONDARYCOLOR3IPROC dolSecondaryColor3i; PFNDOLSECONDARYCOLOR3IVPROC dolSecondaryColor3iv; PFNDOLSECONDARYCOLOR3SPROC dolSecondaryColor3s; PFNDOLSECONDARYCOLOR3SVPROC dolSecondaryColor3sv; PFNDOLSECONDARYCOLOR3UBPROC dolSecondaryColor3ub; PFNDOLSECONDARYCOLOR3UBVPROC dolSecondaryColor3ubv; PFNDOLSECONDARYCOLOR3UIPROC dolSecondaryColor3ui; PFNDOLSECONDARYCOLOR3UIVPROC dolSecondaryColor3uiv; PFNDOLSECONDARYCOLOR3USPROC dolSecondaryColor3us; PFNDOLSECONDARYCOLOR3USVPROC dolSecondaryColor3usv; PFNDOLSECONDARYCOLORPOINTERPROC dolSecondaryColorPointer; PFNDOLWINDOWPOS2DPROC dolWindowPos2d; PFNDOLWINDOWPOS2DVPROC dolWindowPos2dv; PFNDOLWINDOWPOS2FPROC dolWindowPos2f; PFNDOLWINDOWPOS2FVPROC dolWindowPos2fv; PFNDOLWINDOWPOS2IPROC dolWindowPos2i; PFNDOLWINDOWPOS2IVPROC dolWindowPos2iv; PFNDOLWINDOWPOS2SPROC dolWindowPos2s; PFNDOLWINDOWPOS2SVPROC dolWindowPos2sv; PFNDOLWINDOWPOS3DPROC dolWindowPos3d; PFNDOLWINDOWPOS3DVPROC dolWindowPos3dv; PFNDOLWINDOWPOS3FPROC dolWindowPos3f; PFNDOLWINDOWPOS3FVPROC dolWindowPos3fv; PFNDOLWINDOWPOS3IPROC dolWindowPos3i; PFNDOLWINDOWPOS3IVPROC dolWindowPos3iv; PFNDOLWINDOWPOS3SPROC dolWindowPos3s; PFNDOLWINDOWPOS3SVPROC dolWindowPos3sv; // gl_1_5 PFNDOLBEGINQUERYPROC dolBeginQuery; PFNDOLBINDBUFFERPROC dolBindBuffer; PFNDOLBUFFERDATAPROC dolBufferData; PFNDOLBUFFERSUBDATAPROC dolBufferSubData; PFNDOLDELETEBUFFERSPROC dolDeleteBuffers; PFNDOLDELETEQUERIESPROC dolDeleteQueries; PFNDOLENDQUERYPROC dolEndQuery; PFNDOLGENBUFFERSPROC dolGenBuffers; PFNDOLGENQUERIESPROC dolGenQueries; PFNDOLGETBUFFERPARAMETERIVPROC dolGetBufferParameteriv; PFNDOLGETBUFFERPOINTERVPROC dolGetBufferPointerv; PFNDOLGETBUFFERSUBDATAPROC dolGetBufferSubData; PFNDOLGETQUERYOBJECTIVPROC dolGetQueryObjectiv; PFNDOLGETQUERYOBJECTUIVPROC dolGetQueryObjectuiv; PFNDOLGETQUERYIVPROC dolGetQueryiv; PFNDOLISBUFFERPROC dolIsBuffer; PFNDOLISQUERYPROC dolIsQuery; PFNDOLMAPBUFFERPROC dolMapBuffer; PFNDOLUNMAPBUFFERPROC dolUnmapBuffer; // gl_2_0 PFNDOLATTACHSHADERPROC dolAttachShader; PFNDOLBINDATTRIBLOCATIONPROC dolBindAttribLocation; PFNDOLBLENDEQUATIONSEPARATEPROC dolBlendEquationSeparate; PFNDOLCOMPILESHADERPROC dolCompileShader; PFNDOLCREATEPROGRAMPROC dolCreateProgram; PFNDOLCREATESHADERPROC dolCreateShader; PFNDOLDELETEPROGRAMPROC dolDeleteProgram; PFNDOLDELETESHADERPROC dolDeleteShader; PFNDOLDETACHSHADERPROC dolDetachShader; PFNDOLDISABLEVERTEXATTRIBARRAYPROC dolDisableVertexAttribArray; PFNDOLDRAWBUFFERSPROC dolDrawBuffers; PFNDOLENABLEVERTEXATTRIBARRAYPROC dolEnableVertexAttribArray; PFNDOLGETACTIVEATTRIBPROC dolGetActiveAttrib; PFNDOLGETACTIVEUNIFORMPROC dolGetActiveUniform; PFNDOLGETATTACHEDSHADERSPROC dolGetAttachedShaders; PFNDOLGETATTRIBLOCATIONPROC dolGetAttribLocation; PFNDOLGETPROGRAMINFOLOGPROC dolGetProgramInfoLog; PFNDOLGETPROGRAMIVPROC dolGetProgramiv; PFNDOLGETSHADERINFOLOGPROC dolGetShaderInfoLog; PFNDOLGETSHADERSOURCEPROC dolGetShaderSource; PFNDOLGETSHADERIVPROC dolGetShaderiv; PFNDOLGETUNIFORMLOCATIONPROC dolGetUniformLocation; PFNDOLGETUNIFORMFVPROC dolGetUniformfv; PFNDOLGETUNIFORMIVPROC dolGetUniformiv; PFNDOLGETVERTEXATTRIBPOINTERVPROC dolGetVertexAttribPointerv; PFNDOLGETVERTEXATTRIBDVPROC dolGetVertexAttribdv; PFNDOLGETVERTEXATTRIBFVPROC dolGetVertexAttribfv; PFNDOLGETVERTEXATTRIBIVPROC dolGetVertexAttribiv; PFNDOLISPROGRAMPROC dolIsProgram; PFNDOLISSHADERPROC dolIsShader; PFNDOLLINKPROGRAMPROC dolLinkProgram; PFNDOLSHADERSOURCEPROC dolShaderSource; PFNDOLSTENCILFUNCSEPARATEPROC dolStencilFuncSeparate; PFNDOLSTENCILMASKSEPARATEPROC dolStencilMaskSeparate; PFNDOLSTENCILOPSEPARATEPROC dolStencilOpSeparate; PFNDOLUNIFORM1FPROC dolUniform1f; PFNDOLUNIFORM1FVPROC dolUniform1fv; PFNDOLUNIFORM1IPROC dolUniform1i; PFNDOLUNIFORM1IVPROC dolUniform1iv; PFNDOLUNIFORM2FPROC dolUniform2f; PFNDOLUNIFORM2FVPROC dolUniform2fv; PFNDOLUNIFORM2IPROC dolUniform2i; PFNDOLUNIFORM2IVPROC dolUniform2iv; PFNDOLUNIFORM3FPROC dolUniform3f; PFNDOLUNIFORM3FVPROC dolUniform3fv; PFNDOLUNIFORM3IPROC dolUniform3i; PFNDOLUNIFORM3IVPROC dolUniform3iv; PFNDOLUNIFORM4FPROC dolUniform4f; PFNDOLUNIFORM4FVPROC dolUniform4fv; PFNDOLUNIFORM4IPROC dolUniform4i; PFNDOLUNIFORM4IVPROC dolUniform4iv; PFNDOLUNIFORMMATRIX2FVPROC dolUniformMatrix2fv; PFNDOLUNIFORMMATRIX3FVPROC dolUniformMatrix3fv; PFNDOLUNIFORMMATRIX4FVPROC dolUniformMatrix4fv; PFNDOLUSEPROGRAMPROC dolUseProgram; PFNDOLVALIDATEPROGRAMPROC dolValidateProgram; PFNDOLVERTEXATTRIB1DPROC dolVertexAttrib1d; PFNDOLVERTEXATTRIB1DVPROC dolVertexAttrib1dv; PFNDOLVERTEXATTRIB1FPROC dolVertexAttrib1f; PFNDOLVERTEXATTRIB1FVPROC dolVertexAttrib1fv; PFNDOLVERTEXATTRIB1SPROC dolVertexAttrib1s; PFNDOLVERTEXATTRIB1SVPROC dolVertexAttrib1sv; PFNDOLVERTEXATTRIB2DPROC dolVertexAttrib2d; PFNDOLVERTEXATTRIB2DVPROC dolVertexAttrib2dv; PFNDOLVERTEXATTRIB2FPROC dolVertexAttrib2f; PFNDOLVERTEXATTRIB2FVPROC dolVertexAttrib2fv; PFNDOLVERTEXATTRIB2SPROC dolVertexAttrib2s; PFNDOLVERTEXATTRIB2SVPROC dolVertexAttrib2sv; PFNDOLVERTEXATTRIB3DPROC dolVertexAttrib3d; PFNDOLVERTEXATTRIB3DVPROC dolVertexAttrib3dv; PFNDOLVERTEXATTRIB3FPROC dolVertexAttrib3f; PFNDOLVERTEXATTRIB3FVPROC dolVertexAttrib3fv; PFNDOLVERTEXATTRIB3SPROC dolVertexAttrib3s; PFNDOLVERTEXATTRIB3SVPROC dolVertexAttrib3sv; PFNDOLVERTEXATTRIB4NBVPROC dolVertexAttrib4Nbv; PFNDOLVERTEXATTRIB4NIVPROC dolVertexAttrib4Niv; PFNDOLVERTEXATTRIB4NSVPROC dolVertexAttrib4Nsv; PFNDOLVERTEXATTRIB4NUBPROC dolVertexAttrib4Nub; PFNDOLVERTEXATTRIB4NUBVPROC dolVertexAttrib4Nubv; PFNDOLVERTEXATTRIB4NUIVPROC dolVertexAttrib4Nuiv; PFNDOLVERTEXATTRIB4NUSVPROC dolVertexAttrib4Nusv; PFNDOLVERTEXATTRIB4BVPROC dolVertexAttrib4bv; PFNDOLVERTEXATTRIB4DPROC dolVertexAttrib4d; PFNDOLVERTEXATTRIB4DVPROC dolVertexAttrib4dv; PFNDOLVERTEXATTRIB4FPROC dolVertexAttrib4f; PFNDOLVERTEXATTRIB4FVPROC dolVertexAttrib4fv; PFNDOLVERTEXATTRIB4IVPROC dolVertexAttrib4iv; PFNDOLVERTEXATTRIB4SPROC dolVertexAttrib4s; PFNDOLVERTEXATTRIB4SVPROC dolVertexAttrib4sv; PFNDOLVERTEXATTRIB4UBVPROC dolVertexAttrib4ubv; PFNDOLVERTEXATTRIB4UIVPROC dolVertexAttrib4uiv; PFNDOLVERTEXATTRIB4USVPROC dolVertexAttrib4usv; PFNDOLVERTEXATTRIBPOINTERPROC dolVertexAttribPointer; // gl_2_1 PFNDOLUNIFORMMATRIX2X3FVPROC dolUniformMatrix2x3fv; PFNDOLUNIFORMMATRIX2X4FVPROC dolUniformMatrix2x4fv; PFNDOLUNIFORMMATRIX3X2FVPROC dolUniformMatrix3x2fv; PFNDOLUNIFORMMATRIX3X4FVPROC dolUniformMatrix3x4fv; PFNDOLUNIFORMMATRIX4X2FVPROC dolUniformMatrix4x2fv; PFNDOLUNIFORMMATRIX4X3FVPROC dolUniformMatrix4x3fv; // gl_3_0 PFNDOLBEGINCONDITIONALRENDERPROC dolBeginConditionalRender; PFNDOLBEGINTRANSFORMFEEDBACKPROC dolBeginTransformFeedback; PFNDOLBINDFRAGDATALOCATIONPROC dolBindFragDataLocation; PFNDOLCLAMPCOLORPROC dolClampColor; PFNDOLCLEARBUFFERFIPROC dolClearBufferfi; PFNDOLCLEARBUFFERFVPROC dolClearBufferfv; PFNDOLCLEARBUFFERIVPROC dolClearBufferiv; PFNDOLCLEARBUFFERUIVPROC dolClearBufferuiv; PFNDOLCOLORMASKIPROC dolColorMaski; PFNDOLDISABLEIPROC dolDisablei; PFNDOLENABLEIPROC dolEnablei; PFNDOLENDCONDITIONALRENDERPROC dolEndConditionalRender; PFNDOLENDTRANSFORMFEEDBACKPROC dolEndTransformFeedback; PFNDOLGETBOOLEANI_VPROC dolGetBooleani_v; PFNDOLGETFRAGDATALOCATIONPROC dolGetFragDataLocation; PFNDOLGETSTRINGIPROC dolGetStringi; PFNDOLGETTEXPARAMETERIIVPROC dolGetTexParameterIiv; PFNDOLGETTEXPARAMETERIUIVPROC dolGetTexParameterIuiv; PFNDOLGETTRANSFORMFEEDBACKVARYINGPROC dolGetTransformFeedbackVarying; PFNDOLGETUNIFORMUIVPROC dolGetUniformuiv; PFNDOLGETVERTEXATTRIBIIVPROC dolGetVertexAttribIiv; PFNDOLGETVERTEXATTRIBIUIVPROC dolGetVertexAttribIuiv; PFNDOLISENABLEDIPROC dolIsEnabledi; PFNDOLTEXPARAMETERIIVPROC dolTexParameterIiv; PFNDOLTEXPARAMETERIUIVPROC dolTexParameterIuiv; PFNDOLTRANSFORMFEEDBACKVARYINGSPROC dolTransformFeedbackVaryings; PFNDOLUNIFORM1UIPROC dolUniform1ui; PFNDOLUNIFORM1UIVPROC dolUniform1uiv; PFNDOLUNIFORM2UIPROC dolUniform2ui; PFNDOLUNIFORM2UIVPROC dolUniform2uiv; PFNDOLUNIFORM3UIPROC dolUniform3ui; PFNDOLUNIFORM3UIVPROC dolUniform3uiv; PFNDOLUNIFORM4UIPROC dolUniform4ui; PFNDOLUNIFORM4UIVPROC dolUniform4uiv; PFNDOLVERTEXATTRIBI1IPROC dolVertexAttribI1i; PFNDOLVERTEXATTRIBI1IVPROC dolVertexAttribI1iv; PFNDOLVERTEXATTRIBI1UIPROC dolVertexAttribI1ui; PFNDOLVERTEXATTRIBI1UIVPROC dolVertexAttribI1uiv; PFNDOLVERTEXATTRIBI2IPROC dolVertexAttribI2i; PFNDOLVERTEXATTRIBI2IVPROC dolVertexAttribI2iv; PFNDOLVERTEXATTRIBI2UIPROC dolVertexAttribI2ui; PFNDOLVERTEXATTRIBI2UIVPROC dolVertexAttribI2uiv; PFNDOLVERTEXATTRIBI3IPROC dolVertexAttribI3i; PFNDOLVERTEXATTRIBI3IVPROC dolVertexAttribI3iv; PFNDOLVERTEXATTRIBI3UIPROC dolVertexAttribI3ui; PFNDOLVERTEXATTRIBI3UIVPROC dolVertexAttribI3uiv; PFNDOLVERTEXATTRIBI4BVPROC dolVertexAttribI4bv; PFNDOLVERTEXATTRIBI4IPROC dolVertexAttribI4i; PFNDOLVERTEXATTRIBI4IVPROC dolVertexAttribI4iv; PFNDOLVERTEXATTRIBI4SVPROC dolVertexAttribI4sv; PFNDOLVERTEXATTRIBI4UBVPROC dolVertexAttribI4ubv; PFNDOLVERTEXATTRIBI4UIPROC dolVertexAttribI4ui; PFNDOLVERTEXATTRIBI4UIVPROC dolVertexAttribI4uiv; PFNDOLVERTEXATTRIBI4USVPROC dolVertexAttribI4usv; PFNDOLVERTEXATTRIBIPOINTERPROC dolVertexAttribIPointer; // gl_3_1 PFNDOLDRAWARRAYSINSTANCEDPROC dolDrawArraysInstanced; PFNDOLDRAWELEMENTSINSTANCEDPROC dolDrawElementsInstanced; PFNDOLPRIMITIVERESTARTINDEXPROC dolPrimitiveRestartIndex; PFNDOLTEXBUFFERPROC dolTexBuffer; // gl_3_2 PFNDOLFRAMEBUFFERTEXTUREPROC dolFramebufferTexture; PFNDOLGETBUFFERPARAMETERI64VPROC dolGetBufferParameteri64v; PFNDOLGETINTEGER64I_VPROC dolGetInteger64i_v; // gl 4_2 PFNDOLDRAWARRAYSINSTANCEDBASEINSTANCEPROC dolDrawArraysInstancedBaseInstance; PFNDOLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC dolDrawElementsInstancedBaseInstance; PFNDOLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC dolDrawElementsInstancedBaseVertexBaseInstance; PFNDOLGETINTERNALFORMATIVPROC dolGetInternalformativ; PFNDOLGETACTIVEATOMICCOUNTERBUFFERIVPROC dolGetActiveAtomicCounterBufferiv; PFNDOLBINDIMAGETEXTUREPROC dolBindImageTexture; PFNDOLMEMORYBARRIERPROC dolMemoryBarrier; PFNDOLTEXSTORAGE1DPROC dolTexStorage1D; PFNDOLTEXSTORAGE2DPROC dolTexStorage2D; PFNDOLTEXSTORAGE3DPROC dolTexStorage3D; PFNDOLDRAWTRANSFORMFEEDBACKINSTANCEDPROC dolDrawTransformFeedbackInstanced; PFNDOLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC dolDrawTransformFeedbackStreamInstanced; // gl_4_3 PFNDOLCLEARBUFFERDATAPROC dolClearBufferData; PFNDOLCLEARBUFFERSUBDATAPROC dolClearBufferSubData; PFNDOLDISPATCHCOMPUTEPROC dolDispatchCompute; PFNDOLDISPATCHCOMPUTEINDIRECTPROC dolDispatchComputeIndirect; PFNDOLFRAMEBUFFERPARAMETERIPROC dolFramebufferParameteri; PFNDOLGETFRAMEBUFFERPARAMETERIVPROC dolGetFramebufferParameteriv; PFNDOLGETINTERNALFORMATI64VPROC dolGetInternalformati64v; PFNDOLINVALIDATETEXSUBIMAGEPROC dolInvalidateTexSubImage; PFNDOLINVALIDATETEXIMAGEPROC dolInvalidateTexImage; PFNDOLINVALIDATEBUFFERSUBDATAPROC dolInvalidateBufferSubData; PFNDOLINVALIDATEBUFFERDATAPROC dolInvalidateBufferData; PFNDOLINVALIDATEFRAMEBUFFERPROC dolInvalidateFramebuffer; PFNDOLINVALIDATESUBFRAMEBUFFERPROC dolInvalidateSubFramebuffer; PFNDOLMULTIDRAWARRAYSINDIRECTPROC dolMultiDrawArraysIndirect; PFNDOLMULTIDRAWELEMENTSINDIRECTPROC dolMultiDrawElementsIndirect; PFNDOLGETPROGRAMINTERFACEIVPROC dolGetProgramInterfaceiv; PFNDOLGETPROGRAMRESOURCEINDEXPROC dolGetProgramResourceIndex; PFNDOLGETPROGRAMRESOURCENAMEPROC dolGetProgramResourceName; PFNDOLGETPROGRAMRESOURCEIVPROC dolGetProgramResourceiv; PFNDOLGETPROGRAMRESOURCELOCATIONPROC dolGetProgramResourceLocation; PFNDOLGETPROGRAMRESOURCELOCATIONINDEXPROC dolGetProgramResourceLocationIndex; PFNDOLTEXBUFFERRANGEPROC dolTexBufferRange; PFNDOLTEXTUREVIEWPROC dolTextureView; PFNDOLBINDVERTEXBUFFERPROC dolBindVertexBuffer; PFNDOLVERTEXATTRIBFORMATPROC dolVertexAttribFormat; PFNDOLVERTEXATTRIBIFORMATPROC dolVertexAttribIFormat; PFNDOLVERTEXATTRIBLFORMATPROC dolVertexAttribLFormat; PFNDOLVERTEXATTRIBBINDINGPROC dolVertexAttribBinding; PFNDOLVERTEXBINDINGDIVISORPROC dolVertexBindingDivisor; // gl_4_4 PFNDOLCLEARTEXIMAGEPROC dolClearTexImage; PFNDOLCLEARTEXSUBIMAGEPROC dolClearTexSubImage; PFNDOLBINDBUFFERSBASEPROC dolBindBuffersBase; PFNDOLBINDBUFFERSRANGEPROC dolBindBuffersRange; PFNDOLBINDTEXTURESPROC dolBindTextures; PFNDOLBINDSAMPLERSPROC dolBindSamplers; PFNDOLBINDIMAGETEXTURESPROC dolBindImageTextures; PFNDOLBINDVERTEXBUFFERSPROC dolBindVertexBuffers; // gl_4_5 PFNDOLCREATETRANSFORMFEEDBACKSPROC dolCreateTransformFeedbacks; PFNDOLTRANSFORMFEEDBACKBUFFERBASEPROC dolTransformFeedbackBufferBase; PFNDOLTRANSFORMFEEDBACKBUFFERRANGEPROC dolTransformFeedbackBufferRange; PFNDOLGETTRANSFORMFEEDBACKIVPROC dolGetTransformFeedbackiv; PFNDOLGETTRANSFORMFEEDBACKI_VPROC dolGetTransformFeedbacki_v; PFNDOLGETTRANSFORMFEEDBACKI64_VPROC dolGetTransformFeedbacki64_v; PFNDOLCREATEBUFFERSPROC dolCreateBuffers; PFNDOLNAMEDBUFFERSTORAGEPROC dolNamedBufferStorage; PFNDOLNAMEDBUFFERDATAPROC dolNamedBufferData; PFNDOLNAMEDBUFFERSUBDATAPROC dolNamedBufferSubData; PFNDOLCOPYNAMEDBUFFERSUBDATAPROC dolCopyNamedBufferSubData; PFNDOLCLEARNAMEDBUFFERDATAPROC dolClearNamedBufferData; PFNDOLCLEARNAMEDBUFFERSUBDATAPROC dolClearNamedBufferSubData; PFNDOLMAPNAMEDBUFFERPROC dolMapNamedBuffer; PFNDOLMAPNAMEDBUFFERRANGEPROC dolMapNamedBufferRange; PFNDOLUNMAPNAMEDBUFFERPROC dolUnmapNamedBuffer; PFNDOLFLUSHMAPPEDNAMEDBUFFERRANGEPROC dolFlushMappedNamedBufferRange; PFNDOLGETNAMEDBUFFERPARAMETERIVPROC dolGetNamedBufferParameteriv; PFNDOLGETNAMEDBUFFERPARAMETERI64VPROC dolGetNamedBufferParameteri64v; PFNDOLGETNAMEDBUFFERPOINTERVPROC dolGetNamedBufferPointerv; PFNDOLGETNAMEDBUFFERSUBDATAPROC dolGetNamedBufferSubData; PFNDOLCREATEFRAMEBUFFERSPROC dolCreateFramebuffers; PFNDOLNAMEDFRAMEBUFFERRENDERBUFFERPROC dolNamedFramebufferRenderbuffer; PFNDOLNAMEDFRAMEBUFFERPARAMETERIPROC dolNamedFramebufferParameteri; PFNDOLNAMEDFRAMEBUFFERTEXTUREPROC dolNamedFramebufferTexture; PFNDOLNAMEDFRAMEBUFFERTEXTURELAYERPROC dolNamedFramebufferTextureLayer; PFNDOLNAMEDFRAMEBUFFERDRAWBUFFERPROC dolNamedFramebufferDrawBuffer; PFNDOLNAMEDFRAMEBUFFERDRAWBUFFERSPROC dolNamedFramebufferDrawBuffers; PFNDOLNAMEDFRAMEBUFFERREADBUFFERPROC dolNamedFramebufferReadBuffer; PFNDOLINVALIDATENAMEDFRAMEBUFFERDATAPROC dolInvalidateNamedFramebufferData; PFNDOLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC dolInvalidateNamedFramebufferSubData; PFNDOLCLEARNAMEDFRAMEBUFFERIVPROC dolClearNamedFramebufferiv; PFNDOLCLEARNAMEDFRAMEBUFFERUIVPROC dolClearNamedFramebufferuiv; PFNDOLCLEARNAMEDFRAMEBUFFERFVPROC dolClearNamedFramebufferfv; PFNDOLCLEARNAMEDFRAMEBUFFERFIPROC dolClearNamedFramebufferfi; PFNDOLBLITNAMEDFRAMEBUFFERPROC dolBlitNamedFramebuffer; PFNDOLCHECKNAMEDFRAMEBUFFERSTATUSPROC dolCheckNamedFramebufferStatus; PFNDOLGETNAMEDFRAMEBUFFERPARAMETERIVPROC dolGetNamedFramebufferParameteriv; PFNDOLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC dolGetNamedFramebufferAttachmentParameteriv; PFNDOLCREATERENDERBUFFERSPROC dolCreateRenderbuffers; PFNDOLNAMEDRENDERBUFFERSTORAGEPROC dolNamedRenderbufferStorage; PFNDOLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC dolNamedRenderbufferStorageMultisample; PFNDOLGETNAMEDRENDERBUFFERPARAMETERIVPROC dolGetNamedRenderbufferParameteriv; PFNDOLCREATETEXTURESPROC dolCreateTextures; PFNDOLTEXTUREBUFFERPROC dolTextureBuffer; PFNDOLTEXTUREBUFFERRANGEPROC dolTextureBufferRange; PFNDOLTEXTURESTORAGE1DPROC dolTextureStorage1D; PFNDOLTEXTURESTORAGE2DPROC dolTextureStorage2D; PFNDOLTEXTURESTORAGE3DPROC dolTextureStorage3D; PFNDOLTEXTURESTORAGE2DMULTISAMPLEPROC dolTextureStorage2DMultisample; PFNDOLTEXTURESTORAGE3DMULTISAMPLEPROC dolTextureStorage3DMultisample; PFNDOLTEXTURESUBIMAGE1DPROC dolTextureSubImage1D; PFNDOLTEXTURESUBIMAGE2DPROC dolTextureSubImage2D; PFNDOLTEXTURESUBIMAGE3DPROC dolTextureSubImage3D; PFNDOLCOMPRESSEDTEXTURESUBIMAGE1DPROC dolCompressedTextureSubImage1D; PFNDOLCOMPRESSEDTEXTURESUBIMAGE2DPROC dolCompressedTextureSubImage2D; PFNDOLCOMPRESSEDTEXTURESUBIMAGE3DPROC dolCompressedTextureSubImage3D; PFNDOLCOPYTEXTURESUBIMAGE1DPROC dolCopyTextureSubImage1D; PFNDOLCOPYTEXTURESUBIMAGE2DPROC dolCopyTextureSubImage2D; PFNDOLCOPYTEXTURESUBIMAGE3DPROC dolCopyTextureSubImage3D; PFNDOLTEXTUREPARAMETERFPROC dolTextureParameterf; PFNDOLTEXTUREPARAMETERFVPROC dolTextureParameterfv; PFNDOLTEXTUREPARAMETERIPROC dolTextureParameteri; PFNDOLTEXTUREPARAMETERIIVPROC dolTextureParameterIiv; PFNDOLTEXTUREPARAMETERIUIVPROC dolTextureParameterIuiv; PFNDOLTEXTUREPARAMETERIVPROC dolTextureParameteriv; PFNDOLGENERATETEXTUREMIPMAPPROC dolGenerateTextureMipmap; PFNDOLBINDTEXTUREUNITPROC dolBindTextureUnit; PFNDOLGETTEXTUREIMAGEPROC dolGetTextureImage; PFNDOLGETCOMPRESSEDTEXTUREIMAGEPROC dolGetCompressedTextureImage; PFNDOLGETTEXTURELEVELPARAMETERFVPROC dolGetTextureLevelParameterfv; PFNDOLGETTEXTURELEVELPARAMETERIVPROC dolGetTextureLevelParameteriv; PFNDOLGETTEXTUREPARAMETERFVPROC dolGetTextureParameterfv; PFNDOLGETTEXTUREPARAMETERIIVPROC dolGetTextureParameterIiv; PFNDOLGETTEXTUREPARAMETERIUIVPROC dolGetTextureParameterIuiv; PFNDOLGETTEXTUREPARAMETERIVPROC dolGetTextureParameteriv; PFNDOLCREATEVERTEXARRAYSPROC dolCreateVertexArrays; PFNDOLDISABLEVERTEXARRAYATTRIBPROC dolDisableVertexArrayAttrib; PFNDOLENABLEVERTEXARRAYATTRIBPROC dolEnableVertexArrayAttrib; PFNDOLVERTEXARRAYELEMENTBUFFERPROC dolVertexArrayElementBuffer; PFNDOLVERTEXARRAYVERTEXBUFFERPROC dolVertexArrayVertexBuffer; PFNDOLVERTEXARRAYVERTEXBUFFERSPROC dolVertexArrayVertexBuffers; PFNDOLVERTEXARRAYATTRIBBINDINGPROC dolVertexArrayAttribBinding; PFNDOLVERTEXARRAYATTRIBFORMATPROC dolVertexArrayAttribFormat; PFNDOLVERTEXARRAYATTRIBIFORMATPROC dolVertexArrayAttribIFormat; PFNDOLVERTEXARRAYATTRIBLFORMATPROC dolVertexArrayAttribLFormat; PFNDOLVERTEXARRAYBINDINGDIVISORPROC dolVertexArrayBindingDivisor; PFNDOLGETVERTEXARRAYIVPROC dolGetVertexArrayiv; PFNDOLGETVERTEXARRAYINDEXEDIVPROC dolGetVertexArrayIndexediv; PFNDOLGETVERTEXARRAYINDEXED64IVPROC dolGetVertexArrayIndexed64iv; PFNDOLCREATESAMPLERSPROC dolCreateSamplers; PFNDOLCREATEPROGRAMPIPELINESPROC dolCreateProgramPipelines; PFNDOLCREATEQUERIESPROC dolCreateQueries; PFNDOLGETQUERYBUFFEROBJECTI64VPROC dolGetQueryBufferObjecti64v; PFNDOLGETQUERYBUFFEROBJECTIVPROC dolGetQueryBufferObjectiv; PFNDOLGETQUERYBUFFEROBJECTUI64VPROC dolGetQueryBufferObjectui64v; PFNDOLGETQUERYBUFFEROBJECTUIVPROC dolGetQueryBufferObjectuiv; PFNDOLMEMORYBARRIERBYREGIONPROC dolMemoryBarrierByRegion; PFNDOLGETTEXTURESUBIMAGEPROC dolGetTextureSubImage; PFNDOLGETCOMPRESSEDTEXTURESUBIMAGEPROC dolGetCompressedTextureSubImage; PFNDOLGETGRAPHICSRESETSTATUSPROC dolGetGraphicsResetStatus; PFNDOLGETNCOMPRESSEDTEXIMAGEPROC dolGetnCompressedTexImage; PFNDOLGETNTEXIMAGEPROC dolGetnTexImage; PFNDOLGETNUNIFORMDVPROC dolGetnUniformdv; PFNDOLGETNUNIFORMFVPROC dolGetnUniformfv; PFNDOLGETNUNIFORMIVPROC dolGetnUniformiv; PFNDOLGETNUNIFORMUIVPROC dolGetnUniformuiv; PFNDOLREADNPIXELSPROC dolReadnPixels; PFNDOLGETNMAPDVPROC dolGetnMapdv; PFNDOLGETNMAPFVPROC dolGetnMapfv; PFNDOLGETNMAPIVPROC dolGetnMapiv; PFNDOLGETNPIXELMAPFVPROC dolGetnPixelMapfv; PFNDOLGETNPIXELMAPUIVPROC dolGetnPixelMapuiv; PFNDOLGETNPIXELMAPUSVPROC dolGetnPixelMapusv; PFNDOLGETNPOLYGONSTIPPLEPROC dolGetnPolygonStipple; PFNDOLGETNCOLORTABLEPROC dolGetnColorTable; PFNDOLGETNCONVOLUTIONFILTERPROC dolGetnConvolutionFilter; PFNDOLGETNSEPARABLEFILTERPROC dolGetnSeparableFilter; PFNDOLGETNHISTOGRAMPROC dolGetnHistogram; PFNDOLGETNMINMAXPROC dolGetnMinmax; PFNDOLTEXTUREBARRIERPROC dolTextureBarrier; // ARB_uniform_buffer_object PFNDOLBINDBUFFERBASEPROC dolBindBufferBase; PFNDOLBINDBUFFERRANGEPROC dolBindBufferRange; PFNDOLGETACTIVEUNIFORMBLOCKNAMEPROC dolGetActiveUniformBlockName; PFNDOLGETACTIVEUNIFORMBLOCKIVPROC dolGetActiveUniformBlockiv; PFNDOLGETACTIVEUNIFORMNAMEPROC dolGetActiveUniformName; PFNDOLGETACTIVEUNIFORMSIVPROC dolGetActiveUniformsiv; PFNDOLGETINTEGERI_VPROC dolGetIntegeri_v; PFNDOLGETUNIFORMBLOCKINDEXPROC dolGetUniformBlockIndex; PFNDOLGETUNIFORMINDICESPROC dolGetUniformIndices; PFNDOLUNIFORMBLOCKBINDINGPROC dolUniformBlockBinding; // ARB_sampler_objects PFNDOLBINDSAMPLERPROC dolBindSampler; PFNDOLDELETESAMPLERSPROC dolDeleteSamplers; PFNDOLGENSAMPLERSPROC dolGenSamplers; PFNDOLGETSAMPLERPARAMETERIIVPROC dolGetSamplerParameterIiv; PFNDOLGETSAMPLERPARAMETERIUIVPROC dolGetSamplerParameterIuiv; PFNDOLGETSAMPLERPARAMETERFVPROC dolGetSamplerParameterfv; PFNDOLGETSAMPLERPARAMETERIVPROC dolGetSamplerParameteriv; PFNDOLISSAMPLERPROC dolIsSampler; PFNDOLSAMPLERPARAMETERIIVPROC dolSamplerParameterIiv; PFNDOLSAMPLERPARAMETERIUIVPROC dolSamplerParameterIuiv; PFNDOLSAMPLERPARAMETERFPROC dolSamplerParameterf; PFNDOLSAMPLERPARAMETERFVPROC dolSamplerParameterfv; PFNDOLSAMPLERPARAMETERIPROC dolSamplerParameteri; PFNDOLSAMPLERPARAMETERIVPROC dolSamplerParameteriv; // ARB_map_buffer_range PFNDOLFLUSHMAPPEDBUFFERRANGEPROC dolFlushMappedBufferRange; PFNDOLMAPBUFFERRANGEPROC dolMapBufferRange; // ARB_vertex_array_object PFNDOLBINDVERTEXARRAYPROC dolBindVertexArray; PFNDOLDELETEVERTEXARRAYSPROC dolDeleteVertexArrays; PFNDOLGENVERTEXARRAYSPROC dolGenVertexArrays; PFNDOLISVERTEXARRAYPROC dolIsVertexArray; // ARB_framebuffer_object PFNDOLBINDFRAMEBUFFERPROC dolBindFramebuffer; PFNDOLBINDRENDERBUFFERPROC dolBindRenderbuffer; PFNDOLBLITFRAMEBUFFERPROC dolBlitFramebuffer; PFNDOLCHECKFRAMEBUFFERSTATUSPROC dolCheckFramebufferStatus; PFNDOLDELETEFRAMEBUFFERSPROC dolDeleteFramebuffers; PFNDOLDELETERENDERBUFFERSPROC dolDeleteRenderbuffers; PFNDOLFRAMEBUFFERRENDERBUFFERPROC dolFramebufferRenderbuffer; PFNDOLFRAMEBUFFERTEXTURE1DPROC dolFramebufferTexture1D; PFNDOLFRAMEBUFFERTEXTURE2DPROC dolFramebufferTexture2D; PFNDOLFRAMEBUFFERTEXTURE3DPROC dolFramebufferTexture3D; PFNDOLFRAMEBUFFERTEXTURELAYERPROC dolFramebufferTextureLayer; PFNDOLGENFRAMEBUFFERSPROC dolGenFramebuffers; PFNDOLGENRENDERBUFFERSPROC dolGenRenderbuffers; PFNDOLGENERATEMIPMAPPROC dolGenerateMipmap; PFNDOLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC dolGetFramebufferAttachmentParameteriv; PFNDOLGETRENDERBUFFERPARAMETERIVPROC dolGetRenderbufferParameteriv; PFNDOLISFRAMEBUFFERPROC dolIsFramebuffer; PFNDOLISRENDERBUFFERPROC dolIsRenderbuffer; PFNDOLRENDERBUFFERSTORAGEPROC dolRenderbufferStorage; PFNDOLRENDERBUFFERSTORAGEMULTISAMPLEPROC dolRenderbufferStorageMultisample; // ARB_get_program_binary PFNDOLGETPROGRAMBINARYPROC dolGetProgramBinary; PFNDOLPROGRAMBINARYPROC dolProgramBinary; PFNDOLPROGRAMPARAMETERIPROC dolProgramParameteri; // ARB_sync PFNDOLCLIENTWAITSYNCPROC dolClientWaitSync; PFNDOLDELETESYNCPROC dolDeleteSync; PFNDOLFENCESYNCPROC dolFenceSync; PFNDOLGETINTEGER64VPROC dolGetInteger64v; PFNDOLGETSYNCIVPROC dolGetSynciv; PFNDOLISSYNCPROC dolIsSync; PFNDOLWAITSYNCPROC dolWaitSync; // ARB_texture_multisample PFNDOLTEXIMAGE2DMULTISAMPLEPROC dolTexImage2DMultisample; PFNDOLTEXIMAGE3DMULTISAMPLEPROC dolTexImage3DMultisample; PFNDOLGETMULTISAMPLEFVPROC dolGetMultisamplefv; PFNDOLSAMPLEMASKIPROC dolSampleMaski; // ARB_texture_storage_multisample PFNDOLTEXSTORAGE2DMULTISAMPLEPROC dolTexStorage2DMultisample; PFNDOLTEXSTORAGE3DMULTISAMPLEPROC dolTexStorage3DMultisample; // ARB_ES2_compatibility PFNDOLCLEARDEPTHFPROC dolClearDepthf; PFNDOLDEPTHRANGEFPROC dolDepthRangef; PFNDOLGETSHADERPRECISIONFORMATPROC dolGetShaderPrecisionFormat; PFNDOLRELEASESHADERCOMPILERPROC dolReleaseShaderCompiler; PFNDOLSHADERBINARYPROC dolShaderBinary; // NV_primitive_restart PFNDOLPRIMITIVERESTARTINDEXNVPROC dolPrimitiveRestartIndexNV; PFNDOLPRIMITIVERESTARTNVPROC dolPrimitiveRestartNV; // ARB_blend_func_extended PFNDOLBINDFRAGDATALOCATIONINDEXEDPROC dolBindFragDataLocationIndexed; PFNDOLGETFRAGDATAINDEXPROC dolGetFragDataIndex; // ARB_viewport_array PFNDOLDEPTHRANGEARRAYVPROC dolDepthRangeArrayv; PFNDOLDEPTHRANGEINDEXEDPROC dolDepthRangeIndexed; PFNDOLGETDOUBLEI_VPROC dolGetDoublei_v; PFNDOLGETFLOATI_VPROC dolGetFloati_v; PFNDOLSCISSORARRAYVPROC dolScissorArrayv; PFNDOLSCISSORINDEXEDPROC dolScissorIndexed; PFNDOLSCISSORINDEXEDVPROC dolScissorIndexedv; PFNDOLVIEWPORTARRAYVPROC dolViewportArrayv; PFNDOLVIEWPORTINDEXEDFPROC dolViewportIndexedf; PFNDOLVIEWPORTINDEXEDFVPROC dolViewportIndexedfv; // ARB_draw_elements_base_vertex PFNDOLDRAWELEMENTSBASEVERTEXPROC dolDrawElementsBaseVertex; PFNDOLDRAWELEMENTSINSTANCEDBASEVERTEXPROC dolDrawElementsInstancedBaseVertex; PFNDOLDRAWRANGEELEMENTSBASEVERTEXPROC dolDrawRangeElementsBaseVertex; PFNDOLMULTIDRAWELEMENTSBASEVERTEXPROC dolMultiDrawElementsBaseVertex; // ARB_sample_shading PFNDOLMINSAMPLESHADINGARBPROC dolMinSampleShading; // ARB_debug_output PFNDOLDEBUGMESSAGECALLBACKARBPROC dolDebugMessageCallbackARB; PFNDOLDEBUGMESSAGECONTROLARBPROC dolDebugMessageControlARB; PFNDOLDEBUGMESSAGEINSERTARBPROC dolDebugMessageInsertARB; PFNDOLGETDEBUGMESSAGELOGARBPROC dolGetDebugMessageLogARB; // KHR_debug PFNDOLDEBUGMESSAGECALLBACKPROC dolDebugMessageCallback; PFNDOLDEBUGMESSAGECONTROLPROC dolDebugMessageControl; PFNDOLDEBUGMESSAGEINSERTPROC dolDebugMessageInsert; PFNDOLGETDEBUGMESSAGELOGPROC dolGetDebugMessageLog; PFNDOLGETOBJECTLABELPROC dolGetObjectLabel; PFNDOLGETOBJECTPTRLABELPROC dolGetObjectPtrLabel; PFNDOLOBJECTLABELPROC dolObjectLabel; PFNDOLOBJECTPTRLABELPROC dolObjectPtrLabel; PFNDOLPOPDEBUGGROUPPROC dolPopDebugGroup; PFNDOLPUSHDEBUGGROUPPROC dolPushDebugGroup; // ARB_buffer_storage PFNDOLBUFFERSTORAGEPROC dolBufferStorage; // GL_NV_occlusion_query_samples PFNDOLGENOCCLUSIONQUERIESNVPROC dolGenOcclusionQueriesNV; PFNDOLDELETEOCCLUSIONQUERIESNVPROC dolDeleteOcclusionQueriesNV; PFNDOLISOCCLUSIONQUERYNVPROC dolIsOcclusionQueryNV; PFNDOLBEGINOCCLUSIONQUERYNVPROC dolBeginOcclusionQueryNV; PFNDOLENDOCCLUSIONQUERYNVPROC dolEndOcclusionQueryNV; PFNDOLGETOCCLUSIONQUERYIVNVPROC dolGetOcclusionQueryivNV; PFNDOLGETOCCLUSIONQUERYUIVNVPROC dolGetOcclusionQueryuivNV; // ARB_clip_control PFNDOLCLIPCONTROLPROC dolClipControl; // ARB_copy_image PFNDOLCOPYIMAGESUBDATAPROC dolCopyImageSubData; // ARB_shader_storage_buffer_object PFNDOLSHADERSTORAGEBLOCKBINDINGPROC dolShaderStorageBlockBinding; // Creates a GLFunc object that requires a feature #define GLFUNC_REQUIRES(x, y) { (void**)&x, #x, y } // Creates a GLFunc object with a different function suffix // For when we want to use the same function pointer, but different function name #define GLFUNC_SUFFIX(x, y, z) { (void**)&x, #x #y, z } // Creates a GLFunc object that should always be able to get grabbed // Used for Desktop OpenGL functions that should /always/ be provided. // aka GL 1.1/1.2/1.3/1.4 #define GLFUNC_ALWAYS_REQUIRED(x) { (void**)&x, #x, "VERSION_GL" } // Creates a GLFunc object that should be able to get grabbed // on both GL and ES #define GL_ES_FUNC_ALWAYS_REQUIRED(x) { (void**)&x, #x, "VERSION_GL |VERSION_GLES_2" } // Creates a GLFunc object that should be able to get grabbed // on both GL and ES 3.0 #define GL_ES3_FUNC_ALWAYS_REQUIRED(x) { (void**)&x, #x, "VERSION_GL |VERSION_GLES_3" } // Creates a GLFunc object that should be able to get grabbed // on both GL and ES 3.2 #define GL_ES32_FUNC_ALWAYS_REQUIRED(x) { (void**)&x, #x, "VERSION_GL |VERSION_GLES_3_2" } struct GLFunc { void** function_ptr; const std::string function_name; const std::string requirements; }; const GLFunc gl_function_array[] = { // gl_1_1 GLFUNC_ALWAYS_REQUIRED(glClearIndex), GLFUNC_ALWAYS_REQUIRED(glIndexMask), GLFUNC_ALWAYS_REQUIRED(glAlphaFunc), GLFUNC_ALWAYS_REQUIRED(glLogicOp), GLFUNC_ALWAYS_REQUIRED(glPointSize), GLFUNC_ALWAYS_REQUIRED(glLineStipple), GLFUNC_ALWAYS_REQUIRED(glPolygonMode), GLFUNC_ALWAYS_REQUIRED(glPolygonStipple), GLFUNC_ALWAYS_REQUIRED(glGetPolygonStipple), GLFUNC_ALWAYS_REQUIRED(glEdgeFlag), GLFUNC_ALWAYS_REQUIRED(glEdgeFlagv), GLFUNC_ALWAYS_REQUIRED(glClipPlane), GLFUNC_ALWAYS_REQUIRED(glGetClipPlane), GLFUNC_ALWAYS_REQUIRED(glDrawBuffer), GLFUNC_ALWAYS_REQUIRED(glEnableClientState), GLFUNC_ALWAYS_REQUIRED(glDisableClientState), GLFUNC_ALWAYS_REQUIRED(glGetDoublev), GLFUNC_ALWAYS_REQUIRED(glPushAttrib), GLFUNC_ALWAYS_REQUIRED(glPopAttrib), GLFUNC_ALWAYS_REQUIRED(glPushClientAttrib), GLFUNC_ALWAYS_REQUIRED(glPopClientAttrib), GLFUNC_ALWAYS_REQUIRED(glRenderMode), GLFUNC_ALWAYS_REQUIRED(glClearDepth), GLFUNC_ALWAYS_REQUIRED(glDepthRange), GLFUNC_ALWAYS_REQUIRED(glClearAccum), GLFUNC_ALWAYS_REQUIRED(glAccum), GLFUNC_ALWAYS_REQUIRED(glMatrixMode), GLFUNC_ALWAYS_REQUIRED(glOrtho), GLFUNC_ALWAYS_REQUIRED(glFrustum), GLFUNC_ALWAYS_REQUIRED(glPushMatrix), GLFUNC_ALWAYS_REQUIRED(glPopMatrix), GLFUNC_ALWAYS_REQUIRED(glLoadIdentity), GLFUNC_ALWAYS_REQUIRED(glLoadMatrixd), GLFUNC_ALWAYS_REQUIRED(glLoadMatrixf), GLFUNC_ALWAYS_REQUIRED(glMultMatrixd), GLFUNC_ALWAYS_REQUIRED(glMultMatrixf), GLFUNC_ALWAYS_REQUIRED(glRotated), GLFUNC_ALWAYS_REQUIRED(glRotatef), GLFUNC_ALWAYS_REQUIRED(glScaled), GLFUNC_ALWAYS_REQUIRED(glScalef), GLFUNC_ALWAYS_REQUIRED(glTranslated), GLFUNC_ALWAYS_REQUIRED(glTranslatef), GLFUNC_ALWAYS_REQUIRED(glIsList), GLFUNC_ALWAYS_REQUIRED(glDeleteLists), GLFUNC_ALWAYS_REQUIRED(glGenLists), GLFUNC_ALWAYS_REQUIRED(glNewList), GLFUNC_ALWAYS_REQUIRED(glEndList), GLFUNC_ALWAYS_REQUIRED(glCallList), GLFUNC_ALWAYS_REQUIRED(glCallLists), GLFUNC_ALWAYS_REQUIRED(glListBase), GLFUNC_ALWAYS_REQUIRED(glBegin), GLFUNC_ALWAYS_REQUIRED(glEnd), GLFUNC_ALWAYS_REQUIRED(glVertex2d), GLFUNC_ALWAYS_REQUIRED(glVertex2f), GLFUNC_ALWAYS_REQUIRED(glVertex2i), GLFUNC_ALWAYS_REQUIRED(glVertex2s), GLFUNC_ALWAYS_REQUIRED(glVertex3d), GLFUNC_ALWAYS_REQUIRED(glVertex3f), GLFUNC_ALWAYS_REQUIRED(glVertex3i), GLFUNC_ALWAYS_REQUIRED(glVertex3s), GLFUNC_ALWAYS_REQUIRED(glVertex4d), GLFUNC_ALWAYS_REQUIRED(glVertex4f), GLFUNC_ALWAYS_REQUIRED(glVertex4i), GLFUNC_ALWAYS_REQUIRED(glVertex4s), GLFUNC_ALWAYS_REQUIRED(glVertex2dv), GLFUNC_ALWAYS_REQUIRED(glVertex2fv), GLFUNC_ALWAYS_REQUIRED(glVertex2iv), GLFUNC_ALWAYS_REQUIRED(glVertex2sv), GLFUNC_ALWAYS_REQUIRED(glVertex3dv), GLFUNC_ALWAYS_REQUIRED(glVertex3fv), GLFUNC_ALWAYS_REQUIRED(glVertex3iv), GLFUNC_ALWAYS_REQUIRED(glVertex3sv), GLFUNC_ALWAYS_REQUIRED(glVertex4dv), GLFUNC_ALWAYS_REQUIRED(glVertex4fv), GLFUNC_ALWAYS_REQUIRED(glVertex4iv), GLFUNC_ALWAYS_REQUIRED(glVertex4sv), GLFUNC_ALWAYS_REQUIRED(glNormal3b), GLFUNC_ALWAYS_REQUIRED(glNormal3d), GLFUNC_ALWAYS_REQUIRED(glNormal3f), GLFUNC_ALWAYS_REQUIRED(glNormal3i), GLFUNC_ALWAYS_REQUIRED(glNormal3s), GLFUNC_ALWAYS_REQUIRED(glNormal3bv), GLFUNC_ALWAYS_REQUIRED(glNormal3dv), GLFUNC_ALWAYS_REQUIRED(glNormal3fv), GLFUNC_ALWAYS_REQUIRED(glNormal3iv), GLFUNC_ALWAYS_REQUIRED(glNormal3sv), GLFUNC_ALWAYS_REQUIRED(glIndexd), GLFUNC_ALWAYS_REQUIRED(glIndexf), GLFUNC_ALWAYS_REQUIRED(glIndexi), GLFUNC_ALWAYS_REQUIRED(glIndexs), GLFUNC_ALWAYS_REQUIRED(glIndexub), GLFUNC_ALWAYS_REQUIRED(glIndexdv), GLFUNC_ALWAYS_REQUIRED(glIndexfv), GLFUNC_ALWAYS_REQUIRED(glIndexiv), GLFUNC_ALWAYS_REQUIRED(glIndexsv), GLFUNC_ALWAYS_REQUIRED(glIndexubv), GLFUNC_ALWAYS_REQUIRED(glColor3b), GLFUNC_ALWAYS_REQUIRED(glColor3d), GLFUNC_ALWAYS_REQUIRED(glColor3f), GLFUNC_ALWAYS_REQUIRED(glColor3i), GLFUNC_ALWAYS_REQUIRED(glColor3s), GLFUNC_ALWAYS_REQUIRED(glColor3ub), GLFUNC_ALWAYS_REQUIRED(glColor3ui), GLFUNC_ALWAYS_REQUIRED(glColor3us), GLFUNC_ALWAYS_REQUIRED(glColor4b), GLFUNC_ALWAYS_REQUIRED(glColor4d), GLFUNC_ALWAYS_REQUIRED(glColor4f), GLFUNC_ALWAYS_REQUIRED(glColor4i), GLFUNC_ALWAYS_REQUIRED(glColor4s), GLFUNC_ALWAYS_REQUIRED(glColor4ub), GLFUNC_ALWAYS_REQUIRED(glColor4ui), GLFUNC_ALWAYS_REQUIRED(glColor4us), GLFUNC_ALWAYS_REQUIRED(glColor3bv), GLFUNC_ALWAYS_REQUIRED(glColor3dv), GLFUNC_ALWAYS_REQUIRED(glColor3fv), GLFUNC_ALWAYS_REQUIRED(glColor3iv), GLFUNC_ALWAYS_REQUIRED(glColor3sv), GLFUNC_ALWAYS_REQUIRED(glColor3ubv), GLFUNC_ALWAYS_REQUIRED(glColor3uiv), GLFUNC_ALWAYS_REQUIRED(glColor3usv), GLFUNC_ALWAYS_REQUIRED(glColor4bv), GLFUNC_ALWAYS_REQUIRED(glColor4dv), GLFUNC_ALWAYS_REQUIRED(glColor4fv), GLFUNC_ALWAYS_REQUIRED(glColor4iv), GLFUNC_ALWAYS_REQUIRED(glColor4sv), GLFUNC_ALWAYS_REQUIRED(glColor4ubv), GLFUNC_ALWAYS_REQUIRED(glColor4uiv), GLFUNC_ALWAYS_REQUIRED(glColor4usv), GLFUNC_ALWAYS_REQUIRED(glTexCoord1d), GLFUNC_ALWAYS_REQUIRED(glTexCoord1f), GLFUNC_ALWAYS_REQUIRED(glTexCoord1i), GLFUNC_ALWAYS_REQUIRED(glTexCoord1s), GLFUNC_ALWAYS_REQUIRED(glTexCoord2d), GLFUNC_ALWAYS_REQUIRED(glTexCoord2f), GLFUNC_ALWAYS_REQUIRED(glTexCoord2i), GLFUNC_ALWAYS_REQUIRED(glTexCoord2s), GLFUNC_ALWAYS_REQUIRED(glTexCoord3d), GLFUNC_ALWAYS_REQUIRED(glTexCoord3f), GLFUNC_ALWAYS_REQUIRED(glTexCoord3i), GLFUNC_ALWAYS_REQUIRED(glTexCoord3s), GLFUNC_ALWAYS_REQUIRED(glTexCoord4d), GLFUNC_ALWAYS_REQUIRED(glTexCoord4f), GLFUNC_ALWAYS_REQUIRED(glTexCoord4i), GLFUNC_ALWAYS_REQUIRED(glTexCoord4s), GLFUNC_ALWAYS_REQUIRED(glTexCoord1dv), GLFUNC_ALWAYS_REQUIRED(glTexCoord1fv), GLFUNC_ALWAYS_REQUIRED(glTexCoord1iv), GLFUNC_ALWAYS_REQUIRED(glTexCoord1sv), GLFUNC_ALWAYS_REQUIRED(glTexCoord2dv), GLFUNC_ALWAYS_REQUIRED(glTexCoord2fv), GLFUNC_ALWAYS_REQUIRED(glTexCoord2iv), GLFUNC_ALWAYS_REQUIRED(glTexCoord2sv), GLFUNC_ALWAYS_REQUIRED(glTexCoord3dv), GLFUNC_ALWAYS_REQUIRED(glTexCoord3fv), GLFUNC_ALWAYS_REQUIRED(glTexCoord3iv), GLFUNC_ALWAYS_REQUIRED(glTexCoord3sv), GLFUNC_ALWAYS_REQUIRED(glTexCoord4dv), GLFUNC_ALWAYS_REQUIRED(glTexCoord4fv), GLFUNC_ALWAYS_REQUIRED(glTexCoord4iv), GLFUNC_ALWAYS_REQUIRED(glTexCoord4sv), GLFUNC_ALWAYS_REQUIRED(glRasterPos2d), GLFUNC_ALWAYS_REQUIRED(glRasterPos2f), GLFUNC_ALWAYS_REQUIRED(glRasterPos2i), GLFUNC_ALWAYS_REQUIRED(glRasterPos2s), GLFUNC_ALWAYS_REQUIRED(glRasterPos3d), GLFUNC_ALWAYS_REQUIRED(glRasterPos3f), GLFUNC_ALWAYS_REQUIRED(glRasterPos3i), GLFUNC_ALWAYS_REQUIRED(glRasterPos3s), GLFUNC_ALWAYS_REQUIRED(glRasterPos4d), GLFUNC_ALWAYS_REQUIRED(glRasterPos4f), GLFUNC_ALWAYS_REQUIRED(glRasterPos4i), GLFUNC_ALWAYS_REQUIRED(glRasterPos4s), GLFUNC_ALWAYS_REQUIRED(glRasterPos2dv), GLFUNC_ALWAYS_REQUIRED(glRasterPos2fv), GLFUNC_ALWAYS_REQUIRED(glRasterPos2iv), GLFUNC_ALWAYS_REQUIRED(glRasterPos2sv), GLFUNC_ALWAYS_REQUIRED(glRasterPos3dv), GLFUNC_ALWAYS_REQUIRED(glRasterPos3fv), GLFUNC_ALWAYS_REQUIRED(glRasterPos3iv), GLFUNC_ALWAYS_REQUIRED(glRasterPos3sv), GLFUNC_ALWAYS_REQUIRED(glRasterPos4dv), GLFUNC_ALWAYS_REQUIRED(glRasterPos4fv), GLFUNC_ALWAYS_REQUIRED(glRasterPos4iv), GLFUNC_ALWAYS_REQUIRED(glRasterPos4sv), GLFUNC_ALWAYS_REQUIRED(glRectd), GLFUNC_ALWAYS_REQUIRED(glRectf), GLFUNC_ALWAYS_REQUIRED(glRecti), GLFUNC_ALWAYS_REQUIRED(glRects), GLFUNC_ALWAYS_REQUIRED(glRectdv), GLFUNC_ALWAYS_REQUIRED(glRectfv), GLFUNC_ALWAYS_REQUIRED(glRectiv), GLFUNC_ALWAYS_REQUIRED(glRectsv), GLFUNC_ALWAYS_REQUIRED(glVertexPointer), GLFUNC_ALWAYS_REQUIRED(glNormalPointer), GLFUNC_ALWAYS_REQUIRED(glColorPointer), GLFUNC_ALWAYS_REQUIRED(glIndexPointer), GLFUNC_ALWAYS_REQUIRED(glTexCoordPointer), GLFUNC_ALWAYS_REQUIRED(glEdgeFlagPointer), GLFUNC_ALWAYS_REQUIRED(glArrayElement), GLFUNC_ALWAYS_REQUIRED(glInterleavedArrays), GLFUNC_ALWAYS_REQUIRED(glShadeModel), GLFUNC_ALWAYS_REQUIRED(glLightf), GLFUNC_ALWAYS_REQUIRED(glLighti), GLFUNC_ALWAYS_REQUIRED(glLightfv), GLFUNC_ALWAYS_REQUIRED(glLightiv), GLFUNC_ALWAYS_REQUIRED(glGetLightfv), GLFUNC_ALWAYS_REQUIRED(glGetLightiv), GLFUNC_ALWAYS_REQUIRED(glLightModelf), GLFUNC_ALWAYS_REQUIRED(glLightModeli), GLFUNC_ALWAYS_REQUIRED(glLightModelfv), GLFUNC_ALWAYS_REQUIRED(glLightModeliv), GLFUNC_ALWAYS_REQUIRED(glMaterialf), GLFUNC_ALWAYS_REQUIRED(glMateriali), GLFUNC_ALWAYS_REQUIRED(glMaterialfv), GLFUNC_ALWAYS_REQUIRED(glMaterialiv), GLFUNC_ALWAYS_REQUIRED(glGetMaterialfv), GLFUNC_ALWAYS_REQUIRED(glGetMaterialiv), GLFUNC_ALWAYS_REQUIRED(glColorMaterial), GLFUNC_ALWAYS_REQUIRED(glPixelZoom), GLFUNC_ALWAYS_REQUIRED(glPixelStoref), GLFUNC_ALWAYS_REQUIRED(glPixelTransferf), GLFUNC_ALWAYS_REQUIRED(glPixelTransferi), GLFUNC_ALWAYS_REQUIRED(glPixelMapfv), GLFUNC_ALWAYS_REQUIRED(glPixelMapuiv), GLFUNC_ALWAYS_REQUIRED(glPixelMapusv), GLFUNC_ALWAYS_REQUIRED(glGetPixelMapfv), GLFUNC_ALWAYS_REQUIRED(glGetPixelMapuiv), GLFUNC_ALWAYS_REQUIRED(glGetPixelMapusv), GLFUNC_ALWAYS_REQUIRED(glBitmap), GLFUNC_ALWAYS_REQUIRED(glDrawPixels), GLFUNC_ALWAYS_REQUIRED(glCopyPixels), GLFUNC_ALWAYS_REQUIRED(glTexGend), GLFUNC_ALWAYS_REQUIRED(glTexGenf), GLFUNC_ALWAYS_REQUIRED(glTexGeni), GLFUNC_ALWAYS_REQUIRED(glTexGendv), GLFUNC_ALWAYS_REQUIRED(glTexGenfv), GLFUNC_ALWAYS_REQUIRED(glTexGeniv), GLFUNC_ALWAYS_REQUIRED(glGetTexGendv), GLFUNC_ALWAYS_REQUIRED(glGetTexGenfv), GLFUNC_ALWAYS_REQUIRED(glGetTexGeniv), GLFUNC_ALWAYS_REQUIRED(glTexEnvf), GLFUNC_ALWAYS_REQUIRED(glTexEnvi), GLFUNC_ALWAYS_REQUIRED(glTexEnvfv), GLFUNC_ALWAYS_REQUIRED(glTexEnviv), GLFUNC_ALWAYS_REQUIRED(glGetTexEnvfv), GLFUNC_ALWAYS_REQUIRED(glGetTexEnviv), GLFUNC_ALWAYS_REQUIRED(glGetTexLevelParameterfv), GLFUNC_ALWAYS_REQUIRED(glGetTexLevelParameteriv), GLFUNC_ALWAYS_REQUIRED(glTexImage1D), GLFUNC_ALWAYS_REQUIRED(glGetTexImage), GLFUNC_ALWAYS_REQUIRED(glPrioritizeTextures), GLFUNC_ALWAYS_REQUIRED(glAreTexturesResident), GLFUNC_ALWAYS_REQUIRED(glTexSubImage1D), GLFUNC_ALWAYS_REQUIRED(glCopyTexImage1D), GLFUNC_ALWAYS_REQUIRED(glCopyTexSubImage1D), GLFUNC_ALWAYS_REQUIRED(glMap1d), GLFUNC_ALWAYS_REQUIRED(glMap1f), GLFUNC_ALWAYS_REQUIRED(glMap2d), GLFUNC_ALWAYS_REQUIRED(glMap2f), GLFUNC_ALWAYS_REQUIRED(glGetMapdv), GLFUNC_ALWAYS_REQUIRED(glGetMapfv), GLFUNC_ALWAYS_REQUIRED(glGetMapiv), GLFUNC_ALWAYS_REQUIRED(glEvalCoord1d), GLFUNC_ALWAYS_REQUIRED(glEvalCoord1f), GLFUNC_ALWAYS_REQUIRED(glEvalCoord1dv), GLFUNC_ALWAYS_REQUIRED(glEvalCoord1fv), GLFUNC_ALWAYS_REQUIRED(glEvalCoord2d), GLFUNC_ALWAYS_REQUIRED(glEvalCoord2f), GLFUNC_ALWAYS_REQUIRED(glEvalCoord2dv), GLFUNC_ALWAYS_REQUIRED(glEvalCoord2fv), GLFUNC_ALWAYS_REQUIRED(glMapGrid1d), GLFUNC_ALWAYS_REQUIRED(glMapGrid1f), GLFUNC_ALWAYS_REQUIRED(glMapGrid2d), GLFUNC_ALWAYS_REQUIRED(glMapGrid2f), GLFUNC_ALWAYS_REQUIRED(glEvalPoint1), GLFUNC_ALWAYS_REQUIRED(glEvalPoint2), GLFUNC_ALWAYS_REQUIRED(glEvalMesh1), GLFUNC_ALWAYS_REQUIRED(glEvalMesh2), GLFUNC_ALWAYS_REQUIRED(glFogf), GLFUNC_ALWAYS_REQUIRED(glFogi), GLFUNC_ALWAYS_REQUIRED(glFogfv), GLFUNC_ALWAYS_REQUIRED(glFogiv), GLFUNC_ALWAYS_REQUIRED(glFeedbackBuffer), GLFUNC_ALWAYS_REQUIRED(glPassThrough), GLFUNC_ALWAYS_REQUIRED(glSelectBuffer), GLFUNC_ALWAYS_REQUIRED(glInitNames), GLFUNC_ALWAYS_REQUIRED(glLoadName), GLFUNC_ALWAYS_REQUIRED(glPushName), GLFUNC_ALWAYS_REQUIRED(glPopName), GL_ES_FUNC_ALWAYS_REQUIRED(glTexImage2D), GL_ES_FUNC_ALWAYS_REQUIRED(glClearColor), GL_ES_FUNC_ALWAYS_REQUIRED(glClear), GL_ES_FUNC_ALWAYS_REQUIRED(glColorMask), GL_ES_FUNC_ALWAYS_REQUIRED(glBlendFunc), GL_ES_FUNC_ALWAYS_REQUIRED(glCullFace), GL_ES_FUNC_ALWAYS_REQUIRED(glFrontFace), GL_ES_FUNC_ALWAYS_REQUIRED(glLineWidth), GL_ES_FUNC_ALWAYS_REQUIRED(glPolygonOffset), GL_ES_FUNC_ALWAYS_REQUIRED(glScissor), GL_ES_FUNC_ALWAYS_REQUIRED(glEnable), GL_ES_FUNC_ALWAYS_REQUIRED(glDisable), GL_ES_FUNC_ALWAYS_REQUIRED(glIsEnabled), GL_ES_FUNC_ALWAYS_REQUIRED(glGetBooleanv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetFloatv), GL_ES_FUNC_ALWAYS_REQUIRED(glFinish), GL_ES_FUNC_ALWAYS_REQUIRED(glFlush), GL_ES_FUNC_ALWAYS_REQUIRED(glHint), GL_ES_FUNC_ALWAYS_REQUIRED(glDepthFunc), GL_ES_FUNC_ALWAYS_REQUIRED(glDepthMask), GL_ES_FUNC_ALWAYS_REQUIRED(glViewport), GL_ES_FUNC_ALWAYS_REQUIRED(glDrawArrays), GL_ES_FUNC_ALWAYS_REQUIRED(glDrawElements), GL_ES_FUNC_ALWAYS_REQUIRED(glPixelStorei), GL_ES_FUNC_ALWAYS_REQUIRED(glReadPixels), GL_ES_FUNC_ALWAYS_REQUIRED(glStencilFunc), GL_ES_FUNC_ALWAYS_REQUIRED(glStencilMask), GL_ES_FUNC_ALWAYS_REQUIRED(glStencilOp), GL_ES_FUNC_ALWAYS_REQUIRED(glClearStencil), GL_ES_FUNC_ALWAYS_REQUIRED(glTexParameterf), GL_ES_FUNC_ALWAYS_REQUIRED(glTexParameteri), GL_ES_FUNC_ALWAYS_REQUIRED(glTexParameterfv), GL_ES_FUNC_ALWAYS_REQUIRED(glTexParameteriv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetTexParameterfv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetTexParameteriv), GL_ES_FUNC_ALWAYS_REQUIRED(glGenTextures), GL_ES_FUNC_ALWAYS_REQUIRED(glDeleteTextures), GL_ES_FUNC_ALWAYS_REQUIRED(glBindTexture), GL_ES_FUNC_ALWAYS_REQUIRED(glIsTexture), GL_ES_FUNC_ALWAYS_REQUIRED(glTexSubImage2D), GL_ES_FUNC_ALWAYS_REQUIRED(glCopyTexImage2D), GL_ES_FUNC_ALWAYS_REQUIRED(glCopyTexSubImage2D), GL_ES3_FUNC_ALWAYS_REQUIRED(glReadBuffer), GL_ES32_FUNC_ALWAYS_REQUIRED(glGetPointerv), // gl_1_2 GL_ES3_FUNC_ALWAYS_REQUIRED(glCopyTexSubImage3D), GL_ES3_FUNC_ALWAYS_REQUIRED(glDrawRangeElements), GL_ES3_FUNC_ALWAYS_REQUIRED(glTexImage3D), GL_ES3_FUNC_ALWAYS_REQUIRED(glTexSubImage3D), // gl_1_3 GLFUNC_ALWAYS_REQUIRED(glClientActiveTexture), GLFUNC_ALWAYS_REQUIRED(glCompressedTexImage1D), GLFUNC_ALWAYS_REQUIRED(glCompressedTexSubImage1D), GLFUNC_ALWAYS_REQUIRED(glGetCompressedTexImage), GLFUNC_ALWAYS_REQUIRED(glLoadTransposeMatrixd), GLFUNC_ALWAYS_REQUIRED(glLoadTransposeMatrixf), GLFUNC_ALWAYS_REQUIRED(glMultTransposeMatrixd), GLFUNC_ALWAYS_REQUIRED(glMultTransposeMatrixf), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1d), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1dv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1f), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1fv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1i), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1iv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1s), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord1sv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2d), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2dv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2f), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2fv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2i), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2iv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2s), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord2sv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3d), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3dv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3f), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3fv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3i), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3iv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3s), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord3sv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4d), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4dv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4f), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4fv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4i), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4iv), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4s), GLFUNC_ALWAYS_REQUIRED(glMultiTexCoord4sv), GL_ES_FUNC_ALWAYS_REQUIRED(glSampleCoverage), GL_ES_FUNC_ALWAYS_REQUIRED(glActiveTexture), GL_ES_FUNC_ALWAYS_REQUIRED(glCompressedTexImage2D), GL_ES_FUNC_ALWAYS_REQUIRED(glCompressedTexSubImage2D), GL_ES3_FUNC_ALWAYS_REQUIRED(glCompressedTexImage3D), GL_ES3_FUNC_ALWAYS_REQUIRED(glCompressedTexSubImage3D), // gl_1_4 GLFUNC_ALWAYS_REQUIRED(glFogCoordPointer), GLFUNC_ALWAYS_REQUIRED(glFogCoordd), GLFUNC_ALWAYS_REQUIRED(glFogCoorddv), GLFUNC_ALWAYS_REQUIRED(glFogCoordf), GLFUNC_ALWAYS_REQUIRED(glFogCoordfv), GLFUNC_ALWAYS_REQUIRED(glMultiDrawArrays), GLFUNC_ALWAYS_REQUIRED(glMultiDrawElements), GLFUNC_ALWAYS_REQUIRED(glPointParameterf), GLFUNC_ALWAYS_REQUIRED(glPointParameterfv), GLFUNC_ALWAYS_REQUIRED(glPointParameteri), GLFUNC_ALWAYS_REQUIRED(glPointParameteriv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3b), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3bv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3d), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3dv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3f), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3fv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3i), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3iv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3s), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3sv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3ub), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3ubv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3ui), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3uiv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3us), GLFUNC_ALWAYS_REQUIRED(glSecondaryColor3usv), GLFUNC_ALWAYS_REQUIRED(glSecondaryColorPointer), GLFUNC_ALWAYS_REQUIRED(glWindowPos2d), GLFUNC_ALWAYS_REQUIRED(glWindowPos2dv), GLFUNC_ALWAYS_REQUIRED(glWindowPos2f), GLFUNC_ALWAYS_REQUIRED(glWindowPos2fv), GLFUNC_ALWAYS_REQUIRED(glWindowPos2i), GLFUNC_ALWAYS_REQUIRED(glWindowPos2iv), GLFUNC_ALWAYS_REQUIRED(glWindowPos2s), GLFUNC_ALWAYS_REQUIRED(glWindowPos2sv), GLFUNC_ALWAYS_REQUIRED(glWindowPos3d), GLFUNC_ALWAYS_REQUIRED(glWindowPos3dv), GLFUNC_ALWAYS_REQUIRED(glWindowPos3f), GLFUNC_ALWAYS_REQUIRED(glWindowPos3fv), GLFUNC_ALWAYS_REQUIRED(glWindowPos3i), GLFUNC_ALWAYS_REQUIRED(glWindowPos3iv), GLFUNC_ALWAYS_REQUIRED(glWindowPos3s), GLFUNC_ALWAYS_REQUIRED(glWindowPos3sv), GL_ES_FUNC_ALWAYS_REQUIRED(glBlendColor), GL_ES_FUNC_ALWAYS_REQUIRED(glBlendEquation), GL_ES_FUNC_ALWAYS_REQUIRED(glBlendFuncSeparate), // gl_1_5 GLFUNC_ALWAYS_REQUIRED(glGetBufferSubData), GLFUNC_ALWAYS_REQUIRED(glGetQueryObjectiv), GLFUNC_ALWAYS_REQUIRED(glMapBuffer), GL_ES_FUNC_ALWAYS_REQUIRED(glBindBuffer), GL_ES_FUNC_ALWAYS_REQUIRED(glBufferData), GL_ES_FUNC_ALWAYS_REQUIRED(glBufferSubData), GL_ES_FUNC_ALWAYS_REQUIRED(glDeleteBuffers), GL_ES_FUNC_ALWAYS_REQUIRED(glGenBuffers), GL_ES_FUNC_ALWAYS_REQUIRED(glGetBufferParameteriv), GL_ES_FUNC_ALWAYS_REQUIRED(glIsBuffer), GL_ES3_FUNC_ALWAYS_REQUIRED(glBeginQuery), GL_ES3_FUNC_ALWAYS_REQUIRED(glDeleteQueries), GL_ES3_FUNC_ALWAYS_REQUIRED(glEndQuery), GL_ES3_FUNC_ALWAYS_REQUIRED(glGenQueries), GL_ES3_FUNC_ALWAYS_REQUIRED(glIsQuery), GL_ES3_FUNC_ALWAYS_REQUIRED(glGetQueryiv), GL_ES3_FUNC_ALWAYS_REQUIRED(glGetQueryObjectuiv), GL_ES3_FUNC_ALWAYS_REQUIRED(glGetBufferPointerv), GL_ES3_FUNC_ALWAYS_REQUIRED(glUnmapBuffer), // gl_2_0 GLFUNC_ALWAYS_REQUIRED(glGetVertexAttribdv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1d), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1dv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1s), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib1sv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2d), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2dv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2s), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib2sv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3d), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3dv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3s), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib3sv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nbv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Niv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nsv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nub), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nubv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nuiv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4Nusv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4bv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4d), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4dv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4iv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4s), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4sv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4ubv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4uiv), GLFUNC_ALWAYS_REQUIRED(glVertexAttrib4usv), GL_ES_FUNC_ALWAYS_REQUIRED(glAttachShader), GL_ES_FUNC_ALWAYS_REQUIRED(glBindAttribLocation), GL_ES_FUNC_ALWAYS_REQUIRED(glBlendEquationSeparate), GL_ES_FUNC_ALWAYS_REQUIRED(glCompileShader), GL_ES_FUNC_ALWAYS_REQUIRED(glCreateProgram), GL_ES_FUNC_ALWAYS_REQUIRED(glCreateShader), GL_ES_FUNC_ALWAYS_REQUIRED(glDeleteProgram), GL_ES_FUNC_ALWAYS_REQUIRED(glDeleteShader), GL_ES_FUNC_ALWAYS_REQUIRED(glDetachShader), GL_ES_FUNC_ALWAYS_REQUIRED(glDisableVertexAttribArray), GL_ES_FUNC_ALWAYS_REQUIRED(glEnableVertexAttribArray), GL_ES_FUNC_ALWAYS_REQUIRED(glGetActiveAttrib), GL_ES_FUNC_ALWAYS_REQUIRED(glGetActiveUniform), GL_ES_FUNC_ALWAYS_REQUIRED(glGetAttachedShaders), GL_ES_FUNC_ALWAYS_REQUIRED(glGetAttribLocation), GL_ES_FUNC_ALWAYS_REQUIRED(glGetProgramInfoLog), GL_ES_FUNC_ALWAYS_REQUIRED(glGetProgramiv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetShaderInfoLog), GL_ES_FUNC_ALWAYS_REQUIRED(glGetShaderSource), GL_ES_FUNC_ALWAYS_REQUIRED(glGetShaderiv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetUniformLocation), GL_ES_FUNC_ALWAYS_REQUIRED(glGetUniformfv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetUniformiv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetVertexAttribPointerv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetVertexAttribfv), GL_ES_FUNC_ALWAYS_REQUIRED(glGetVertexAttribiv), GL_ES_FUNC_ALWAYS_REQUIRED(glIsProgram), GL_ES_FUNC_ALWAYS_REQUIRED(glIsShader), GL_ES_FUNC_ALWAYS_REQUIRED(glLinkProgram), GL_ES_FUNC_ALWAYS_REQUIRED(glShaderSource), GL_ES_FUNC_ALWAYS_REQUIRED(glStencilFuncSeparate), GL_ES_FUNC_ALWAYS_REQUIRED(glStencilMaskSeparate), GL_ES_FUNC_ALWAYS_REQUIRED(glStencilOpSeparate), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform1f), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform1fv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform1i), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform1iv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform2f), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform2fv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform2i), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform2iv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform3f), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform3fv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform3i), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform3iv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform4f), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform4fv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform4i), GL_ES_FUNC_ALWAYS_REQUIRED(glUniform4iv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniformMatrix2fv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniformMatrix3fv), GL_ES_FUNC_ALWAYS_REQUIRED(glUniformMatrix4fv), GL_ES_FUNC_ALWAYS_REQUIRED(glUseProgram), GL_ES_FUNC_ALWAYS_REQUIRED(glValidateProgram), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttrib1f), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttrib1fv), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttrib2f), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttrib2fv), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttrib3f), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttrib3fv), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttrib4f), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttrib4fv), GL_ES_FUNC_ALWAYS_REQUIRED(glVertexAttribPointer), GL_ES3_FUNC_ALWAYS_REQUIRED(glDrawBuffers), // gl_2_1 GLFUNC_ALWAYS_REQUIRED(glUniformMatrix2x3fv), GLFUNC_ALWAYS_REQUIRED(glUniformMatrix2x4fv), GLFUNC_ALWAYS_REQUIRED(glUniformMatrix3x2fv), GLFUNC_ALWAYS_REQUIRED(glUniformMatrix3x4fv), GLFUNC_ALWAYS_REQUIRED(glUniformMatrix4x2fv), GLFUNC_ALWAYS_REQUIRED(glUniformMatrix4x3fv), // gl_3_0 GLFUNC_REQUIRES(glBeginConditionalRender, "VERSION_3_0"), GLFUNC_REQUIRES(glBindFragDataLocation, "VERSION_3_0"), GLFUNC_REQUIRES(glClampColor, "VERSION_3_0"), GLFUNC_REQUIRES(glEndConditionalRender, "VERSION_3_0"), GLFUNC_REQUIRES(glGetBooleani_v, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI1i, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI1iv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI1ui, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI1uiv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI2i, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI2iv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI2ui, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI2uiv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI3i, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI3iv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI3ui, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI3uiv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI4bv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI4sv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI4ubv, "VERSION_3_0"), GLFUNC_REQUIRES(glVertexAttribI4usv, "VERSION_3_0"), GLFUNC_REQUIRES(glBeginTransformFeedback, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glClearBufferfi, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glClearBufferfv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glClearBufferiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glClearBufferuiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glEndTransformFeedback, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetFragDataLocation, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetStringi, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetTransformFeedbackVarying, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetUniformuiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetVertexAttribIiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetVertexAttribIuiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glTransformFeedbackVaryings, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform1ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform1uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform2ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform2uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform3ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform3uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform4ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniform4uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribI4i, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribI4iv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribI4ui, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribI4uiv, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glVertexAttribIPointer, "VERSION_3_0 |VERSION_GLES_3"), GLFUNC_REQUIRES(glColorMaski, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glDisablei, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glEnablei, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glGetTexParameterIiv, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glGetTexParameterIuiv, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glIsEnabledi, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glTexParameterIiv, "VERSION_3_0 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glTexParameterIuiv, "VERSION_3_0 |VERSION_GLES_3_2"), // gl_3_1 GLFUNC_REQUIRES(glPrimitiveRestartIndex, "VERSION_3_1"), GLFUNC_REQUIRES(glDrawArraysInstanced, "VERSION_3_1 |VERSION_GLES_3"), GLFUNC_REQUIRES(glDrawElementsInstanced, "VERSION_3_1 |VERSION_GLES_3"), GLFUNC_REQUIRES(glTexBuffer, "VERSION_3_1 |VERSION_GLES_3_2"), // gl_3_2 GLFUNC_REQUIRES(glGetBufferParameteri64v, "VERSION_3_2 |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetInteger64i_v, "VERSION_3_2 |VERSION_GLES_3"), GLFUNC_REQUIRES(glFramebufferTexture, "VERSION_3_2 |VERSION_GLES_3_2"), // gl_4_2 GLFUNC_REQUIRES(glDrawArraysInstancedBaseInstance, "VERSION_4_2"), GLFUNC_REQUIRES(glDrawElementsInstancedBaseInstance, "VERSION_4_2"), GLFUNC_REQUIRES(glDrawElementsInstancedBaseVertexBaseInstance, "VERSION_4_2"), GLFUNC_REQUIRES(glGetInternalformativ, "VERSION_4_2"), GLFUNC_REQUIRES(glGetActiveAtomicCounterBufferiv, "VERSION_4_2"), GLFUNC_REQUIRES(glBindImageTexture, "VERSION_4_2"), GLFUNC_REQUIRES(glMemoryBarrier, "VERSION_4_2"), GLFUNC_REQUIRES(glTexStorage1D, "VERSION_4_2"), GLFUNC_REQUIRES(glTexStorage2D, "VERSION_4_2"), GLFUNC_REQUIRES(glTexStorage3D, "VERSION_4_2"), GLFUNC_REQUIRES(glDrawTransformFeedbackInstanced, "VERSION_4_2"), GLFUNC_REQUIRES(glDrawTransformFeedbackStreamInstanced, "VERSION_4_2"), // gl_4_3 GLFUNC_REQUIRES(glClearBufferData, "VERSION_4_3"), GLFUNC_REQUIRES(glClearBufferSubData, "VERSION_4_3"), GLFUNC_REQUIRES(glDispatchCompute, "VERSION_4_3"), GLFUNC_REQUIRES(glDispatchComputeIndirect, "VERSION_4_3"), GLFUNC_REQUIRES(glCopyImageSubData, "VERSION_4_3"), GLFUNC_REQUIRES(glFramebufferParameteri, "VERSION_4_3"), GLFUNC_REQUIRES(glGetFramebufferParameteriv, "VERSION_4_3"), GLFUNC_REQUIRES(glGetInternalformati64v, "VERSION_4_3"), GLFUNC_REQUIRES(glInvalidateTexSubImage, "VERSION_4_3"), GLFUNC_REQUIRES(glInvalidateTexImage, "VERSION_4_3"), GLFUNC_REQUIRES(glInvalidateBufferSubData, "VERSION_4_3"), GLFUNC_REQUIRES(glInvalidateBufferData, "VERSION_4_3"), GLFUNC_REQUIRES(glInvalidateFramebuffer, "VERSION_4_3"), GLFUNC_REQUIRES(glInvalidateSubFramebuffer, "VERSION_4_3"), GLFUNC_REQUIRES(glMultiDrawArraysIndirect, "VERSION_4_3"), GLFUNC_REQUIRES(glMultiDrawElementsIndirect, "VERSION_4_3"), GLFUNC_REQUIRES(glGetProgramInterfaceiv, "VERSION_4_3"), GLFUNC_REQUIRES(glGetProgramResourceIndex, "VERSION_4_3"), GLFUNC_REQUIRES(glGetProgramResourceName, "VERSION_4_3"), GLFUNC_REQUIRES(glGetProgramResourceiv, "VERSION_4_3"), GLFUNC_REQUIRES(glGetProgramResourceLocation, "VERSION_4_3"), GLFUNC_REQUIRES(glGetProgramResourceLocationIndex, "VERSION_4_3"), GLFUNC_REQUIRES(glShaderStorageBlockBinding, "VERSION_4_3"), GLFUNC_REQUIRES(glTexBufferRange, "VERSION_4_3"), GLFUNC_REQUIRES(glTexStorage2DMultisample, "VERSION_4_3"), GLFUNC_REQUIRES(glTexStorage3DMultisample, "VERSION_4_3"), GLFUNC_REQUIRES(glTextureView, "VERSION_4_3"), GLFUNC_REQUIRES(glBindVertexBuffer, "VERSION_4_3"), GLFUNC_REQUIRES(glVertexAttribFormat, "VERSION_4_3"), GLFUNC_REQUIRES(glVertexAttribIFormat, "VERSION_4_3"), GLFUNC_REQUIRES(glVertexAttribLFormat, "VERSION_4_3"), GLFUNC_REQUIRES(glVertexAttribBinding, "VERSION_4_3"), GLFUNC_REQUIRES(glVertexBindingDivisor, "VERSION_4_3"), GLFUNC_REQUIRES(glDebugMessageControl, "VERSION_4_3"), GLFUNC_REQUIRES(glDebugMessageInsert, "VERSION_4_3"), GLFUNC_REQUIRES(glDebugMessageCallback, "VERSION_4_3"), GLFUNC_REQUIRES(glGetDebugMessageLog, "VERSION_4_3"), GLFUNC_REQUIRES(glPushDebugGroup, "VERSION_4_3"), GLFUNC_REQUIRES(glPopDebugGroup, "VERSION_4_3"), GLFUNC_REQUIRES(glObjectLabel, "VERSION_4_3"), GLFUNC_REQUIRES(glGetObjectLabel, "VERSION_4_3"), GLFUNC_REQUIRES(glObjectPtrLabel, "VERSION_4_3"), GLFUNC_REQUIRES(glGetObjectPtrLabel, "VERSION_4_3"), // gl_4_4 GLFUNC_REQUIRES(glBufferStorage, "VERSION_4_4"), GLFUNC_REQUIRES(glClearTexImage, "VERSION_4_4"), GLFUNC_REQUIRES(glClearTexSubImage, "VERSION_4_4"), GLFUNC_REQUIRES(glBindBuffersBase, "VERSION_4_4"), GLFUNC_REQUIRES(glBindBuffersRange, "VERSION_4_4"), GLFUNC_REQUIRES(glBindTextures, "VERSION_4_4"), GLFUNC_REQUIRES(glBindSamplers, "VERSION_4_4"), GLFUNC_REQUIRES(glBindImageTextures, "VERSION_4_4"), GLFUNC_REQUIRES(glBindVertexBuffers, "VERSION_4_4"), // gl_4_5 GLFUNC_REQUIRES(glClipControl, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateTransformFeedbacks, "VERSION_4_5"), GLFUNC_REQUIRES(glTransformFeedbackBufferBase, "VERSION_4_5"), GLFUNC_REQUIRES(glTransformFeedbackBufferRange, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTransformFeedbackiv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTransformFeedbacki_v, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTransformFeedbacki64_v, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateBuffers, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedBufferStorage, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedBufferData, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedBufferSubData, "VERSION_4_5"), GLFUNC_REQUIRES(glCopyNamedBufferSubData, "VERSION_4_5"), GLFUNC_REQUIRES(glClearNamedBufferData, "VERSION_4_5"), GLFUNC_REQUIRES(glClearNamedBufferSubData, "VERSION_4_5"), GLFUNC_REQUIRES(glMapNamedBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glMapNamedBufferRange, "VERSION_4_5"), GLFUNC_REQUIRES(glUnmapNamedBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glFlushMappedNamedBufferRange, "VERSION_4_5"), GLFUNC_REQUIRES(glGetNamedBufferParameteriv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetNamedBufferParameteri64v, "VERSION_4_5"), GLFUNC_REQUIRES(glGetNamedBufferPointerv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetNamedBufferSubData, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateFramebuffers, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedFramebufferRenderbuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedFramebufferParameteri, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedFramebufferTexture, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedFramebufferTextureLayer, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedFramebufferDrawBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedFramebufferDrawBuffers, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedFramebufferReadBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glInvalidateNamedFramebufferData, "VERSION_4_5"), GLFUNC_REQUIRES(glInvalidateNamedFramebufferSubData, "VERSION_4_5"), GLFUNC_REQUIRES(glClearNamedFramebufferiv, "VERSION_4_5"), GLFUNC_REQUIRES(glClearNamedFramebufferuiv, "VERSION_4_5"), GLFUNC_REQUIRES(glClearNamedFramebufferfv, "VERSION_4_5"), GLFUNC_REQUIRES(glClearNamedFramebufferfi, "VERSION_4_5"), GLFUNC_REQUIRES(glBlitNamedFramebuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glCheckNamedFramebufferStatus, "VERSION_4_5"), GLFUNC_REQUIRES(glGetNamedFramebufferParameteriv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetNamedFramebufferAttachmentParameteriv, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateRenderbuffers, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedRenderbufferStorage, "VERSION_4_5"), GLFUNC_REQUIRES(glNamedRenderbufferStorageMultisample, "VERSION_4_5"), GLFUNC_REQUIRES(glGetNamedRenderbufferParameteriv, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateTextures, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureBufferRange, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureStorage1D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureStorage2D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureStorage3D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureStorage2DMultisample, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureStorage3DMultisample, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureSubImage1D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureSubImage2D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureSubImage3D, "VERSION_4_5"), GLFUNC_REQUIRES(glCompressedTextureSubImage1D, "VERSION_4_5"), GLFUNC_REQUIRES(glCompressedTextureSubImage2D, "VERSION_4_5"), GLFUNC_REQUIRES(glCompressedTextureSubImage3D, "VERSION_4_5"), GLFUNC_REQUIRES(glCopyTextureSubImage1D, "VERSION_4_5"), GLFUNC_REQUIRES(glCopyTextureSubImage2D, "VERSION_4_5"), GLFUNC_REQUIRES(glCopyTextureSubImage3D, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureParameterf, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureParameterfv, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureParameteri, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureParameterIiv, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureParameterIuiv, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureParameteriv, "VERSION_4_5"), GLFUNC_REQUIRES(glGenerateTextureMipmap, "VERSION_4_5"), GLFUNC_REQUIRES(glBindTextureUnit, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureImage, "VERSION_4_5"), GLFUNC_REQUIRES(glGetCompressedTextureImage, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureLevelParameterfv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureLevelParameteriv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureParameterfv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureParameterIiv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureParameterIuiv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureParameteriv, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateVertexArrays, "VERSION_4_5"), GLFUNC_REQUIRES(glDisableVertexArrayAttrib, "VERSION_4_5"), GLFUNC_REQUIRES(glEnableVertexArrayAttrib, "VERSION_4_5"), GLFUNC_REQUIRES(glVertexArrayElementBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glVertexArrayVertexBuffer, "VERSION_4_5"), GLFUNC_REQUIRES(glVertexArrayVertexBuffers, "VERSION_4_5"), GLFUNC_REQUIRES(glVertexArrayAttribBinding, "VERSION_4_5"), GLFUNC_REQUIRES(glVertexArrayAttribFormat, "VERSION_4_5"), GLFUNC_REQUIRES(glVertexArrayAttribIFormat, "VERSION_4_5"), GLFUNC_REQUIRES(glVertexArrayAttribLFormat, "VERSION_4_5"), GLFUNC_REQUIRES(glVertexArrayBindingDivisor, "VERSION_4_5"), GLFUNC_REQUIRES(glGetVertexArrayiv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetVertexArrayIndexediv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetVertexArrayIndexed64iv, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateSamplers, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateProgramPipelines, "VERSION_4_5"), GLFUNC_REQUIRES(glCreateQueries, "VERSION_4_5"), GLFUNC_REQUIRES(glGetQueryBufferObjecti64v, "VERSION_4_5"), GLFUNC_REQUIRES(glGetQueryBufferObjectiv, "VERSION_4_5"), GLFUNC_REQUIRES(glGetQueryBufferObjectui64v, "VERSION_4_5"), GLFUNC_REQUIRES(glGetQueryBufferObjectuiv, "VERSION_4_5"), GLFUNC_REQUIRES(glMemoryBarrierByRegion, "VERSION_4_5"), GLFUNC_REQUIRES(glGetTextureSubImage, "VERSION_4_5"), GLFUNC_REQUIRES(glGetCompressedTextureSubImage, "VERSION_4_5"), GLFUNC_REQUIRES(glGetGraphicsResetStatus, "VERSION_4_5"), GLFUNC_REQUIRES(glReadnPixels, "VERSION_4_5"), GLFUNC_REQUIRES(glTextureBarrier, "VERSION_4_5"), // AMD's video driver is trash and doesn't expose these function pointers // Remove them for now until they learn how to implement the spec properly. // GLFUNC_REQUIRES(glGetnCompressedTexImage, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnTexImage, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnUniformdv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnUniformfv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnUniformiv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnUniformuiv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnMapdv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnMapfv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnMapiv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnPixelMapfv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnPixelMapuiv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnPixelMapusv, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnPolygonStipple, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnColorTable, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnConvolutionFilter, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnSeparableFilter, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnHistogram, "VERSION_4_5"), // GLFUNC_REQUIRES(glGetnMinmax, "VERSION_4_5"), // ARB_uniform_buffer_object GLFUNC_REQUIRES(glGetActiveUniformName, "GL_ARB_uniform_buffer_object"), GLFUNC_REQUIRES(glBindBufferBase, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glBindBufferRange, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetActiveUniformBlockName, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetActiveUniformBlockiv, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetActiveUniformsiv, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetIntegeri_v, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetUniformBlockIndex, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetUniformIndices, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glUniformBlockBinding, "GL_ARB_uniform_buffer_object |VERSION_GLES_3"), // ARB_sampler_objects GLFUNC_REQUIRES(glBindSampler, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glDeleteSamplers, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glGenSamplers, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetSamplerParameterfv, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetSamplerParameteriv, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glIsSampler, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glSamplerParameterf, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glSamplerParameterfv, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glSamplerParameteri, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glSamplerParameteriv, "GL_ARB_sampler_objects |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetSamplerParameterIiv, "GL_ARB_sampler_objects |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glGetSamplerParameterIuiv, "GL_ARB_sampler_objects |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glSamplerParameterIiv, "GL_ARB_sampler_objects |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glSamplerParameterIuiv, "GL_ARB_sampler_objects |VERSION_GLES_3_2"), // ARB_map_buffer_range GLFUNC_REQUIRES(glFlushMappedBufferRange, "GL_ARB_map_buffer_range |VERSION_GLES_3"), GLFUNC_REQUIRES(glMapBufferRange, "GL_ARB_map_buffer_range |VERSION_GLES_3"), // ARB_vertex_array_object GLFUNC_REQUIRES(glBindVertexArray, "GL_ARB_vertex_array_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glDeleteVertexArrays, "GL_ARB_vertex_array_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glGenVertexArrays, "GL_ARB_vertex_array_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glIsVertexArray, "GL_ARB_vertex_array_object |VERSION_GLES_3"), // APPLE_vertex_array_object GLFUNC_SUFFIX(glBindVertexArray, APPLE, "GL_APPLE_vertex_array_object !GL_ARB_vertex_array_object"), GLFUNC_SUFFIX(glDeleteVertexArrays, APPLE, "GL_APPLE_vertex_array_object !GL_ARB_vertex_array_object"), GLFUNC_SUFFIX(glGenVertexArrays, APPLE, "GL_APPLE_vertex_array_object !GL_ARB_vertex_array_object"), GLFUNC_SUFFIX(glIsVertexArray, APPLE, "GL_APPLE_vertex_array_object !GL_ARB_vertex_array_object"), // ARB_framebuffer_object GLFUNC_REQUIRES(glFramebufferTexture1D, "GL_ARB_framebuffer_object"), GLFUNC_REQUIRES(glFramebufferTexture3D, "GL_ARB_framebuffer_object"), GLFUNC_REQUIRES(glBindFramebuffer, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glBindRenderbuffer, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glBlitFramebuffer, "GL_ARB_framebuffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glCheckFramebufferStatus, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glDeleteFramebuffers, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glDeleteRenderbuffers, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glFramebufferRenderbuffer, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glFramebufferTexture2D, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glFramebufferTextureLayer, "GL_ARB_framebuffer_object |VERSION_GLES_3"), GLFUNC_REQUIRES(glGenFramebuffers, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glGenRenderbuffers, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glGenerateMipmap, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glGetFramebufferAttachmentParameteriv, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glGetRenderbufferParameteriv, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glIsFramebuffer, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glIsRenderbuffer, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glRenderbufferStorage, "GL_ARB_framebuffer_object |VERSION_GLES_2"), GLFUNC_REQUIRES(glRenderbufferStorageMultisample, "GL_ARB_framebuffer_object |VERSION_GLES_3"), // ARB_get_program_binary GLFUNC_REQUIRES(glGetProgramBinary, "GL_ARB_get_program_binary |VERSION_GLES_3"), GLFUNC_REQUIRES(glProgramBinary, "GL_ARB_get_program_binary |VERSION_GLES_3"), GLFUNC_REQUIRES(glProgramParameteri, "GL_ARB_get_program_binary |VERSION_GLES_3"), // ARB_sync GLFUNC_REQUIRES(glClientWaitSync, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glDeleteSync, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glFenceSync, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetInteger64v, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glGetSynciv, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glIsSync, "GL_ARB_sync |VERSION_GLES_3"), GLFUNC_REQUIRES(glWaitSync, "GL_ARB_sync |VERSION_GLES_3"), // ARB_texture_multisample GLFUNC_REQUIRES(glTexImage2DMultisample, "GL_ARB_texture_multisample"), GLFUNC_REQUIRES(glTexImage3DMultisample, "GL_ARB_texture_multisample"), GLFUNC_REQUIRES(glGetMultisamplefv, "GL_ARB_texture_multisample"), GLFUNC_REQUIRES(glSampleMaski, "GL_ARB_texture_multisample"), // ARB_texture_storage_multisample GLFUNC_REQUIRES(glTexStorage2DMultisample, "GL_ARB_texture_storage_multisample !VERSION_4_3 |VERSION_GLES_3_1"), GLFUNC_REQUIRES(glTexStorage3DMultisample, "GL_ARB_texture_storage_multisample !VERSION_4_3 |VERSION_GLES_3_2"), GLFUNC_SUFFIX(glTexStorage3DMultisample, OES, "GL_OES_texture_storage_multisample_2d_array !VERSION_GLES_3_2"), // ARB_ES2_compatibility GLFUNC_REQUIRES(glClearDepthf, "GL_ARB_ES2_compatibility |VERSION_GLES_2"), GLFUNC_REQUIRES(glDepthRangef, "GL_ARB_ES2_compatibility |VERSION_GLES_2"), GLFUNC_REQUIRES(glGetShaderPrecisionFormat, "GL_ARB_ES2_compatibility |VERSION_GLES_2"), GLFUNC_REQUIRES(glReleaseShaderCompiler, "GL_ARB_ES2_compatibility |VERSION_GLES_2"), GLFUNC_REQUIRES(glShaderBinary, "GL_ARB_ES2_compatibility |VERSION_GLES_2"), // NV_primitive_restart GLFUNC_REQUIRES(glPrimitiveRestartIndexNV, "GL_NV_primitive_restart"), GLFUNC_REQUIRES(glPrimitiveRestartNV, "GL_NV_primitive_restart"), // ARB_blend_func_extended GLFUNC_REQUIRES(glBindFragDataLocationIndexed, "GL_ARB_blend_func_extended"), GLFUNC_REQUIRES(glGetFragDataIndex, "GL_ARB_blend_func_extended"), // ARB_viewport_array GLFUNC_REQUIRES(glDepthRangeArrayv, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glDepthRangeIndexed, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glGetDoublei_v, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glGetFloati_v, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glScissorArrayv, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glScissorIndexed, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glScissorIndexedv, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glViewportArrayv, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glViewportIndexedf, "GL_ARB_viewport_array"), GLFUNC_REQUIRES(glViewportIndexedfv, "GL_ARB_viewport_array"), // ARB_draw_elements_base_vertex GLFUNC_REQUIRES(glDrawElementsBaseVertex, "GL_ARB_draw_elements_base_vertex |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glDrawElementsInstancedBaseVertex, "GL_ARB_draw_elements_base_vertex |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glDrawRangeElementsBaseVertex, "GL_ARB_draw_elements_base_vertex |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glMultiDrawElementsBaseVertex, "GL_ARB_draw_elements_base_vertex"), // OES_draw_elements_base_vertex GLFUNC_SUFFIX(glDrawElementsBaseVertex, OES, "GL_OES_draw_elements_base_vertex !VERSION_GLES_3_2"), GLFUNC_SUFFIX(glDrawElementsInstancedBaseVertex, OES, "GL_OES_draw_elements_base_vertex VERSION_GLES_3 !VERSION_GLES_3_2"), GLFUNC_SUFFIX(glDrawRangeElementsBaseVertex, OES, "GL_OES_draw_elements_base_vertex VERSION_GLES_3 !VERSION_GLES_3_2"), GLFUNC_SUFFIX(glMultiDrawElementsBaseVertex, OES, "GL_OES_draw_elements_base_vertex GL_EXT_multi_draw_arrays"), // EXT_draw_elements_base_vertex GLFUNC_SUFFIX(glDrawElementsBaseVertex, EXT, "GL_EXT_draw_elements_base_vertex !GL_OES_draw_elements_base_vertex !VERSION_GLES_3_2"), GLFUNC_SUFFIX(glDrawElementsInstancedBaseVertex, EXT, "GL_EXT_draw_elements_base_vertex VERSION_GLES_3 !GL_OES_draw_elements_base_vertex !VERSION_GLES_3_2"), GLFUNC_SUFFIX(glDrawRangeElementsBaseVertex, EXT, "GL_EXT_draw_elements_base_vertex VERSION_GLES_3 !GL_OES_draw_elements_base_vertex !VERSION_GLES_3_2"), GLFUNC_SUFFIX(glMultiDrawElementsBaseVertex, EXT, "GL_EXT_draw_elements_base_vertex GL_EXT_multi_draw_arrays !GL_OES_draw_elements_base_vertex !VERSION_GLES_3_2"), // ARB_sample_shading GLFUNC_SUFFIX(glMinSampleShading, ARB, "GL_ARB_sample_shading"), // OES_sample_shading GLFUNC_SUFFIX(glMinSampleShading, OES, "GL_OES_sample_shading !VERSION_GLES_3_2"), GLFUNC_REQUIRES(glMinSampleShading, "VERSION_GLES_3_2"), // ARB_debug_output GLFUNC_REQUIRES(glDebugMessageCallbackARB, "GL_ARB_debug_output"), GLFUNC_REQUIRES(glDebugMessageControlARB, "GL_ARB_debug_output"), GLFUNC_REQUIRES(glDebugMessageInsertARB, "GL_ARB_debug_output"), GLFUNC_REQUIRES(glGetDebugMessageLogARB, "GL_ARB_debug_output"), // KHR_debug GLFUNC_SUFFIX(glDebugMessageCallback, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glDebugMessageControl, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glDebugMessageInsert, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glGetDebugMessageLog, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glGetObjectLabel, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glGetObjectPtrLabel, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glObjectLabel, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glObjectPtrLabel, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glPopDebugGroup, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_SUFFIX(glPushDebugGroup, KHR, "GL_KHR_debug VERSION_GLES_3"), GLFUNC_REQUIRES(glDebugMessageCallback, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glDebugMessageControl, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glDebugMessageInsert, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glGetDebugMessageLog, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glGetObjectLabel, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glGetObjectPtrLabel, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glObjectLabel, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glObjectPtrLabel, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glPopDebugGroup, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), GLFUNC_REQUIRES(glPushDebugGroup, "GL_KHR_debug !VERSION_GLES_3 !VERSION_GL_4_3 |VERSION_GLES_3_2"), // ARB_buffer_storage GLFUNC_REQUIRES(glBufferStorage, "GL_ARB_buffer_storage !VERSION_4_4"), GLFUNC_SUFFIX(glNamedBufferStorage, EXT, "GL_ARB_buffer_storage GL_EXT_direct_state_access !VERSION_4_5"), // EXT_buffer_storage GLFUNC_SUFFIX(glBufferStorage, EXT, "GL_EXT_buffer_storage !GL_ARB_buffer_storage !VERSION_4_4"), // EXT_geometry_shader GLFUNC_SUFFIX(glFramebufferTexture, EXT, "GL_EXT_geometry_shader !VERSION_3_2"), // NV_occlusion_query_samples GLFUNC_REQUIRES(glGenOcclusionQueriesNV, "GL_NV_occlusion_query_samples"), GLFUNC_REQUIRES(glDeleteOcclusionQueriesNV, "GL_NV_occlusion_query_samples"), GLFUNC_REQUIRES(glIsOcclusionQueryNV, "GL_NV_occlusion_query_samples"), GLFUNC_REQUIRES(glBeginOcclusionQueryNV, "GL_NV_occlusion_query_samples"), GLFUNC_REQUIRES(glEndOcclusionQueryNV, "GL_NV_occlusion_query_samples"), GLFUNC_REQUIRES(glGetOcclusionQueryivNV, "GL_NV_occlusion_query_samples"), GLFUNC_REQUIRES(glGetOcclusionQueryuivNV, "GL_NV_occlusion_query_samples"), // ARB_clip_control GLFUNC_REQUIRES(glClipControl, "GL_ARB_clip_control !VERSION_4_5"), // ARB_copy_image GLFUNC_REQUIRES(glCopyImageSubData, "GL_ARB_copy_image !VERSION_4_3 |VERSION_GLES_3_2"), // NV_copy_image GLFUNC_SUFFIX(glCopyImageSubData, NV, "GL_NV_copy_image !GL_ARB_copy_image !VERSION_GLES_3_2"), // OES_copy_image GLFUNC_SUFFIX(glCopyImageSubData, OES, "GL_OES_copy_image !VERSION_GLES_3_2"), // EXT_copy_image GLFUNC_SUFFIX(glCopyImageSubData, EXT, "GL_EXT_copy_image !GL_OES_copy_image !VERSION_GLES_3_2"), // EXT_texture_buffer GLFUNC_SUFFIX(glTexBuffer, OES, "GL_OES_texture_buffer !VERSION_GLES_3_2"), // EXT_texture_buffer GLFUNC_SUFFIX(glTexBuffer, EXT, "GL_EXT_texture_buffer !GL_OES_texture_buffer !VERSION_GLES_3_2"), // EXT_blend_func_extended GLFUNC_SUFFIX(glBindFragDataLocationIndexed, EXT, "GL_EXT_blend_func_extended"), GLFUNC_SUFFIX(glGetFragDataIndex, EXT, "GL_EXT_blend_func_extended"), // ARB_shader_storage_buffer_object GLFUNC_REQUIRES(glShaderStorageBlockBinding, "ARB_shader_storage_buffer_object !VERSION_4_3"), }; namespace GLExtensions { // Private members and functions static bool _isES; static u32 _GLVersion; static std::unordered_map<std::string, bool> m_extension_list; // Private initialization functions bool InitFunctionPointers(); // Initializes the extension list the old way static void InitExtensionList21() { const char* extensions = (const char*)glGetString(GL_EXTENSIONS); std::string tmp(extensions); std::istringstream buffer(tmp); while (buffer >> tmp) m_extension_list[tmp] = true; } static void InitExtensionList() { m_extension_list.clear(); if (_isES) { switch (_GLVersion) { default: case 320: m_extension_list["VERSION_GLES_3_2"] = true; case 310: m_extension_list["VERSION_GLES_3_1"] = true; case 300: m_extension_list["VERSION_GLES_3"] = true; break; } // We always have ES 2.0 m_extension_list["VERSION_GLES_2"] = true; } else { // Some OpenGL implementations chose to not expose core extensions as extensions // Let's add them to the list manually depending on which version of OpenGL we have // We need to be slightly careful here // When an extension got merged in to core, the naming may have changed // This has intentional fall through switch (_GLVersion) { default: case 450: { std::string gl450exts[] = { "GL_ARB_ES3_1_compatibility", "GL_ARB_clip_control", "GL_ARB_conditional_render_inverted", "GL_ARB_cull_distance", "GL_ARB_derivative_control", "GL_ARB_direct_state_access", "GL_ARB_get_texture_sub_image", "GL_ARB_robustness", "GL_ARB_shader_texture_image_samples", "GL_ARB_texture_barrier", "VERSION_4_5", }; for (auto it : gl450exts) m_extension_list[it] = true; } case 440: { std::string gl440exts[] = { "GL_ARB_buffer_storage", "GL_ARB_clear_texture", "GL_ARB_enhanced_layouts", "GL_ARB_multi_bind", "GL_ARB_query_buffer_object", "GL_ARB_texture_mirror_clamp_to_edge", "GL_ARB_texture_stencil8", "GL_ARB_vertex_type_10f_11f_11f_rev", "VERSION_4_4", }; for (auto it : gl440exts) m_extension_list[it] = true; } case 430: { std::string gl430exts[] = { "GL_ARB_ES3_compatibility", "GL_ARB_arrays_of_arrays", "GL_ARB_clear_buffer_object", "GL_ARB_compute_shader", "GL_ARB_copy_image", "GL_ARB_explicit_uniform_location", "GL_ARB_fragment_layer_viewport", "GL_ARB_framebuffer_no_attachments", "GL_ARB_internalformat_query2", "GL_ARB_invalidate_subdata", "GL_ARB_multi_draw_indirect", "GL_ARB_program_interface_query", "GL_ARB_shader_image_size", "GL_ARB_shader_storage_buffer_object", "GL_ARB_stencil_texturing", "GL_ARB_texture_buffer_range", "GL_ARB_texture_query_levels", "GL_ARB_texture_storage_multisample", "GL_ARB_texture_view", "GL_ARB_vertex_attrib_binding", "VERSION_4_3", }; for (auto it : gl430exts) m_extension_list[it] = true; } case 420: { std::string gl420exts[] = { "GL_ARB_base_instance", "GL_ARB_compressed_texture_pixel_storage", "GL_ARB_conservative_depth", "GL_ARB_internalformat_query", "GL_ARB_map_buffer_alignment", "GL_ARB_shader_atomic_counters", "GL_ARB_shader_image_load_store", "GL_ARB_shading_language_420pack", "GL_ARB_shading_language_packing", "GL_ARB_texture_compression_BPTC", "GL_ARB_texture_storage", "GL_ARB_transform_feedback_instanced", "VERSION_4_2", }; for (auto it : gl420exts) m_extension_list[it] = true; } case 410: { std::string gl410exts[] = { "GL_ARB_ES2_compatibility", "GL_ARB_get_program_binary", "GL_ARB_separate_shader_objects", "GL_ARB_shader_precision", "GL_ARB_vertex_attrib_64_bit", "GL_ARB_viewport_array", "VERSION_4_1", }; for (auto it : gl410exts) m_extension_list[it] = true; } case 400: { std::string gl400exts[] = { "GL_ARB_draw_indirect", "GL_ARB_gpu_shader5", "GL_ARB_gpu_shader_fp64", "GL_ARB_sample_shading", "GL_ARB_shader_subroutine", "GL_ARB_tessellation_shader", "GL_ARB_texture_buffer_object_rgb32", "GL_ARB_texture_cube_map_array", "GL_ARB_texture_gather", "GL_ARB_texture_query_lod", "GL_ARB_transform_feedback2", "GL_ARB_transform_feedback3", "VERSION_4_0", }; for (auto it : gl400exts) m_extension_list[it] = true; } case 330: { std::string gl330exts[] = { "GL_ARB_shader_bit_encoding", "GL_ARB_blend_func_extended", "GL_ARB_explicit_attrib_location", "GL_ARB_occlusion_query2", "GL_ARB_sampler_objects", "GL_ARB_texture_swizzle", "GL_ARB_timer_query", "GL_ARB_instanced_arrays", "GL_ARB_texture_rgb10_a2ui", "GL_ARB_vertex_type_2_10_10_10_rev", "VERSION_3_3", }; for (auto it : gl330exts) m_extension_list[it] = true; } case 320: { std::string gl320exts[] = { "GL_ARB_geometry_shader4", "GL_ARB_sync", "GL_ARB_vertex_array_bgra", "GL_ARB_draw_elements_base_vertex", "GL_ARB_seamless_cube_map", "GL_ARB_texture_multisample", "GL_ARB_fragment_coord_conventions", "GL_ARB_provoking_vertex", "GL_ARB_depth_clamp", "VERSION_3_2", }; for (auto it : gl320exts) m_extension_list[it] = true; } case 310: { // Can't add NV_primitive_restart since function name changed std::string gl310exts[] = { "GL_ARB_draw_instanced", "GL_ARB_copy_buffer", "GL_ARB_texture_buffer_object", "GL_ARB_texture_rectangle", "GL_ARB_uniform_buffer_object", //"GL_NV_primitive_restart", "VERSION_3_1", }; for (auto it : gl310exts) m_extension_list[it] = true; } case 300: { // Quite a lot of these had their names changed when merged in to core // Disable the ones that have std::string gl300exts[] = { "GL_ARB_map_buffer_range", //"GL_EXT_gpu_shader4", //"GL_APPLE_flush_buffer_range", "GL_ARB_color_buffer_float", //"GL_NV_depth_buffer_float", "GL_ARB_texture_float", //"GL_EXT_packed_float", //"GL_EXT_texture_shared_exponent", "GL_ARB_half_float_pixel", //"GL_NV_half_float", "GL_ARB_framebuffer_object", //"GL_EXT_framebuffer_sRGB", "GL_ARB_texture_float", //"GL_EXT_texture_integer", //"GL_EXT_draw_buffers2", //"GL_EXT_texture_integer", //"GL_EXT_texture_array", //"GL_EXT_texture_compression_rgtc", //"GL_EXT_transform_feedback", "GL_ARB_vertex_array_object", //"GL_NV_conditional_render", "VERSION_3_0", }; for (auto it : gl300exts) m_extension_list[it] = true; } case 210: case 200: case 150: case 140: case 130: case 121: case 120: case 110: case 100: break; } // So we can easily determine if we are running dekstop GL m_extension_list["VERSION_GL"] = true; } if (_GLVersion < 300) { InitExtensionList21(); return; } GLint NumExtension = 0; glGetIntegerv(GL_NUM_EXTENSIONS, &NumExtension); for (GLint i = 0; i < NumExtension; ++i) m_extension_list[std::string((const char*)glGetStringi(GL_EXTENSIONS, i))] = true; } static void InitVersion() { GLint major, minor; glGetIntegerv(GL_MAJOR_VERSION, &major); glGetIntegerv(GL_MINOR_VERSION, &minor); if (glGetError() == GL_NO_ERROR) _GLVersion = major * 100 + minor * 10; else _GLVersion = 210; } static void* GetFuncAddress(const std::string& name, void **func) { *func = GLInterface->GetFuncAddress(name); if (*func == nullptr) { #if defined(__linux__) || defined(__APPLE__) // Give it a second try with dlsym *func = dlsym(RTLD_NEXT, name.c_str()); #endif if (*func == nullptr) ERROR_LOG(VIDEO, "Couldn't load function %s", name.c_str()); } return *func; } // Public members u32 Version() { return _GLVersion; } bool Supports(const std::string& name) { return m_extension_list[name]; } bool Init() { _isES = GLInterface->GetMode() != GLInterfaceMode::MODE_OPENGL; // Grab a few functions for initial checking // We need them to grab the extension list // Also to check if there is an error grabbing the version if (GetFuncAddress("glGetIntegerv", (void**)&glGetIntegerv) == nullptr) return false; if (GetFuncAddress("glGetString", (void**)&glGetString) == nullptr) return false; if (GetFuncAddress("glGetError", (void**)&glGetError) == nullptr) return false; InitVersion(); // We need to use glGetStringi to get the extension list // if we are using GLES3 or a GL version greater than 2.1 if (_GLVersion > 210 && GetFuncAddress("glGetStringi", (void**)&glGetStringi) == nullptr) return false; InitExtensionList(); return InitFunctionPointers(); } // Private initialization functions static bool HasFeatures(const std::string& extensions) { bool result = true; std::string tmp; std::istringstream buffer(extensions); while (buffer >> tmp) { if (tmp[0] == '!') result &= !m_extension_list[tmp.erase(0, 1)]; else if (tmp[0] == '|') result |= m_extension_list[tmp.erase(0, 1)]; else result &= m_extension_list[tmp]; } return result; } bool InitFunctionPointers() { bool result = true; for (const auto &it : gl_function_array) if (HasFeatures(it.requirements)) result &= !!GetFuncAddress(it.function_name, it.function_ptr); return result; } }
Java
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ /* * This code is based on Labyrinth of Time code with assistance of * * Copyright (c) 1993 Terra Nova Development * Copyright (c) 2004 The Wyrmkeep Entertainment Co. * */ #include "lab/lab.h" #include "lab/anim.h" #include "lab/dispman.h" #include "lab/eventman.h" #include "lab/intro.h" #include "lab/music.h" #include "lab/resource.h" #include "lab/utils.h" namespace Lab { Intro::Intro(LabEngine *vm) : _vm(vm) { _quitIntro = false; _introDoBlack = false; _font = _vm->_resource->getFont("F:Map.fon"); } Intro::~Intro() { _vm->_graphics->freeFont(&_font); } void Intro::introEatMessages() { while (1) { IntuiMessage *msg = _vm->_event->getMsg(); if (_vm->shouldQuit()) { _quitIntro = true; return; } if (!msg) return; if ((msg->_msgClass == kMessageRightClick) || ((msg->_msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE))) _quitIntro = true; } } void Intro::doPictText(const Common::String filename, bool isScreen) { Common::String path = Common::String("Lab:rooms/Intro/") + filename; uint timeDelay = (isScreen) ? 35 : 7; _vm->updateEvents(); if (_quitIntro) return; uint32 lastMillis = 0; bool drawNextText = true; bool doneFl = false; bool begin = true; Common::File *textFile = _vm->_resource->openDataFile(path); char *textBuffer = new char[textFile->size()]; textFile->read(textBuffer, textFile->size()); delete textFile; const char *curText = textBuffer; while (1) { if (drawNextText) { if (begin) begin = false; else if (isScreen) _vm->_graphics->fade(false); if (isScreen) { _vm->_graphics->rectFillScaled(10, 10, 310, 190, 7); curText += _vm->_graphics->flowText(_font, _vm->_isHiRes ? 0 : -1, 5, 7, false, false, true, true, _vm->_utils->vgaRectScale(14, 11, 306, 189), curText); _vm->_graphics->fade(true); } else curText += _vm->_graphics->longDrawMessage(Common::String(curText), false); doneFl = (*curText == 0); drawNextText = false; introEatMessages(); if (_quitIntro) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } lastMillis = _vm->_system->getMillis(); } IntuiMessage *msg = _vm->_event->getMsg(); if (_vm->shouldQuit()) { _quitIntro = true; return; } if (!msg) { _vm->updateEvents(); _vm->_anim->diffNextFrame(); uint32 elapsedSeconds = (_vm->_system->getMillis() - lastMillis) / 1000; if (elapsedSeconds > timeDelay) { if (doneFl) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } else { drawNextText = true; } } _vm->waitTOF(); } else { uint32 msgClass = msg->_msgClass; uint16 code = msg->_code; if ((msgClass == kMessageRightClick) || ((msgClass == kMessageRawKey) && (code == Common::KEYCODE_ESCAPE))) { _quitIntro = true; if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } else if ((msgClass == kMessageLeftClick) || (msgClass == kMessageRightClick)) { if (msgClass == kMessageLeftClick) { if (doneFl) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } else drawNextText = true; } introEatMessages(); if (_quitIntro) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } } if (doneFl) { if (isScreen) _vm->_graphics->fade(false); delete[] textBuffer; return; } else drawNextText = true; } } // while(1) } void Intro::musicDelay() { _vm->updateEvents(); if (_quitIntro) return; for (int i = 0; i < 20; i++) { _vm->updateEvents(); _vm->waitTOF(); _vm->waitTOF(); _vm->waitTOF(); } } void Intro::nReadPict(const Common::String filename, bool playOnce) { Common::String finalFileName = Common::String("P:Intro/") + filename; _vm->updateEvents(); introEatMessages(); if (_quitIntro) return; _vm->_anim->_doBlack = _introDoBlack; _vm->_anim->stopDiffEnd(); _vm->_graphics->readPict(finalFileName, playOnce); } void Intro::play() { uint16 palette[16] = { 0x0000, 0x0855, 0x0FF9, 0x0EE7, 0x0ED5, 0x0DB4, 0x0CA2, 0x0C91, 0x0B80, 0x0B80, 0x0B91, 0x0CA2, 0x0CB3, 0x0DC4, 0x0DD6, 0x0EE7 }; _vm->_anim->_doBlack = true; if (_vm->getPlatform() == Common::kPlatformDOS) { nReadPict("EA0"); nReadPict("EA1"); nReadPict("EA2"); nReadPict("EA3"); } else if (_vm->getPlatform() == Common::kPlatformWindows) { nReadPict("WYRMKEEP"); // Wait 4 seconds (400 x 10ms) for (int i = 0; i < 400; i++) { introEatMessages(); if (_quitIntro) break; _vm->_system->delayMillis(10); } } _vm->_graphics->blackAllScreen(); if (_vm->getPlatform() != Common::kPlatformAmiga) _vm->_music->changeMusic("Music:BackGrou", false, false); else _vm->_music->changeMusic("Music:BackGround", false, false); _vm->_anim->_noPalChange = true; if (_vm->getPlatform() == Common::kPlatformDOS) nReadPict("TNDcycle.pic"); else nReadPict("TNDcycle2.pic"); _vm->_anim->_noPalChange = false; _vm->_graphics->_fadePalette = palette; for (int i = 0; i < 16; i++) { palette[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); } _vm->updateEvents(); if (!_quitIntro) _vm->_graphics->fade(true); for (int times = 0; times < 150; times++) { introEatMessages(); if (_quitIntro) break; _vm->updateEvents(); uint16 temp = palette[2]; for (int i = 2; i < 15; i++) palette[i] = palette[i + 1]; palette[15] = temp; _vm->_graphics->setAmigaPal(palette); _vm->waitTOF(); } if (!_quitIntro) { _vm->_graphics->fade(false); _vm->_graphics->blackAllScreen(); _vm->updateEvents(); } nReadPict("Title.A"); nReadPict("AB"); musicDelay(); nReadPict("BA"); nReadPict("AC"); musicDelay(); if (_vm->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now nReadPict("CA"); nReadPict("AD"); musicDelay(); if (_vm->getPlatform() == Common::kPlatformWindows) musicDelay(); // more credits on this page now nReadPict("DA"); musicDelay(); _vm->updateEvents(); _vm->_graphics->blackAllScreen(); _vm->updateEvents(); _vm->_anim->_noPalChange = true; nReadPict("Intro.1"); _vm->_anim->_noPalChange = false; for (int i = 0; i < 16; i++) { palette[i] = ((_vm->_anim->_diffPalette[i * 3] >> 2) << 8) + ((_vm->_anim->_diffPalette[i * 3 + 1] >> 2) << 4) + (_vm->_anim->_diffPalette[i * 3 + 2] >> 2); } doPictText("i.1", true); if (_vm->getPlatform() == Common::kPlatformWindows) { doPictText("i.2A", true); doPictText("i.2B", true); } _vm->_graphics->blackAllScreen(); _vm->updateEvents(); _introDoBlack = true; nReadPict("Station1"); doPictText("i.3"); nReadPict("Station2"); doPictText("i.4"); nReadPict("Stiles4"); doPictText("i.5"); nReadPict("Stiles3"); doPictText("i.6"); if (_vm->getPlatform() == Common::kPlatformWindows) nReadPict("Platform2"); else nReadPict("Platform"); doPictText("i.7"); nReadPict("Subway.1"); doPictText("i.8"); nReadPict("Subway.2"); doPictText("i.9"); doPictText("i.10"); doPictText("i.11"); if (!_quitIntro) for (int i = 0; i < 50; i++) { for (int idx = (8 * 3); idx < (255 * 3); idx++) _vm->_anim->_diffPalette[idx] = 255 - _vm->_anim->_diffPalette[idx]; _vm->updateEvents(); _vm->waitTOF(); _vm->_graphics->setPalette(_vm->_anim->_diffPalette, 256); _vm->waitTOF(); _vm->waitTOF(); } doPictText("i.12"); doPictText("i.13"); _introDoBlack = false; nReadPict("Daed0"); doPictText("i.14"); nReadPict("Daed1"); doPictText("i.15"); nReadPict("Daed2"); doPictText("i.16"); doPictText("i.17"); doPictText("i.18"); nReadPict("Daed3"); doPictText("i.19"); doPictText("i.20"); nReadPict("Daed4"); doPictText("i.21"); nReadPict("Daed5"); doPictText("i.22"); doPictText("i.23"); doPictText("i.24"); nReadPict("Daed6"); doPictText("i.25"); doPictText("i.26"); nReadPict("Daed7", false); doPictText("i.27"); doPictText("i.28"); _vm->_anim->stopDiffEnd(); nReadPict("Daed8"); doPictText("i.29"); doPictText("i.30"); nReadPict("Daed9"); doPictText("i.31"); doPictText("i.32"); doPictText("i.33"); nReadPict("Daed9a"); nReadPict("Daed10"); doPictText("i.34"); doPictText("i.35"); doPictText("i.36"); nReadPict("SubX"); if (_quitIntro) { _vm->_graphics->rectFill(0, 0, _vm->_graphics->_screenWidth - 1, _vm->_graphics->_screenHeight - 1, 0); _vm->_anim->_doBlack = true; } } } // End of namespace Lab
Java
/* Manage an ftp connection Copyright (C) 1997,2001,02 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.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, 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. */ #ifndef __FTPCONN_H__ #define __FTPCONN_H__ #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/stat.h> #define __need_error_t #include <errno.h> #ifndef __error_t_defined typedef int error_t; #define __error_t_defined #endif #ifndef FTP_CONN_EI # define FTP_CONN_EI extern inline #endif struct ftp_conn; struct ftp_conn_params; struct ftp_conn_stat; /* The type of the function called by ...get_stats to add each new stat. NAME is the file in question, STAT is stat info about it, and if NAME is a symlink, SYMLINK_TARGET is what it is linked to, or 0 if it's not a symlink. NAME and SYMLINK_TARGET should be copied if they are used outside of this function. HOOK is as passed into ...get_stats. */ typedef error_t (*ftp_conn_add_stat_fun_t) (const char *name, # if _FILE_OFFSET_BITS == 64 const struct stat *stat, # else const struct stat64 *stat, # endif const char *symlink_target, void *hook); /* Hooks that customize behavior for particular types of remote system. */ struct ftp_conn_syshooks { /* Should return in ADDR a malloced struct sockaddr containing the address of the host referenced by the PASV reply contained in TXT. */ error_t (*pasv_addr) (struct ftp_conn *conn, const char *txt, struct sockaddr **addr); /* Look at the error string in TXT, and try to guess an error code to return. If POSS_ERRS is non-zero, it contains a list of errors that are likely to occur with the previous command, terminated with 0. If no match is found and POSS_ERRS is non-zero, the first error in POSS_ERRS should be returned by default. */ error_t (*interp_err) (struct ftp_conn *conn, const char *txt, const error_t *poss_errs); /* Start an operation to get a list of file-stat structures for NAME (this is often similar to ftp_conn_start_dir, but with OS-specific flags), and return a file-descriptor for reading on, and a state structure in STATE suitable for passing to cont_get_stats. If CONTENTS is true, NAME must refer to a directory, and the contents will be returned, otherwise, the (single) result will refer to NAME. */ error_t (*start_get_stats) (struct ftp_conn *conn, const char *name, int contents, int *fd, void **state); /* Read stats information from FD, calling ADD_STAT for each new stat (HOOK is passed to ADD_STAT). FD and STATE should be returned from start_get_stats. If this function returns EAGAIN, then it should be called again to finish the job (possibly after calling select on FD); if it returns 0, then it is finishe,d and FD and STATE are deallocated. */ error_t (*cont_get_stats) (struct ftp_conn *conn, int fd, void *state, ftp_conn_add_stat_fun_t add_stat, void *hook); /* Give a name which refers to a directory file, and a name in that directory, this should return in COMPOSITE the composite name refering to that name in that directory, in malloced storage. */ error_t (*append_name) (struct ftp_conn *conn, const char *dir, const char *name, char **composite); /* If the name of a file *NAME is a composite name (containing both a filename and a directory name), this function should change *NAME to be the name component only; if the result is shorter than the original *NAME, the storage pointed to it may be modified, otherwise, *NAME should be changed to point to malloced storage holding the result, which will be freed by the caller. */ error_t (*basename) (struct ftp_conn *conn, char **name); }; /* Type parameter for the cntl_debug hook. */ #define FTP_CONN_CNTL_DEBUG_CMD 1 #define FTP_CONN_CNTL_DEBUG_REPLY 2 /* Type parameter for the get_login_param hook. */ #define FTP_CONN_GET_LOGIN_PARAM_USER 1 #define FTP_CONN_GET_LOGIN_PARAM_PASS 2 #define FTP_CONN_GET_LOGIN_PARAM_ACCT 3 /* General connection customization. */ struct ftp_conn_hooks { /* If non-zero, should look at the SYST reply in SYST, and fill in CONN's syshooks (with ftp_conn_set_hooks) appropriately; SYST may be zero if the remote system doesn't support that command. If zero, then the default ftp_conn_choose_syshooks is used. */ void (*choose_syshooks) (struct ftp_conn *conn, const char *syst); /* If non-zero, called during io on the ftp control connection -- TYPE is FTP_CONN_CNTL_DEBUG_CMD for commands, and FTP_CONN_CNTL_DEBUG_REPLY for replies; TXT is the actual text. */ void (*cntl_debug) (struct ftp_conn *conn, int type, const char *txt); /* Called after CONN's connection the server has been opened (or reopened). */ void (*opened) (struct ftp_conn *conn); /* If the remote system requires some login parameter that isn't available, this hook is called to try and get it, returning a value in TXT. The return value should be in a malloced block of memory. The returned value will only be used once; if it's desired that it should `stick', the user may modify the value stored in CONN's params field, but that is an issue outside of the scope of this interface -- params are only read, never written. */ error_t (*get_login_param) (struct ftp_conn *conn, int type, char **txt); /* Called after CONN's connection the server has closed for some reason. */ void (*closed) (struct ftp_conn *conn); /* Called when CONN is initially created before any other hook calls. An error return causes the creation to fail with that error code. */ error_t (*init) (struct ftp_conn *conn); /* Called when CONN is about to be destroyed. No hook calls are ever made after this one. */ void (*fini) (struct ftp_conn *conn); /* This hook should return true if the current thread has been interrupted in some way, and EINTR (or a short count in some cases) should be returned from a blocking function. */ int (*interrupt_check) (struct ftp_conn *conn); }; /* A single ftp connection. */ struct ftp_conn { const struct ftp_conn_params *params; /* machine, user, &c */ const struct ftp_conn_hooks *hooks; /* Customization hooks. */ struct ftp_conn_syshooks syshooks; /* host-dependent hook functions */ int syshooks_valid : 1; /* True if the system type has been determined. */ int control; /* fd for ftp control connection */ char *line; /* buffer for reading control replies */ size_t line_sz; /* allocated size of LINE */ size_t line_offs; /* Start of unread input in LINE. */ size_t line_len; /* End of the contents in LINE. */ char *reply_txt; /* A buffer for the text of entire replies */ size_t reply_txt_sz; /* size of it */ char *cwd; /* Last know CWD, or 0 if unknown. */ const char *type; /* Connection type, or 0 if default. */ void *hook; /* Random user data. */ int use_passive : 1; /* If true, first try passive data conns. */ struct sockaddr *actv_data_addr;/* Address of port for active data conns. */ }; /* Parameters for an ftp connection; doesn't include any actual connection state. */ struct ftp_conn_params { void *addr; /* Address. */ size_t addr_len; /* Length in bytes of ADDR. */ int addr_type; /* Type of ADDR (AF_*). */ char *user, *pass, *acct; /* Parameters for logging into ftp. */ }; /* Unix hooks */ extern error_t ftp_conn_unix_pasv_addr (struct ftp_conn *conn, const char *txt, struct sockaddr **addr); extern error_t ftp_conn_unix_interp_err (struct ftp_conn *conn, const char *txt, const error_t *poss_errs); extern error_t ftp_conn_unix_start_get_stats (struct ftp_conn *conn, const char *name, int contents, int *fd, void **state); extern error_t ftp_conn_unix_cont_get_stats (struct ftp_conn *conn, int fd, void *state, ftp_conn_add_stat_fun_t add_stat, void *hook); error_t ftp_conn_unix_append_name (struct ftp_conn *conn, const char *dir, const char *name, char **composite); error_t ftp_conn_unix_basename (struct ftp_conn *conn, char **name); extern struct ftp_conn_syshooks ftp_conn_unix_syshooks; error_t ftp_conn_get_raw_reply (struct ftp_conn *conn, int *reply, const char **reply_txt); error_t ftp_conn_get_reply (struct ftp_conn *conn, int *reply, const char **reply_txt); error_t ftp_conn_cmd (struct ftp_conn *conn, const char *cmd, const char *arg, int *reply, const char **reply_txt); error_t ftp_conn_cmd_reopen (struct ftp_conn *conn, const char *cmd, const char *arg, int *reply, const char **reply_txt); void ftp_conn_abort (struct ftp_conn *conn); /* Sets CONN's syshooks to a copy of SYSHOOKS. */ void ftp_conn_set_syshooks (struct ftp_conn *conn, struct ftp_conn_syshooks *syshooks); error_t ftp_conn_open (struct ftp_conn *conn); void ftp_conn_close (struct ftp_conn *conn); /* Makes sure that CONN's syshooks are set according to the remote system type. */ FTP_CONN_EI error_t ftp_conn_validate_syshooks (struct ftp_conn *conn) { if (conn->syshooks_valid) return 0; else /* Opening the connection should set the syshooks. */ return ftp_conn_open (conn); } /* Create a new ftp connection as specified by PARAMS, and return it in CONN; HOOKS contains customization hooks used by the connection. Neither PARAMS nor HOOKS is copied, so a copy of it should be made if necessary before calling this function; if it should be freed later, a FINI hook may be used to do so. */ error_t ftp_conn_create (const struct ftp_conn_params *params, const struct ftp_conn_hooks *hooks, struct ftp_conn **conn); /* Free the ftp connection CONN, closing it first, and freeing all resources it uses. */ void ftp_conn_free (struct ftp_conn *conn); /* Start a transfer command CMD (and optional args ...), returning a file descriptor in DATA. POSS_ERRS is a list of errnos to try matching against any resulting error text. */ error_t ftp_conn_start_transfer (struct ftp_conn *conn, const char *cmd, const char *arg, const error_t *poss_errs, int *data); /* Wait for the reply signalling the end of a data transfer. */ error_t ftp_conn_finish_transfer (struct ftp_conn *conn); /* Start retreiving file NAME over CONN, returning a file descriptor in DATA over which the data can be read. */ error_t ftp_conn_start_retrieve (struct ftp_conn *conn, const char *name, int *data); /* Start retreiving a list of files in NAME over CONN, returning a file descriptor in DATA over which the data can be read. */ error_t ftp_conn_start_list (struct ftp_conn *conn, const char *name, int *data); /* Start retreiving a directory listing of NAME over CONN, returning a file descriptor in DATA over which the data can be read. */ error_t ftp_conn_start_dir (struct ftp_conn *conn, const char *name, int *data); /* Start storing into file NAME over CONN, returning a file descriptor in DATA into which the data can be written. */ error_t ftp_conn_start_store (struct ftp_conn *conn, const char *name, int *data); /* Transfer the output of SRC_CMD/SRC_NAME on SRC_CONN to DST_NAME on DST_CONN, moving the data directly between servers. */ error_t ftp_conn_rmt_transfer (struct ftp_conn *src_conn, const char *src_cmd, const char *src_name, const int *src_poss_errs, struct ftp_conn *dst_conn, const char *dst_name); /* Copy the SRC_NAME on SRC_CONN to DST_NAME on DST_CONN, moving the data directly between servers. */ error_t ftp_conn_rmt_copy (struct ftp_conn *src_conn, const char *src_name, struct ftp_conn *dst_conn, const char *dst_name); /* Return a malloced string containing CONN's working directory in CWD. */ error_t ftp_conn_get_cwd (struct ftp_conn *conn, char **cwd); /* Return a malloced string containing CONN's working directory in CWD. */ error_t ftp_conn_cwd (struct ftp_conn *conn, const char *cwd); /* Return a malloced string containing CONN's working directory in CWD. */ error_t ftp_conn_cdup (struct ftp_conn *conn); /* Set the ftp connection type of CONN to TYPE, or return an error. */ error_t ftp_conn_set_type (struct ftp_conn *conn, const char *type); /* Start an operation to get a list of file-stat structures for NAME (this is often similar to ftp_conn_start_dir, but with OS-specific flags), and return a file-descriptor for reading on, and a state structure in STATE suitable for passing to cont_get_stats. If CONTENTS is true, NAME must refer to a directory, and the contents will be returned, otherwise, the (single) result will refer to NAME. */ error_t ftp_conn_start_get_stats (struct ftp_conn *conn, const char *name, int contents, int *fd, void **state); /* Read stats information from FD, calling ADD_STAT for each new stat (HOOK is passed to ADD_STAT). FD and STATE should be returned from start_get_stats. If this function returns EAGAIN, then it should be called again to finish the job (possibly after calling select on FD); if it returns 0, then it is finishe,d and FD and STATE are deallocated. */ error_t ftp_conn_cont_get_stats (struct ftp_conn *conn, int fd, void *state, ftp_conn_add_stat_fun_t add_stat, void *hook); /* Get a list of file-stat structures for NAME, calling ADD_STAT for each one (HOOK is passed to ADD_STAT). If CONTENTS is true, NAME must refer to a directory, and the contents will be returned, otherwise, the (single) result will refer to NAME. This function may block. */ error_t ftp_conn_get_stats (struct ftp_conn *conn, const char *name, int contents, ftp_conn_add_stat_fun_t add_stat, void *hook); /* The type of the function called by ...get_names to add each new name. NAME is the name in question and HOOK is as passed into ...get_stats. */ typedef error_t (*ftp_conn_add_name_fun_t) (const char *name, void *hook); /* Start an operation to get a list of filenames in the directory NAME, and return a file-descriptor for reading on, and a state structure in STATE suitable for passing to cont_get_names. */ error_t ftp_conn_start_get_names (struct ftp_conn *conn, const char *name, int *fd, void **state); /* Read filenames from FD, calling ADD_NAME for each new NAME (HOOK is passed to ADD_NAME). FD and STATE should be returned from start_get_stats. If this function returns EAGAIN, then it should be called again to finish the job (possibly after calling select on FD); if it returns 0, then it is finishe,d and FD and STATE are deallocated. */ error_t ftp_conn_cont_get_names (struct ftp_conn *conn, int fd, void *state, ftp_conn_add_name_fun_t add_name, void *hook); /* Get a list of names in the directory NAME, calling ADD_NAME for each one (HOOK is passed to ADD_NAME). This function may block. */ error_t ftp_conn_get_names (struct ftp_conn *conn, const char *name, ftp_conn_add_name_fun_t add_name, void *hook); /* Give a name which refers to a directory file, and a name in that directory, this should return in COMPOSITE the composite name refering to that name in that directory, in malloced storage. */ error_t ftp_conn_append_name (struct ftp_conn *conn, const char *dir, const char *name, char **composite); /* If the name of a file COMPOSITE is a composite name (containing both a filename and a directory name), this function will return the name component only in BASE, in malloced storage, otherwise it simply returns a newly malloced copy of COMPOSITE in BASE. */ error_t ftp_conn_basename (struct ftp_conn *conn, const char *composite, char **base); #endif /* __FTPCONN_H__ */
Java
/* * Block driver for media (i.e., flash cards) * * Copyright 2002 Hewlett-Packard Company * Copyright 2005-2008 Pierre Ossman * * Use consistent with the GNU GPL is permitted, * provided that this copyright notice is * preserved in its entirety in all copies and derived works. * * HEWLETT-PACKARD COMPANY MAKES NO WARRANTIES, EXPRESSED OR IMPLIED, * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS * FITNESS FOR ANY PARTICULAR PURPOSE. * * Many thanks to Alessandro Rubini and Jonathan Corbet! * * Author: Andrew Christian * 28 May 2002 */ #include <linux/moduleparam.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/fs.h> #include <linux/slab.h> #include <linux/errno.h> #include <linux/hdreg.h> #include <linux/kdev_t.h> #include <linux/blkdev.h> #include <linux/mutex.h> #include <linux/scatterlist.h> #include <linux/string_helpers.h> #include <linux/delay.h> #include <linux/capability.h> #include <linux/compat.h> #include <linux/sysfs.h> #include <linux/mmc/ioctl.h> #include <linux/mmc/card.h> #include <linux/mmc/host.h> #include <linux/mmc/mmc.h> #include <linux/mmc/sd.h> #include <asm/uaccess.h> #include "queue.h" MODULE_ALIAS("mmc:block"); #if defined(CONFIG_MMC_CPRM) #include "cprmdrv_samsung.h" #include <linux/ioctl.h> #define MMC_IOCTL_BASE 0xB3 /* Same as MMC block device major number */ #define MMC_IOCTL_GET_SECTOR_COUNT _IOR(MMC_IOCTL_BASE, 100, int) #define MMC_IOCTL_GET_SECTOR_SIZE _IOR(MMC_IOCTL_BASE, 101, int) #define MMC_IOCTL_GET_BLOCK_SIZE _IOR(MMC_IOCTL_BASE, 102, int) #define MMC_IOCTL_SET_RETRY_AKE_PROCESS _IOR(MMC_IOCTL_BASE, 104, int) static int cprm_ake_retry_flag; #endif #ifdef MODULE_PARAM_PREFIX #undef MODULE_PARAM_PREFIX #endif #define MODULE_PARAM_PREFIX "mmcblk." #define INAND_CMD38_ARG_EXT_CSD 113 #define INAND_CMD38_ARG_ERASE 0x00 #define INAND_CMD38_ARG_TRIM 0x01 #define INAND_CMD38_ARG_SECERASE 0x80 #define INAND_CMD38_ARG_SECTRIM1 0x81 #define INAND_CMD38_ARG_SECTRIM2 0x88 #define MMC_BLK_TIMEOUT_MS (30 * 1000) /* 30 sec timeout */ #define MMC_SANITIZE_REQ_TIMEOUT 240000 /* msec */ #define mmc_req_rel_wr(req) (((req->cmd_flags & REQ_FUA) || \ (req->cmd_flags & REQ_META)) && \ (rq_data_dir(req) == WRITE)) #define PACKED_CMD_VER 0x01 #define PACKED_CMD_WR 0x02 #define MMC_BLK_UPDATE_STOP_REASON(stats, reason) \ do { \ if (stats->enabled) \ stats->pack_stop_reason[reason]++; \ } while (0) static DEFINE_MUTEX(block_mutex); /* * The defaults come from config options but can be overriden by module * or bootarg options. */ static int perdev_minors = CONFIG_MMC_BLOCK_MINORS; /* * We've only got one major, so number of mmcblk devices is * limited to 256 / number of minors per device. */ static int max_devices; /* 256 minors, so at most 256 separate devices */ static DECLARE_BITMAP(dev_use, 256); static DECLARE_BITMAP(name_use, 256); /* * There is one mmc_blk_data per slot. */ struct mmc_blk_data { spinlock_t lock; struct gendisk *disk; struct mmc_queue queue; struct list_head part; unsigned int flags; #define MMC_BLK_CMD23 (1 << 0) /* Can do SET_BLOCK_COUNT for multiblock */ #define MMC_BLK_REL_WR (1 << 1) /* MMC Reliable write support */ unsigned int usage; unsigned int read_only; unsigned int part_type; unsigned int name_idx; unsigned int reset_done; #define MMC_BLK_READ BIT(0) #define MMC_BLK_WRITE BIT(1) #define MMC_BLK_DISCARD BIT(2) #define MMC_BLK_SECDISCARD BIT(3) /* * Only set in main mmc_blk_data associated * with mmc_card with mmc_set_drvdata, and keeps * track of the current selected device partition. */ unsigned int part_curr; struct device_attribute force_ro; struct device_attribute power_ro_lock; struct device_attribute num_wr_reqs_to_start_packing; struct device_attribute bkops_check_threshold; int area_type; }; static DEFINE_MUTEX(open_lock); enum { MMC_PACKED_N_IDX = -1, MMC_PACKED_N_ZERO, MMC_PACKED_N_SINGLE, }; module_param(perdev_minors, int, 0444); MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); static inline void mmc_blk_clear_packed(struct mmc_queue_req *mqrq) { mqrq->packed_cmd = MMC_PACKED_NONE; mqrq->packed_num = MMC_PACKED_N_ZERO; } static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk) { struct mmc_blk_data *md; mutex_lock(&open_lock); md = disk->private_data; if (md && md->usage == 0) md = NULL; if (md) md->usage++; mutex_unlock(&open_lock); return md; } static inline int mmc_get_devidx(struct gendisk *disk) { int devidx = disk->first_minor / perdev_minors; return devidx; } static void mmc_blk_put(struct mmc_blk_data *md) { mutex_lock(&open_lock); md->usage--; if (md->usage == 0) { int devidx = mmc_get_devidx(md->disk); blk_cleanup_queue(md->queue.queue); __clear_bit(devidx, dev_use); put_disk(md->disk); kfree(md); } mutex_unlock(&open_lock); } static ssize_t power_ro_lock_show(struct device *dev, struct device_attribute *attr, char *buf) { int ret; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); struct mmc_card *card = md->queue.card; int locked = 0; if (card->ext_csd.boot_ro_lock & EXT_CSD_BOOT_WP_B_PERM_WP_EN) locked = 2; else if (card->ext_csd.boot_ro_lock & EXT_CSD_BOOT_WP_B_PWR_WP_EN) locked = 1; ret = snprintf(buf, PAGE_SIZE, "%d\n", locked); return ret; } static ssize_t power_ro_lock_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret; struct mmc_blk_data *md, *part_md; struct mmc_card *card; unsigned long set; if (kstrtoul(buf, 0, &set)) return -EINVAL; if (set != 1) return count; md = mmc_blk_get(dev_to_disk(dev)); card = md->queue.card; mmc_claim_host(card->host); ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BOOT_WP, card->ext_csd.boot_ro_lock | EXT_CSD_BOOT_WP_B_PWR_WP_EN, card->ext_csd.part_time); if (ret) pr_err("%s: Locking boot partition ro until next power on failed: %d\n", md->disk->disk_name, ret); else card->ext_csd.boot_ro_lock |= EXT_CSD_BOOT_WP_B_PWR_WP_EN; mmc_release_host(card->host); if (!ret) { pr_info("%s: Locking boot partition ro until next power on\n", md->disk->disk_name); set_disk_ro(md->disk, 1); list_for_each_entry(part_md, &md->part, part) if (part_md->area_type == MMC_BLK_DATA_AREA_BOOT) { pr_info("%s: Locking boot partition ro until next power on\n", part_md->disk->disk_name); set_disk_ro(part_md->disk, 1); } } mmc_blk_put(md); return count; } static ssize_t force_ro_show(struct device *dev, struct device_attribute *attr, char *buf) { int ret; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); ret = snprintf(buf, PAGE_SIZE, "%d", get_disk_ro(dev_to_disk(dev)) ^ md->read_only); mmc_blk_put(md); return ret; } static ssize_t force_ro_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret; char *end; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); unsigned long set = simple_strtoul(buf, &end, 0); if (end == buf) { ret = -EINVAL; goto out; } set_disk_ro(dev_to_disk(dev), set || md->read_only); ret = count; out: mmc_blk_put(md); return ret; } static ssize_t num_wr_reqs_to_start_packing_show(struct device *dev, struct device_attribute *attr, char *buf) { struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); int num_wr_reqs_to_start_packing; int ret; num_wr_reqs_to_start_packing = md->queue.num_wr_reqs_to_start_packing; ret = snprintf(buf, PAGE_SIZE, "%d\n", num_wr_reqs_to_start_packing); mmc_blk_put(md); return ret; } static ssize_t num_wr_reqs_to_start_packing_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int value; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); sscanf(buf, "%d", &value); if (value >= 0) md->queue.num_wr_reqs_to_start_packing = value; mmc_blk_put(md); return count; } static ssize_t bkops_check_threshold_show(struct device *dev, struct device_attribute *attr, char *buf) { struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); struct mmc_card *card = md->queue.card; int ret; if (!card) ret = -EINVAL; else ret = snprintf(buf, PAGE_SIZE, "%d\n", card->bkops_info.size_percentage_to_queue_delayed_work); mmc_blk_put(md); return ret; } static ssize_t bkops_check_threshold_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int value; struct mmc_blk_data *md = mmc_blk_get(dev_to_disk(dev)); struct mmc_card *card = md->queue.card; unsigned int card_size; int ret = count; if (!card) { ret = -EINVAL; goto exit; } sscanf(buf, "%d", &value); if ((value <= 0) || (value >= 100)) { ret = -EINVAL; goto exit; } card_size = (unsigned int)get_capacity(md->disk); if (card_size <= 0) { ret = -EINVAL; goto exit; } card->bkops_info.size_percentage_to_queue_delayed_work = value; card->bkops_info.min_sectors_to_queue_delayed_work = (card_size * value) / 100; pr_debug("%s: size_percentage = %d, min_sectors = %d", mmc_hostname(card->host), card->bkops_info.size_percentage_to_queue_delayed_work, card->bkops_info.min_sectors_to_queue_delayed_work); exit: mmc_blk_put(md); return count; } static int mmc_blk_open(struct block_device *bdev, fmode_t mode) { struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk); int ret = -ENXIO; mutex_lock(&block_mutex); if (md) { if (md->usage == 2) check_disk_change(bdev); ret = 0; if ((mode & FMODE_WRITE) && md->read_only) { mmc_blk_put(md); ret = -EROFS; } } mutex_unlock(&block_mutex); return ret; } static int mmc_blk_release(struct gendisk *disk, fmode_t mode) { struct mmc_blk_data *md = disk->private_data; mutex_lock(&block_mutex); mmc_blk_put(md); mutex_unlock(&block_mutex); return 0; } static int mmc_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo) { geo->cylinders = get_capacity(bdev->bd_disk) / (4 * 16); geo->heads = 4; geo->sectors = 16; return 0; } struct mmc_blk_ioc_data { struct mmc_ioc_cmd ic; unsigned char *buf; u64 buf_bytes; }; static struct mmc_blk_ioc_data *mmc_blk_ioctl_copy_from_user( struct mmc_ioc_cmd __user *user) { struct mmc_blk_ioc_data *idata; int err; idata = kzalloc(sizeof(*idata), GFP_KERNEL); if (!idata) { err = -ENOMEM; goto out; } if (copy_from_user(&idata->ic, user, sizeof(idata->ic))) { err = -EFAULT; goto idata_err; } idata->buf_bytes = (u64) idata->ic.blksz * idata->ic.blocks; if (idata->buf_bytes > MMC_IOC_MAX_BYTES) { err = -EOVERFLOW; goto idata_err; } if (!idata->buf_bytes) return idata; idata->buf = kzalloc(idata->buf_bytes, GFP_KERNEL); if (!idata->buf) { err = -ENOMEM; goto idata_err; } if (copy_from_user(idata->buf, (void __user *)(unsigned long) idata->ic.data_ptr, idata->buf_bytes)) { err = -EFAULT; goto copy_err; } return idata; copy_err: kfree(idata->buf); idata_err: kfree(idata); out: return ERR_PTR(err); } struct scatterlist *mmc_blk_get_sg(struct mmc_card *card, unsigned char *buf, int *sg_len, int size) { struct scatterlist *sg; struct scatterlist *sl; int total_sec_cnt, sec_cnt; int max_seg_size, len; total_sec_cnt = size; max_seg_size = card->host->max_seg_size; len = (size - 1 + max_seg_size) / max_seg_size; sl = kmalloc(sizeof(struct scatterlist) * len, GFP_KERNEL); if (!sl) { return NULL; } sg = (struct scatterlist *)sl; sg_init_table(sg, len); while (total_sec_cnt) { if (total_sec_cnt < max_seg_size) sec_cnt = total_sec_cnt; else sec_cnt = max_seg_size; sg_set_page(sg, virt_to_page(buf), sec_cnt, offset_in_page(buf)); buf = buf + sec_cnt; total_sec_cnt = total_sec_cnt - sec_cnt; if (total_sec_cnt == 0) break; sg = sg_next(sg); } if (sg) sg_mark_end(sg); *sg_len = len; return sl; } static int mmc_blk_ioctl_cmd(struct block_device *bdev, struct mmc_ioc_cmd __user *ic_ptr) { struct mmc_blk_ioc_data *idata; struct mmc_blk_data *md; struct mmc_card *card; struct mmc_command cmd = {0}; struct mmc_data data = {0}; struct mmc_request mrq = {NULL}; struct scatterlist *sg = 0; int err=0; /* * The caller must have CAP_SYS_RAWIO, and must be calling this on the * whole block device, not on a partition. This prevents overspray * between sibling partitions. */ if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains)) return -EPERM; idata = mmc_blk_ioctl_copy_from_user(ic_ptr); if (IS_ERR(idata)) return PTR_ERR(idata); md = mmc_blk_get(bdev->bd_disk); if (!md) { err = -EINVAL; goto cmd_done; } card = md->queue.card; if (IS_ERR(card)) { err = PTR_ERR(card); goto cmd_done; } cmd.opcode = idata->ic.opcode; cmd.arg = idata->ic.arg; cmd.flags = idata->ic.flags; if (idata->buf_bytes) { int len; data.blksz = idata->ic.blksz; data.blocks = idata->ic.blocks; sg = mmc_blk_get_sg(card, idata->buf, &len, idata->buf_bytes); data.sg = sg; data.sg_len = len; if (idata->ic.write_flag) data.flags = MMC_DATA_WRITE; else data.flags = MMC_DATA_READ; /* data.flags must already be set before doing this. */ mmc_set_data_timeout(&data, card); /* Allow overriding the timeout_ns for empirical tuning. */ if (idata->ic.data_timeout_ns) data.timeout_ns = idata->ic.data_timeout_ns; if ((cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) { /* * Pretend this is a data transfer and rely on the * host driver to compute timeout. When all host * drivers support cmd.cmd_timeout for R1B, this * can be changed to: * * mrq.data = NULL; * cmd.cmd_timeout = idata->ic.cmd_timeout_ms; */ data.timeout_ns = idata->ic.cmd_timeout_ms * 1000000; } mrq.data = &data; } mrq.cmd = &cmd; mmc_claim_host(card->host); if (idata->ic.is_acmd) { err = mmc_app_cmd(card->host, card); if (err) goto cmd_rel_host; } mmc_wait_for_req(card->host, &mrq); if (cmd.error) { dev_err(mmc_dev(card->host), "%s: cmd error %d\n", __func__, cmd.error); err = cmd.error; goto cmd_rel_host; } if (data.error) { dev_err(mmc_dev(card->host), "%s: data error %d\n", __func__, data.error); err = data.error; goto cmd_rel_host; } /* * According to the SD specs, some commands require a delay after * issuing the command. */ if (idata->ic.postsleep_min_us) usleep_range(idata->ic.postsleep_min_us, idata->ic.postsleep_max_us); if (copy_to_user(&(ic_ptr->response), cmd.resp, sizeof(cmd.resp))) { err = -EFAULT; goto cmd_rel_host; } if (!idata->ic.write_flag) { if (copy_to_user((void __user *)(unsigned long) idata->ic.data_ptr, idata->buf, idata->buf_bytes)) { err = -EFAULT; goto cmd_rel_host; } } cmd_rel_host: mmc_release_host(card->host); cmd_done: mmc_blk_put(md); if (sg) kfree(sg); kfree(idata->buf); kfree(idata); return err; } static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { #if defined(CONFIG_MMC_CPRM) struct mmc_blk_data *md = bdev->bd_disk->private_data; struct mmc_card *card = md->queue.card; static int i; static unsigned long temp_arg[16] = {0}; #endif int ret = -EINVAL; if (cmd == MMC_IOC_CMD) ret = mmc_blk_ioctl_cmd(bdev, (struct mmc_ioc_cmd __user *)arg); #if defined(CONFIG_MMC_CPRM) printk(KERN_DEBUG " %s ], %x ", __func__, cmd); switch (cmd) { case MMC_IOCTL_SET_RETRY_AKE_PROCESS: cprm_ake_retry_flag = 1; ret = 0; break; case MMC_IOCTL_GET_SECTOR_COUNT: { int size = 0; size = (int)get_capacity(md->disk) << 9; printk(KERN_DEBUG "[%s]:MMC_IOCTL_GET_SECTOR_COUNT size = %d\n", __func__, size); return copy_to_user((void *)arg, &size, sizeof(u64)); } break; case ACMD13: case ACMD18: case ACMD25: case ACMD43: case ACMD44: case ACMD45: case ACMD46: case ACMD47: case ACMD48: { struct cprm_request *req = (struct cprm_request *)arg; printk(KERN_DEBUG "%s:cmd [%x]\n", __func__, cmd); if (cmd == ACMD43) { printk(KERN_DEBUG"storing acmd43 arg[%d] = %ul\n", i, (unsigned int)req->arg); temp_arg[i] = req->arg; i++; if (i >= 16) { printk(KERN_DEBUG"reset acmd43 i = %d\n", i); i = 0; } } if (cmd == ACMD45 && cprm_ake_retry_flag == 1) { cprm_ake_retry_flag = 0; printk(KERN_DEBUG"ACMD45.. I'll call ACMD43 and ACMD44 first\n"); for (i = 0; i < 16; i++) { printk(KERN_DEBUG"calling ACMD43 with arg[%d] = %ul\n", i, (unsigned int)temp_arg[i]); if (stub_sendcmd(card, ACMD43, temp_arg[i], 512, NULL) < 0) { printk(KERN_DEBUG"error ACMD43 %d\n", i); return -EINVAL; } } printk(KERN_DEBUG"calling ACMD44\n"); if (stub_sendcmd(card, ACMD44, 0, 8, NULL) < 0) { printk(KERN_DEBUG"error in ACMD44 %d\n", i); return -EINVAL; } } return stub_sendcmd(card, req->cmd, req->arg, req->len, req->buff); } break; default: printk(KERN_DEBUG"%s: Invalid ioctl command\n", __func__); break; } #endif return ret; } #ifdef CONFIG_COMPAT static int mmc_blk_compat_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { return mmc_blk_ioctl(bdev, mode, cmd, (unsigned long) compat_ptr(arg)); } #endif static const struct block_device_operations mmc_bdops = { .open = mmc_blk_open, .release = mmc_blk_release, .getgeo = mmc_blk_getgeo, .owner = THIS_MODULE, .ioctl = mmc_blk_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = mmc_blk_compat_ioctl, #endif }; static inline int mmc_blk_part_switch(struct mmc_card *card, struct mmc_blk_data *md) { int ret; struct mmc_blk_data *main_md = mmc_get_drvdata(card); if (main_md->part_curr == md->part_type) return 0; if (mmc_card_mmc(card)) { u8 part_config = card->ext_csd.part_config; part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK; part_config |= md->part_type; ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONFIG, part_config, card->ext_csd.part_time); if (ret) return ret; card->ext_csd.part_config = part_config; } main_md->part_curr = md->part_type; return 0; } static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) { int err; u32 result; __be32 *blocks; struct mmc_request mrq = {NULL}; struct mmc_command cmd = {0}; struct mmc_data data = {0}; struct scatterlist sg; cmd.opcode = MMC_APP_CMD; cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 0); if (err) return (u32)-1; if (!mmc_host_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD)) return (u32)-1; memset(&cmd, 0, sizeof(struct mmc_command)); cmd.opcode = SD_APP_SEND_NUM_WR_BLKS; cmd.arg = 0; cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; data.blksz = 4; data.blocks = 1; data.flags = MMC_DATA_READ; data.sg = &sg; data.sg_len = 1; mmc_set_data_timeout(&data, card); mrq.cmd = &cmd; mrq.data = &data; blocks = kmalloc(4, GFP_KERNEL); if (!blocks) return (u32)-1; sg_init_one(&sg, blocks, 4); mmc_wait_for_req(card->host, &mrq); result = ntohl(*blocks); kfree(blocks); if (cmd.error || data.error) result = (u32)-1; return result; } static int send_stop(struct mmc_card *card, u32 *status) { struct mmc_command cmd = {0}; int err; cmd.opcode = MMC_STOP_TRANSMISSION; cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 5); if (err == 0) *status = cmd.resp[0]; return err; } static int get_card_status(struct mmc_card *card, u32 *status, int retries) { struct mmc_command cmd = {0}; int err; cmd.opcode = MMC_SEND_STATUS; if (!mmc_host_is_spi(card->host)) cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, retries); if (err == 0) *status = cmd.resp[0]; return err; } #define ERR_NOMEDIUM 3 #define ERR_RETRY 2 #define ERR_ABORT 1 #define ERR_CONTINUE 0 static int mmc_blk_cmd_error(struct request *req, const char *name, int error, bool status_valid, u32 status) { switch (error) { case -EILSEQ: /* response crc error, retry the r/w cmd */ pr_err("%s: %s sending %s command, card status %#x\n", req->rq_disk->disk_name, "response CRC error", name, status); return ERR_RETRY; case -ETIMEDOUT: pr_err("%s: %s sending %s command, card status %#x\n", req->rq_disk->disk_name, "timed out", name, status); /* If the status cmd initially failed, retry the r/w cmd */ if (!status_valid) { pr_err("%s: status not valid, retrying timeout\n", req->rq_disk->disk_name); return ERR_RETRY; } /* * If it was a r/w cmd crc error, or illegal command * (eg, issued in wrong state) then retry - we should * have corrected the state problem above. */ if (status & (R1_COM_CRC_ERROR | R1_ILLEGAL_COMMAND)) { pr_err("%s: command error, retrying timeout\n", req->rq_disk->disk_name); return ERR_RETRY; } /* Otherwise abort the command */ pr_err("%s: not retrying timeout\n", req->rq_disk->disk_name); return ERR_ABORT; default: /* We don't understand the error code the driver gave us */ pr_err("%s: unknown error %d sending read/write command, card status %#x\n", req->rq_disk->disk_name, error, status); return ERR_ABORT; } } /* * Initial r/w and stop cmd error recovery. * We don't know whether the card received the r/w cmd or not, so try to * restore things back to a sane state. Essentially, we do this as follows: * - Obtain card status. If the first attempt to obtain card status fails, * the status word will reflect the failed status cmd, not the failed * r/w cmd. If we fail to obtain card status, it suggests we can no * longer communicate with the card. * - Check the card state. If the card received the cmd but there was a * transient problem with the response, it might still be in a data transfer * mode. Try to send it a stop command. If this fails, we can't recover. * - If the r/w cmd failed due to a response CRC error, it was probably * transient, so retry the cmd. * - If the r/w cmd timed out, but we didn't get the r/w cmd status, retry. * - If the r/w cmd timed out, and the r/w cmd failed due to CRC error or * illegal cmd, retry. * Otherwise we don't understand what happened, so abort. */ static int mmc_blk_cmd_recovery(struct mmc_card *card, struct request *req, struct mmc_blk_request *brq, int *ecc_err, int *gen_err) { bool prev_cmd_status_valid = true; u32 status, stop_status = 0; int err, retry; if (mmc_card_removed(card)) return ERR_NOMEDIUM; /* * Try to get card status which indicates both the card state * and why there was no response. If the first attempt fails, * we can't be sure the returned status is for the r/w command. */ for (retry = 2; retry >= 0; retry--) { err = get_card_status(card, &status, 0); if (!err) break; prev_cmd_status_valid = false; pr_err("%s: error %d sending status command, %sing\n", req->rq_disk->disk_name, err, retry ? "retry" : "abort"); } /* We couldn't get a response from the card. Give up. */ if (err) { /* Check if the card is removed */ if (mmc_detect_card_removed(card->host)) return ERR_NOMEDIUM; return ERR_ABORT; } /* Flag ECC errors */ if ((status & R1_CARD_ECC_FAILED) || (brq->stop.resp[0] & R1_CARD_ECC_FAILED) || (brq->cmd.resp[0] & R1_CARD_ECC_FAILED)) *ecc_err = 1; /* Flag General errors */ if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) if ((status & R1_ERROR) || (brq->stop.resp[0] & R1_ERROR)) { pr_err("%s: %s: general error sending stop or status command, stop cmd response %#x, card status %#x\n", req->rq_disk->disk_name, __func__, brq->stop.resp[0], status); *gen_err = 1; } /* * Check the current card state. If it is in some data transfer * mode, tell it to stop (and hopefully transition back to TRAN.) */ if (R1_CURRENT_STATE(status) == R1_STATE_DATA || R1_CURRENT_STATE(status) == R1_STATE_RCV) { err = send_stop(card, &stop_status); if (err) pr_err("%s: error %d sending stop command\n", req->rq_disk->disk_name, err); /* * If the stop cmd also timed out, the card is probably * not present, so abort. Other errors are bad news too. */ if (err) return ERR_ABORT; if (stop_status & R1_CARD_ECC_FAILED) *ecc_err = 1; if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) if (stop_status & R1_ERROR) { pr_err("%s: %s: general error sending stop command, stop cmd response %#x\n", req->rq_disk->disk_name, __func__, stop_status); *gen_err = 1; } } /* Check for set block count errors */ if (brq->sbc.error) return mmc_blk_cmd_error(req, "SET_BLOCK_COUNT", brq->sbc.error, prev_cmd_status_valid, status); /* Check for r/w command errors */ if (brq->cmd.error) return mmc_blk_cmd_error(req, "r/w cmd", brq->cmd.error, prev_cmd_status_valid, status); /* Data errors */ if (!brq->stop.error) return ERR_CONTINUE; /* Now for stop errors. These aren't fatal to the transfer. */ pr_err("%s: error %d sending stop command, original cmd response %#x, card status %#x\n", req->rq_disk->disk_name, brq->stop.error, brq->cmd.resp[0], status); /* * Subsitute in our own stop status as this will give the error * state which happened during the execution of the r/w command. */ if (stop_status) { brq->stop.resp[0] = stop_status; brq->stop.error = 0; } return ERR_CONTINUE; } static int mmc_blk_reset(struct mmc_blk_data *md, struct mmc_host *host, int type) { int err; if (md->reset_done & type) return -EEXIST; md->reset_done |= type; err = mmc_hw_reset(host); /* Ensure we switch back to the correct partition */ if (err != -EOPNOTSUPP) { struct mmc_blk_data *main_md = mmc_get_drvdata(host->card); int part_err; main_md->part_curr = main_md->part_type; part_err = mmc_blk_part_switch(host->card, md); if (part_err) { /* * We have failed to get back into the correct * partition, so we need to abort the whole request. */ return -ENODEV; } } return err; } static inline void mmc_blk_reset_success(struct mmc_blk_data *md, int type) { md->reset_done &= ~type; } static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; unsigned int from, nr, arg; int err = 0, type = MMC_BLK_DISCARD; if (!mmc_can_erase(card)) { err = -EOPNOTSUPP; goto out; } from = blk_rq_pos(req); nr = blk_rq_sectors(req); if (card->ext_csd.bkops_en) card->bkops_info.sectors_changed += blk_rq_sectors(req); if (mmc_can_discard(card)) arg = MMC_DISCARD_ARG; else if (mmc_can_trim(card)) arg = MMC_TRIM_ARG; else arg = MMC_ERASE_ARG; retry: if (card->quirks & MMC_QUIRK_INAND_CMD38) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, INAND_CMD38_ARG_EXT_CSD, arg == MMC_TRIM_ARG ? INAND_CMD38_ARG_TRIM : INAND_CMD38_ARG_ERASE, 0); if (err) goto out; } err = mmc_erase(card, from, nr, arg); out: if (err == -EIO && !mmc_blk_reset(md, card->host, type)) goto retry; if (!err) mmc_blk_reset_success(md, type); blk_end_request(req, err, blk_rq_bytes(req)); return err ? 0 : 1; } static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; unsigned int from, nr, arg; int err = 0, type = MMC_BLK_SECDISCARD; if (!(mmc_can_secure_erase_trim(card))) { err = -EOPNOTSUPP; goto out; } from = blk_rq_pos(req); nr = blk_rq_sectors(req); if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) arg = MMC_SECURE_TRIM1_ARG; else arg = MMC_SECURE_ERASE_ARG; retry: if (card->quirks & MMC_QUIRK_INAND_CMD38) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, INAND_CMD38_ARG_EXT_CSD, arg == MMC_SECURE_TRIM1_ARG ? INAND_CMD38_ARG_SECTRIM1 : INAND_CMD38_ARG_SECERASE, 0); if (err) goto out_retry; } err = mmc_erase(card, from, nr, arg); if (err == -EIO) goto out_retry; if (err) goto out; if (arg == MMC_SECURE_TRIM1_ARG) { if (card->quirks & MMC_QUIRK_INAND_CMD38) { err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, INAND_CMD38_ARG_EXT_CSD, INAND_CMD38_ARG_SECTRIM2, 0); if (err) goto out_retry; } err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); if (err == -EIO) goto out_retry; if (err) goto out; } if (mmc_can_sanitize(card) && (card->host->caps2 & MMC_CAP2_SANITIZE)) err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_SANITIZE_START, 1, 0); out_retry: if (err && !mmc_blk_reset(md, card->host, type)) goto retry; if (!err) mmc_blk_reset_success(md, type); out: blk_end_request(req, err, blk_rq_bytes(req)); return err ? 0 : 1; } static int mmc_blk_issue_sanitize_rq(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; int err = 0; BUG_ON(!card); BUG_ON(!card->host); if (!(mmc_can_sanitize(card) && (card->host->caps2 & MMC_CAP2_SANITIZE))) { pr_warning("%s: %s - SANITIZE is not supported\n", mmc_hostname(card->host), __func__); err = -EOPNOTSUPP; goto out; } pr_debug("%s: %s - SANITIZE IN PROGRESS...\n", mmc_hostname(card->host), __func__); err = mmc_switch_ignore_timeout(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_SANITIZE_START, 1, MMC_SANITIZE_REQ_TIMEOUT); if (err) pr_err("%s: %s - mmc_switch() with " "EXT_CSD_SANITIZE_START failed. err=%d\n", mmc_hostname(card->host), __func__, err); pr_debug("%s: %s - SANITIZE COMPLETED\n", mmc_hostname(card->host), __func__); out: blk_end_request(req, err, blk_rq_bytes(req)); return err ? 0 : 1; } static int mmc_blk_issue_flush(struct mmc_queue *mq, struct request *req) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; int ret = 0; ret = mmc_flush_cache(card); if (ret) ret = -EIO; blk_end_request_all(req, ret); return ret ? 0 : 1; } /* * Reformat current write as a reliable write, supporting * both legacy and the enhanced reliable write MMC cards. * In each transfer we'll handle only as much as a single * reliable write can handle, thus finish the request in * partial completions. */ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq, struct mmc_card *card, struct request *req) { if (!(card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN)) { /* Legacy mode imposes restrictions on transfers. */ if (!IS_ALIGNED(brq->cmd.arg, card->ext_csd.rel_sectors)) brq->data.blocks = 1; if (brq->data.blocks > card->ext_csd.rel_sectors) brq->data.blocks = card->ext_csd.rel_sectors; else if (brq->data.blocks < card->ext_csd.rel_sectors) brq->data.blocks = 1; } } #define CMD_ERRORS \ (R1_OUT_OF_RANGE | /* Command argument out of range */ \ R1_ADDRESS_ERROR | /* Misaligned address */ \ R1_BLOCK_LEN_ERROR | /* Transferred block length incorrect */\ R1_WP_VIOLATION | /* Tried to write to protected block */ \ R1_CC_ERROR | /* Card controller error */ \ R1_ERROR) /* General/unknown error */ static int mmc_blk_err_check(struct mmc_card *card, struct mmc_async_req *areq) { struct mmc_queue_req *mq_mrq = container_of(areq, struct mmc_queue_req, mmc_active); struct mmc_blk_request *brq = &mq_mrq->brq; struct request *req = mq_mrq->req; int ecc_err = 0, gen_err = 0; /* * sbc.error indicates a problem with the set block count * command. No data will have been transferred. * * cmd.error indicates a problem with the r/w command. No * data will have been transferred. * * stop.error indicates a problem with the stop command. Data * may have been transferred, or may still be transferring. */ if (brq->sbc.error || brq->cmd.error || brq->stop.error || brq->data.error) { switch (mmc_blk_cmd_recovery(card, req, brq, &ecc_err, &gen_err)) { case ERR_RETRY: return MMC_BLK_RETRY; case ERR_ABORT: return MMC_BLK_ABORT; case ERR_NOMEDIUM: return MMC_BLK_NOMEDIUM; case ERR_CONTINUE: break; } } /* * Check for errors relating to the execution of the * initial command - such as address errors. No data * has been transferred. */ if (brq->cmd.resp[0] & CMD_ERRORS) { pr_err("%s: r/w command failed, status = %#x\n", req->rq_disk->disk_name, brq->cmd.resp[0]); return MMC_BLK_ABORT; } /* * Everything else is either success, or a data error of some * kind. If it was a write, we may have transitioned to * program mode, which we have to wait for it to complete. */ if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) { u32 status; unsigned long timeout; /* Check stop command response */ if (brq->stop.resp[0] & R1_ERROR) { pr_err("%s: %s: general error sending stop command, stop cmd response %#x\n", req->rq_disk->disk_name, __func__, brq->stop.resp[0]); gen_err = 1; } timeout = jiffies + msecs_to_jiffies(MMC_BLK_TIMEOUT_MS); do { int err = get_card_status(card, &status, 5); if (err) { pr_err("%s: error %d requesting status\n", req->rq_disk->disk_name, err); return MMC_BLK_CMD_ERR; } /* Timeout if the device never becomes ready for data * and never leaves the program state. */ if (time_after(jiffies, timeout)) { pr_err("%s: Card stuck in programming state!"\ " %s %s\n", mmc_hostname(card->host), req->rq_disk->disk_name, __func__); return MMC_BLK_CMD_ERR; } if (status & R1_ERROR) { pr_err("%s: %s: general error sending status command, card status %#x\n", req->rq_disk->disk_name, __func__, status); gen_err = 1; } /* * Some cards mishandle the status bits, * so make sure to check both the busy * indication and the card state. */ } while (!(status & R1_READY_FOR_DATA) || (R1_CURRENT_STATE(status) == R1_STATE_PRG)); } /* if general error occurs, retry the write operation. */ if (gen_err) { pr_warning("%s: retrying write for general error\n", req->rq_disk->disk_name); return MMC_BLK_RETRY; } if (brq->data.error) { pr_err("%s: error %d transferring data, sector %u, nr %u, cmd response %#x, card status %#x\n", req->rq_disk->disk_name, brq->data.error, (unsigned)blk_rq_pos(req), (unsigned)blk_rq_sectors(req), brq->cmd.resp[0], brq->stop.resp[0]); if (rq_data_dir(req) == READ) { if (ecc_err) return MMC_BLK_ECC_ERR; return MMC_BLK_DATA_ERR; } else { return MMC_BLK_CMD_ERR; } } if (!brq->data.bytes_xfered) return MMC_BLK_RETRY; if (mq_mrq->packed_cmd != MMC_PACKED_NONE) { if (unlikely(brq->data.blocks << 9 != brq->data.bytes_xfered)) return MMC_BLK_PARTIAL; else return MMC_BLK_SUCCESS; } if (blk_rq_bytes(req) != brq->data.bytes_xfered) return MMC_BLK_PARTIAL; return MMC_BLK_SUCCESS; } static int mmc_blk_packed_err_check(struct mmc_card *card, struct mmc_async_req *areq) { struct mmc_queue_req *mq_rq = container_of(areq, struct mmc_queue_req, mmc_active); struct request *req = mq_rq->req; int err, check, status; u8 ext_csd[512]; mq_rq->packed_retries--; check = mmc_blk_err_check(card, areq); err = get_card_status(card, &status, 0); if (err) { pr_err("%s: error %d sending status command\n", req->rq_disk->disk_name, err); return MMC_BLK_ABORT; } if (status & R1_EXCEPTION_EVENT) { err = mmc_send_ext_csd(card, ext_csd); if (err) { pr_err("%s: error %d sending ext_csd\n", req->rq_disk->disk_name, err); return MMC_BLK_ABORT; } if ((ext_csd[EXT_CSD_EXP_EVENTS_STATUS] & EXT_CSD_PACKED_FAILURE) && (ext_csd[EXT_CSD_PACKED_CMD_STATUS] & EXT_CSD_PACKED_GENERIC_ERROR)) { if (ext_csd[EXT_CSD_PACKED_CMD_STATUS] & EXT_CSD_PACKED_INDEXED_ERROR) { mq_rq->packed_fail_idx = ext_csd[EXT_CSD_PACKED_FAILURE_INDEX] - 1; return MMC_BLK_PARTIAL; } } } return check; } static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, struct mmc_card *card, int disable_multi, struct mmc_queue *mq) { u32 readcmd, writecmd; struct mmc_blk_request *brq = &mqrq->brq; struct request *req = mqrq->req; struct mmc_blk_data *md = mq->data; bool do_data_tag; /* * Reliable writes are used to implement Forced Unit Access and * REQ_META accesses, and are supported only on MMCs. * * XXX: this really needs a good explanation of why REQ_META * is treated special. */ bool do_rel_wr = ((req->cmd_flags & REQ_FUA) || (req->cmd_flags & REQ_META)) && (rq_data_dir(req) == WRITE) && (md->flags & MMC_BLK_REL_WR); memset(brq, 0, sizeof(struct mmc_blk_request)); brq->mrq.cmd = &brq->cmd; brq->mrq.data = &brq->data; brq->cmd.arg = blk_rq_pos(req); if (!mmc_card_blockaddr(card)) brq->cmd.arg <<= 9; brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; brq->data.blksz = 512; brq->stop.opcode = MMC_STOP_TRANSMISSION; brq->stop.arg = 0; if (rq_data_dir(req) == WRITE) brq->stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; else brq->stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1B | MMC_CMD_AC; brq->data.blocks = blk_rq_sectors(req); brq->data.fault_injected = false; /* * The block layer doesn't support all sector count * restrictions, so we need to be prepared for too big * requests. */ if (brq->data.blocks > card->host->max_blk_count) brq->data.blocks = card->host->max_blk_count; if (brq->data.blocks > 1) { /* * After a read error, we redo the request one sector * at a time in order to accurately determine which * sectors can be read successfully. */ if (disable_multi) brq->data.blocks = 1; /* Some controllers can't do multiblock reads due to hw bugs */ if (card->host->caps2 & MMC_CAP2_NO_MULTI_READ && rq_data_dir(req) == READ) brq->data.blocks = 1; } if (brq->data.blocks > 1 || do_rel_wr) { /* SPI multiblock writes terminate using a special * token, not a STOP_TRANSMISSION request. */ if (!mmc_host_is_spi(card->host) || rq_data_dir(req) == READ) brq->mrq.stop = &brq->stop; readcmd = MMC_READ_MULTIPLE_BLOCK; writecmd = MMC_WRITE_MULTIPLE_BLOCK; } else { brq->mrq.stop = NULL; readcmd = MMC_READ_SINGLE_BLOCK; writecmd = MMC_WRITE_BLOCK; } if (rq_data_dir(req) == READ) { brq->cmd.opcode = readcmd; brq->data.flags |= MMC_DATA_READ; } else { brq->cmd.opcode = writecmd; brq->data.flags |= MMC_DATA_WRITE; } if (do_rel_wr) mmc_apply_rel_rw(brq, card, req); /* * Data tag is used only during writing meta data to speed * up write and any subsequent read of this meta data */ do_data_tag = (card->ext_csd.data_tag_unit_size) && (req->cmd_flags & REQ_META) && (rq_data_dir(req) == WRITE) && ((brq->data.blocks * brq->data.blksz) >= card->ext_csd.data_tag_unit_size); /* * Pre-defined multi-block transfers are preferable to * open ended-ones (and necessary for reliable writes). * However, it is not sufficient to just send CMD23, * and avoid the final CMD12, as on an error condition * CMD12 (stop) needs to be sent anyway. This, coupled * with Auto-CMD23 enhancements provided by some * hosts, means that the complexity of dealing * with this is best left to the host. If CMD23 is * supported by card and host, we'll fill sbc in and let * the host deal with handling it correctly. This means * that for hosts that don't expose MMC_CAP_CMD23, no * change of behavior will be observed. * * N.B: Some MMC cards experience perf degradation. * We'll avoid using CMD23-bounded multiblock writes for * these, while retaining features like reliable writes. */ if ((md->flags & MMC_BLK_CMD23) && mmc_op_multi(brq->cmd.opcode) && (do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) || do_data_tag)) { brq->sbc.opcode = MMC_SET_BLOCK_COUNT; brq->sbc.arg = brq->data.blocks | (do_rel_wr ? (1 << 31) : 0) | (do_data_tag ? (1 << 29) : 0); brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC; brq->mrq.sbc = &brq->sbc; } mmc_set_data_timeout(&brq->data, card); brq->data.sg = mqrq->sg; brq->data.sg_len = mmc_queue_map_sg(mq, mqrq); /* * Adjust the sg list so it is the same size as the * request. */ if (brq->data.blocks != blk_rq_sectors(req)) { int i, data_size = brq->data.blocks << 9; struct scatterlist *sg; for_each_sg(brq->data.sg, sg, brq->data.sg_len, i) { data_size -= sg->length; if (data_size <= 0) { sg->length += data_size; i++; break; } } brq->data.sg_len = i; } mqrq->mmc_active.mrq = &brq->mrq; mqrq->mmc_active.err_check = mmc_blk_err_check; mmc_queue_bounce_pre(mqrq); } static void mmc_blk_write_packing_control(struct mmc_queue *mq, struct request *req) { struct mmc_host *host = mq->card->host; int data_dir; if (!(host->caps2 & MMC_CAP2_PACKED_WR)) return; /* * In case the packing control is not supported by the host, it should * not have an effect on the write packing. Therefore we have to enable * the write packing */ if (!(host->caps2 & MMC_CAP2_PACKED_WR_CONTROL)) { mq->wr_packing_enabled = true; return; } if (!req || (req && (req->cmd_flags & REQ_FLUSH))) { if (mq->num_of_potential_packed_wr_reqs > mq->num_wr_reqs_to_start_packing) mq->wr_packing_enabled = true; mq->num_of_potential_packed_wr_reqs = 0; return; } data_dir = rq_data_dir(req); if (data_dir == READ) { mq->num_of_potential_packed_wr_reqs = 0; mq->wr_packing_enabled = false; return; } else if (data_dir == WRITE) { mq->num_of_potential_packed_wr_reqs++; } if (mq->num_of_potential_packed_wr_reqs > mq->num_wr_reqs_to_start_packing) mq->wr_packing_enabled = true; } struct mmc_wr_pack_stats *mmc_blk_get_packed_statistics(struct mmc_card *card) { if (!card) return NULL; return &card->wr_pack_stats; } EXPORT_SYMBOL(mmc_blk_get_packed_statistics); void mmc_blk_init_packed_statistics(struct mmc_card *card) { int max_num_of_packed_reqs = 0; if (!card || !card->wr_pack_stats.packing_events) return; max_num_of_packed_reqs = card->ext_csd.max_packed_writes; spin_lock(&card->wr_pack_stats.lock); memset(card->wr_pack_stats.packing_events, 0, (max_num_of_packed_reqs + 1) * sizeof(*card->wr_pack_stats.packing_events)); memset(&card->wr_pack_stats.pack_stop_reason, 0, sizeof(card->wr_pack_stats.pack_stop_reason)); card->wr_pack_stats.enabled = true; spin_unlock(&card->wr_pack_stats.lock); } EXPORT_SYMBOL(mmc_blk_init_packed_statistics); void print_mmc_packing_stats(struct mmc_card *card) { int i; int max_num_of_packed_reqs = 0; if ((!card) || (!card->wr_pack_stats.packing_events)) return; max_num_of_packed_reqs = card->ext_csd.max_packed_writes; spin_lock(&card->wr_pack_stats.lock); pr_info("%s: write packing statistics:\n", mmc_hostname(card->host)); for (i = 1 ; i <= max_num_of_packed_reqs ; ++i) { if (card->wr_pack_stats.packing_events[i] != 0) pr_info("%s: Packed %d reqs - %d times\n", mmc_hostname(card->host), i, card->wr_pack_stats.packing_events[i]); } pr_info("%s: stopped packing due to the following reasons:\n", mmc_hostname(card->host)); if (card->wr_pack_stats.pack_stop_reason[EXCEEDS_SEGMENTS]) pr_info("%s: %d times: exceedmax num of segments\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[EXCEEDS_SEGMENTS]); if (card->wr_pack_stats.pack_stop_reason[EXCEEDS_SECTORS]) pr_info("%s: %d times: exceeding the max num of sectors\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[EXCEEDS_SECTORS]); if (card->wr_pack_stats.pack_stop_reason[WRONG_DATA_DIR]) pr_info("%s: %d times: wrong data direction\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[WRONG_DATA_DIR]); if (card->wr_pack_stats.pack_stop_reason[FLUSH_OR_DISCARD]) pr_info("%s: %d times: flush or discard\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[FLUSH_OR_DISCARD]); if (card->wr_pack_stats.pack_stop_reason[EMPTY_QUEUE]) pr_info("%s: %d times: empty queue\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[EMPTY_QUEUE]); if (card->wr_pack_stats.pack_stop_reason[REL_WRITE]) pr_info("%s: %d times: rel write\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[REL_WRITE]); if (card->wr_pack_stats.pack_stop_reason[THRESHOLD]) pr_info("%s: %d times: Threshold\n", mmc_hostname(card->host), card->wr_pack_stats.pack_stop_reason[THRESHOLD]); spin_unlock(&card->wr_pack_stats.lock); } EXPORT_SYMBOL(print_mmc_packing_stats); static u8 mmc_blk_prep_packed_list(struct mmc_queue *mq, struct request *req) { struct request_queue *q = mq->queue; struct mmc_card *card = mq->card; struct request *cur = req, *next = NULL; struct mmc_blk_data *md = mq->data; bool en_rel_wr = card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN; unsigned int req_sectors = 0, phys_segments = 0; unsigned int max_blk_count, max_phys_segs; u8 put_back = 0; u8 max_packed_rw = 0; u8 reqs = 0; struct mmc_wr_pack_stats *stats = &card->wr_pack_stats; mmc_blk_clear_packed(mq->mqrq_cur); if (!(md->flags & MMC_BLK_CMD23) || !card->ext_csd.packed_event_en) goto no_packed; if (!mq->wr_packing_enabled) goto no_packed; if ((rq_data_dir(cur) == WRITE) && (card->host->caps2 & MMC_CAP2_PACKED_WR)) max_packed_rw = card->ext_csd.max_packed_writes; if (max_packed_rw == 0) goto no_packed; if (mmc_req_rel_wr(cur) && (md->flags & MMC_BLK_REL_WR) && !en_rel_wr) goto no_packed; if (mmc_large_sec(card) && !IS_ALIGNED(blk_rq_sectors(cur), 8)) goto no_packed; max_blk_count = min(card->host->max_blk_count, card->host->max_req_size >> 9); if (unlikely(max_blk_count > 0xffff)) max_blk_count = 0xffff; max_phys_segs = queue_max_segments(q); req_sectors += blk_rq_sectors(cur); phys_segments += cur->nr_phys_segments; if (rq_data_dir(cur) == WRITE) { req_sectors++; phys_segments++; } spin_lock(&stats->lock); while (reqs < max_packed_rw - 1) { /* We should stop no-more packing its nopacked_period */ if ((card->host->caps2 & MMC_CAP2_ADAPT_PACKED) && time_is_after_jiffies(mq->nopacked_period)) break; spin_lock_irq(q->queue_lock); next = blk_fetch_request(q); spin_unlock_irq(q->queue_lock); if (!next) { MMC_BLK_UPDATE_STOP_REASON(stats, EMPTY_QUEUE); break; } if (mmc_large_sec(card) && !IS_ALIGNED(blk_rq_sectors(next), 8)) { MMC_BLK_UPDATE_STOP_REASON(stats, LARGE_SEC_ALIGN); put_back = 1; break; } if (next->cmd_flags & REQ_DISCARD || next->cmd_flags & REQ_FLUSH) { MMC_BLK_UPDATE_STOP_REASON(stats, FLUSH_OR_DISCARD); put_back = 1; break; } if (rq_data_dir(cur) != rq_data_dir(next)) { MMC_BLK_UPDATE_STOP_REASON(stats, WRONG_DATA_DIR); put_back = 1; break; } if (mmc_req_rel_wr(next) && (md->flags & MMC_BLK_REL_WR) && !en_rel_wr) { MMC_BLK_UPDATE_STOP_REASON(stats, REL_WRITE); put_back = 1; break; } req_sectors += blk_rq_sectors(next); if (req_sectors > max_blk_count) { if (stats->enabled) stats->pack_stop_reason[EXCEEDS_SECTORS]++; put_back = 1; break; } phys_segments += next->nr_phys_segments; if (phys_segments > max_phys_segs) { MMC_BLK_UPDATE_STOP_REASON(stats, EXCEEDS_SEGMENTS); put_back = 1; break; } if (rq_data_dir(next) == WRITE) { mq->num_of_potential_packed_wr_reqs++; if (card->ext_csd.bkops_en) card->bkops_info.sectors_changed += blk_rq_sectors(next); } list_add_tail(&next->queuelist, &mq->mqrq_cur->packed_list); cur = next; reqs++; } if (put_back) { spin_lock_irq(q->queue_lock); blk_requeue_request(q, next); spin_unlock_irq(q->queue_lock); } if (stats->enabled) { if (reqs + 1 <= card->ext_csd.max_packed_writes) stats->packing_events[reqs + 1]++; if (reqs + 1 == max_packed_rw) MMC_BLK_UPDATE_STOP_REASON(stats, THRESHOLD); } spin_unlock(&stats->lock); /* if (stats->enabled) { if (reqs + 1 <= card->ext_csd.max_packed_writes) stats->packing_events[reqs + 1]++; if (reqs + 1 == max_packed_rw) MMC_BLK_UPDATE_STOP_REASON(stats, THRESHOLD); } spin_unlock(&stats->lock); */ if (reqs > 0) { list_add(&req->queuelist, &mq->mqrq_cur->packed_list); mq->mqrq_cur->packed_num = ++reqs; mq->mqrq_cur->packed_retries = reqs; return reqs; } no_packed: mmc_blk_clear_packed(mq->mqrq_cur); return 0; } static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, struct mmc_card *card, struct mmc_queue *mq) { struct mmc_blk_request *brq = &mqrq->brq; struct request *req = mqrq->req; struct request *prq; struct mmc_blk_data *md = mq->data; bool do_rel_wr, do_data_tag; u32 *packed_cmd_hdr = mqrq->packed_cmd_hdr; u8 i = 1; mqrq->packed_cmd = MMC_PACKED_WRITE; mqrq->packed_blocks = 0; mqrq->packed_fail_idx = MMC_PACKED_N_IDX; memset(packed_cmd_hdr, 0, sizeof(mqrq->packed_cmd_hdr)); packed_cmd_hdr[0] = (mqrq->packed_num << 16) | (PACKED_CMD_WR << 8) | PACKED_CMD_VER; /* * Argument for each entry of packed group */ list_for_each_entry(prq, &mqrq->packed_list, queuelist) { do_rel_wr = mmc_req_rel_wr(prq) && (md->flags & MMC_BLK_REL_WR); do_data_tag = (card->ext_csd.data_tag_unit_size) && (prq->cmd_flags & REQ_META) && (rq_data_dir(prq) == WRITE) && ((brq->data.blocks * brq->data.blksz) >= card->ext_csd.data_tag_unit_size); /* Argument of CMD23 */ packed_cmd_hdr[(i * 2)] = (do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) | (do_data_tag ? MMC_CMD23_ARG_TAG_REQ : 0) | blk_rq_sectors(prq); /* Argument of CMD18 or CMD25 */ packed_cmd_hdr[((i * 2)) + 1] = mmc_card_blockaddr(card) ? blk_rq_pos(prq) : blk_rq_pos(prq) << 9; mqrq->packed_blocks += blk_rq_sectors(prq); i++; } memset(brq, 0, sizeof(struct mmc_blk_request)); brq->mrq.cmd = &brq->cmd; brq->mrq.data = &brq->data; brq->mrq.sbc = &brq->sbc; brq->mrq.stop = &brq->stop; brq->sbc.opcode = MMC_SET_BLOCK_COUNT; brq->sbc.arg = MMC_CMD23_ARG_PACKED | (mqrq->packed_blocks + 1); brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC; brq->cmd.opcode = MMC_WRITE_MULTIPLE_BLOCK; brq->cmd.arg = blk_rq_pos(req); if (!mmc_card_blockaddr(card)) brq->cmd.arg <<= 9; brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; brq->data.blksz = 512; brq->data.blocks = mqrq->packed_blocks + 1; brq->data.flags |= MMC_DATA_WRITE; brq->data.fault_injected = false; brq->stop.opcode = MMC_STOP_TRANSMISSION; brq->stop.arg = 0; brq->stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; mmc_set_data_timeout(&brq->data, card); brq->data.sg = mqrq->sg; brq->data.sg_len = mmc_queue_map_sg(mq, mqrq); mqrq->mmc_active.mrq = &brq->mrq; /* * This is intended for packed commands tests usage - in case these * functions are not in use the respective pointers are NULL */ if (mq->err_check_fn) mqrq->mmc_active.err_check = mq->err_check_fn; else mqrq->mmc_active.err_check = mmc_blk_packed_err_check; if (mq->packed_test_fn) mq->packed_test_fn(mq->queue, mqrq); mmc_queue_bounce_pre(mqrq); } static int mmc_blk_cmd_err(struct mmc_blk_data *md, struct mmc_card *card, struct mmc_blk_request *brq, struct request *req, int ret) { struct mmc_queue_req *mq_rq; mq_rq = container_of(brq, struct mmc_queue_req, brq); /* * If this is an SD card and we're writing, we can first * mark the known good sectors as ok. * * If the card is not SD, we can still ok written sectors * as reported by the controller (which might be less than * the real number of written sectors, but never more). */ if (mmc_card_sd(card)) { u32 blocks; if (!brq->data.fault_injected) { blocks = mmc_sd_num_wr_blocks(card); if (blocks != (u32)-1) ret = blk_end_request(req, 0, blocks << 9); } else ret = blk_end_request(req, 0, brq->data.bytes_xfered); } else { if (mq_rq->packed_cmd == MMC_PACKED_NONE) ret = blk_end_request(req, 0, brq->data.bytes_xfered); } return ret; } static int mmc_blk_end_packed_req(struct mmc_queue_req *mq_rq) { struct request *prq; int idx = mq_rq->packed_fail_idx, i = 0; int ret = 0; while (!list_empty(&mq_rq->packed_list)) { prq = list_entry_rq(mq_rq->packed_list.next); if (idx == i) { /* retry from error index */ mq_rq->packed_num -= idx; mq_rq->req = prq; ret = 1; if (mq_rq->packed_num == MMC_PACKED_N_SINGLE) { list_del_init(&prq->queuelist); mmc_blk_clear_packed(mq_rq); } return ret; } list_del_init(&prq->queuelist); blk_end_request(prq, 0, blk_rq_bytes(prq)); i++; } mmc_blk_clear_packed(mq_rq); return ret; } static void mmc_blk_abort_packed_req(struct mmc_queue_req *mq_rq) { struct request *prq; while (!list_empty(&mq_rq->packed_list)) { prq = list_entry_rq(mq_rq->packed_list.next); list_del_init(&prq->queuelist); blk_end_request(prq, -EIO, blk_rq_bytes(prq)); } mmc_blk_clear_packed(mq_rq); } static void mmc_blk_revert_packed_req(struct mmc_queue *mq, struct mmc_queue_req *mq_rq) { struct request *prq; struct request_queue *q = mq->queue; while (!list_empty(&mq_rq->packed_list)) { prq = list_entry_rq(mq_rq->packed_list.prev); if (prq->queuelist.prev != &mq_rq->packed_list) { list_del_init(&prq->queuelist); spin_lock_irq(q->queue_lock); blk_requeue_request(mq->queue, prq); spin_unlock_irq(q->queue_lock); } else { list_del_init(&prq->queuelist); } } mmc_blk_clear_packed(mq_rq); } static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) { struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; struct mmc_blk_request *brq = &mq->mqrq_cur->brq; int ret = 1, disable_multi = 0, retry = 0, type; enum mmc_blk_status status; struct mmc_queue_req *mq_rq; struct request *req; struct mmc_async_req *areq; const u8 packed_num = 2; u8 reqs = 0; if (!rqc && !mq->mqrq_prev->req) return 0; if (rqc) { if ((card->ext_csd.bkops_en) && (rq_data_dir(rqc) == WRITE)) card->bkops_info.sectors_changed += blk_rq_sectors(rqc); reqs = mmc_blk_prep_packed_list(mq, rqc); } do { if (rqc) { if (reqs >= packed_num) mmc_blk_packed_hdr_wrq_prep(mq->mqrq_cur, card, mq); else mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); areq = &mq->mqrq_cur->mmc_active; } else areq = NULL; areq = mmc_start_req(card->host, areq, (int *) &status); if (!areq) { if (status == MMC_BLK_NEW_REQUEST) mq->flags |= MMC_QUEUE_NEW_REQUEST; return 0; } mq_rq = container_of(areq, struct mmc_queue_req, mmc_active); brq = &mq_rq->brq; req = mq_rq->req; type = rq_data_dir(req) == READ ? MMC_BLK_READ : MMC_BLK_WRITE; mmc_queue_bounce_post(mq_rq); switch (status) { case MMC_BLK_SUCCESS: case MMC_BLK_PARTIAL: /* * A block was successfully transferred. */ mmc_blk_reset_success(md, type); if (mq_rq->packed_cmd != MMC_PACKED_NONE) { ret = mmc_blk_end_packed_req(mq_rq); break; } else { ret = blk_end_request(req, 0, brq->data.bytes_xfered); } /* * If the blk_end_request function returns non-zero even * though all data has been transferred and no errors * were returned by the host controller, it's a bug. */ if (status == MMC_BLK_SUCCESS && ret) { pr_err("%s BUG rq_tot %d d_xfer %d\n", __func__, blk_rq_bytes(req), brq->data.bytes_xfered); rqc = NULL; goto cmd_abort; } break; case MMC_BLK_CMD_ERR: ret = mmc_blk_cmd_err(md, card, brq, req, ret); if (!mmc_blk_reset(md, card->host, type)) break; goto cmd_abort; case MMC_BLK_RETRY: if (retry++ < 5) break; /* Fall through */ case MMC_BLK_ABORT: if (!mmc_blk_reset(md, card->host, type)) break; goto cmd_abort; case MMC_BLK_DATA_ERR: { int err; err = mmc_blk_reset(md, card->host, type); if (!err) break; if (err == -ENODEV || mq_rq->packed_cmd != MMC_PACKED_NONE) goto cmd_abort; /* Fall through */ } case MMC_BLK_ECC_ERR: if (brq->data.blocks > 1) { /* Redo read one sector at a time */ pr_warning("%s: retrying using single block read\n", req->rq_disk->disk_name); disable_multi = 1; break; } /* * After an error, we redo I/O one sector at a * time, so we only reach here after trying to * read a single sector. */ ret = blk_end_request(req, -EIO, brq->data.blksz); if (!ret) goto start_new_req; break; case MMC_BLK_NOMEDIUM: goto cmd_abort; default: pr_err("%s: Unhandled return value (%d)", req->rq_disk->disk_name, status); goto cmd_abort; } if (ret) { if (mq_rq->packed_cmd == MMC_PACKED_NONE) { /* * In case of a incomplete request * prepare it again and resend. */ mmc_blk_rw_rq_prep(mq_rq, card, disable_multi, mq); mmc_start_req(card->host, &mq_rq->mmc_active, NULL); } else { if (!mq_rq->packed_retries) goto cmd_abort; mmc_blk_packed_hdr_wrq_prep(mq_rq, card, mq); mmc_start_req(card->host, &mq_rq->mmc_active, NULL); } } } while (ret); return 1; cmd_abort: if (mq_rq->packed_cmd == MMC_PACKED_NONE) { if (mmc_card_removed(card)) req->cmd_flags |= REQ_QUIET; while (ret) ret = blk_end_request(req, -EIO, blk_rq_cur_bytes(req)); } else { mmc_blk_abort_packed_req(mq_rq); } start_new_req: if (rqc) { /* * If current request is packed, it needs to put back. */ if (mq->mqrq_cur->packed_cmd != MMC_PACKED_NONE) mmc_blk_revert_packed_req(mq, mq->mqrq_cur); mmc_blk_rw_rq_prep(mq->mqrq_cur, card, 0, mq); mmc_start_req(card->host, &mq->mqrq_cur->mmc_active, NULL); } return 0; } static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) { int ret; struct mmc_blk_data *md = mq->data; struct mmc_card *card = md->queue.card; struct mmc_host *host = card->host; unsigned long flags; #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME if (mmc_bus_needs_resume(card->host)) { mmc_resume_bus(card->host); mmc_blk_set_blksize(md, card); } #endif if (req && !mq->mqrq_prev->req) { /* claim host only for the first request */ mmc_claim_host(card->host); if (card->ext_csd.bkops_en) mmc_stop_bkops(card); } ret = mmc_blk_part_switch(card, md); if (ret) { if (req) { blk_end_request_all(req, -EIO); } ret = 0; goto out; } mmc_blk_write_packing_control(mq, req); mq->flags &= ~MMC_QUEUE_NEW_REQUEST; if (req && req->cmd_flags & REQ_SANITIZE) { /* complete ongoing async transfer before issuing sanitize */ if (card->host && card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); ret = mmc_blk_issue_sanitize_rq(mq, req); } else if (req && req->cmd_flags & REQ_DISCARD) { /* complete ongoing async transfer before issuing discard */ if (card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); if (req->cmd_flags & REQ_SECURE && !(card->quirks & MMC_QUIRK_SEC_ERASE_TRIM_BROKEN)) ret = mmc_blk_issue_secdiscard_rq(mq, req); else ret = mmc_blk_issue_discard_rq(mq, req); } else if (req && req->cmd_flags & REQ_FLUSH) { /* complete ongoing async transfer before issuing flush */ if (card->host->areq) mmc_blk_issue_rw_rq(mq, NULL); ret = mmc_blk_issue_flush(mq, req); } else { if (!req && host->areq) { spin_lock_irqsave(&host->context_info.lock, flags); host->context_info.is_waiting_last_req = true; spin_unlock_irqrestore(&host->context_info.lock, flags); } ret = mmc_blk_issue_rw_rq(mq, req); } out: if (!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) /* release host only when there are no more requests */ mmc_release_host(card->host); return ret; } static inline int mmc_blk_readonly(struct mmc_card *card) { return mmc_card_readonly(card) || !(card->csd.cmdclass & CCC_BLOCK_WRITE); } static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, struct device *parent, sector_t size, bool default_ro, const char *subname, int area_type) { struct mmc_blk_data *md; int devidx, ret; unsigned int percentage = BKOPS_SIZE_PERCENTAGE_TO_QUEUE_DELAYED_WORK; devidx = find_first_zero_bit(dev_use, max_devices); if (devidx >= max_devices) return ERR_PTR(-ENOSPC); __set_bit(devidx, dev_use); md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL); if (!md) { ret = -ENOMEM; goto out; } /* * !subname implies we are creating main mmc_blk_data that will be * associated with mmc_card with mmc_set_drvdata. Due to device * partitions, devidx will not coincide with a per-physical card * index anymore so we keep track of a name index. */ if (!subname) { md->name_idx = find_first_zero_bit(name_use, max_devices); __set_bit(md->name_idx, name_use); } else md->name_idx = ((struct mmc_blk_data *) dev_to_disk(parent)->private_data)->name_idx; md->area_type = area_type; /* * Set the read-only status based on the supported commands * and the write protect switch. */ md->read_only = mmc_blk_readonly(card); md->disk = alloc_disk(perdev_minors); if (md->disk == NULL) { ret = -ENOMEM; goto err_kfree; } spin_lock_init(&md->lock); INIT_LIST_HEAD(&md->part); md->usage = 1; ret = mmc_init_queue(&md->queue, card, &md->lock, subname); if (ret) goto err_putdisk; md->queue.issue_fn = mmc_blk_issue_rq; md->queue.data = md; md->disk->major = MMC_BLOCK_MAJOR; md->disk->first_minor = devidx * perdev_minors; md->disk->fops = &mmc_bdops; md->disk->private_data = md; md->disk->queue = md->queue.queue; md->disk->driverfs_dev = parent; set_disk_ro(md->disk, md->read_only || default_ro); md->disk->flags = GENHD_FL_EXT_DEVT; /* * As discussed on lkml, GENHD_FL_REMOVABLE should: * * - be set for removable media with permanent block devices * - be unset for removable block devices with permanent media * * Since MMC block devices clearly fall under the second * case, we do not set GENHD_FL_REMOVABLE. Userspace * should use the block device creation/destruction hotplug * messages to tell when the card is present. */ snprintf(md->disk->disk_name, sizeof(md->disk->disk_name), "mmcblk%d%s", md->name_idx, subname ? subname : ""); blk_queue_logical_block_size(md->queue.queue, 512); set_capacity(md->disk, size); card->bkops_info.size_percentage_to_queue_delayed_work = percentage; card->bkops_info.min_sectors_to_queue_delayed_work = ((unsigned int)size * percentage) / 100; if (mmc_host_cmd23(card->host)) { if (mmc_card_mmc(card) || (mmc_card_sd(card) && card->scr.cmds & SD_SCR_CMD23_SUPPORT && mmc_sd_card_uhs(card))) md->flags |= MMC_BLK_CMD23; } if (mmc_card_mmc(card) && md->flags & MMC_BLK_CMD23 && ((card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN) || card->ext_csd.rel_sectors)) { md->flags |= MMC_BLK_REL_WR; blk_queue_flush(md->queue.queue, REQ_FLUSH | REQ_FUA); } return md; err_putdisk: put_disk(md->disk); err_kfree: kfree(md); out: return ERR_PTR(ret); } static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) { sector_t size; struct mmc_blk_data *md; if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { /* * The EXT_CSD sector count is in number or 512 byte * sectors. */ size = card->ext_csd.sectors; } else { /* * The CSD capacity field is in units of read_blkbits. * set_capacity takes units of 512 bytes. */ size = card->csd.capacity << (card->csd.read_blkbits - 9); } md = mmc_blk_alloc_req(card, &card->dev, size, false, NULL, MMC_BLK_DATA_AREA_MAIN); return md; } static int mmc_blk_alloc_part(struct mmc_card *card, struct mmc_blk_data *md, unsigned int part_type, sector_t size, bool default_ro, const char *subname, int area_type) { char cap_str[10]; struct mmc_blk_data *part_md; part_md = mmc_blk_alloc_req(card, disk_to_dev(md->disk), size, default_ro, subname, area_type); if (IS_ERR(part_md)) return PTR_ERR(part_md); part_md->part_type = part_type; list_add(&part_md->part, &md->part); string_get_size((u64)get_capacity(part_md->disk) << 9, STRING_UNITS_2, cap_str, sizeof(cap_str)); pr_info("%s: %s %s partition %u %s\n", part_md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), part_md->part_type, cap_str); return 0; } /* MMC Physical partitions consist of two boot partitions and * up to four general purpose partitions. * For each partition enabled in EXT_CSD a block device will be allocatedi * to provide access to the partition. */ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md) { int idx, ret = 0; if (!mmc_card_mmc(card)) return 0; for (idx = 0; idx < card->nr_parts; idx++) { if (card->part[idx].size) { ret = mmc_blk_alloc_part(card, md, card->part[idx].part_cfg, card->part[idx].size >> 9, card->part[idx].force_ro, card->part[idx].name, card->part[idx].area_type); if (ret) return ret; } } return ret; } static void mmc_blk_remove_req(struct mmc_blk_data *md) { struct mmc_card *card; if (md) { card = md->queue.card; device_remove_file(disk_to_dev(md->disk), &md->num_wr_reqs_to_start_packing); if (md->disk->flags & GENHD_FL_UP) { device_remove_file(disk_to_dev(md->disk), &md->force_ro); if ((md->area_type & MMC_BLK_DATA_AREA_BOOT) && card->ext_csd.boot_ro_lockable) device_remove_file(disk_to_dev(md->disk), &md->power_ro_lock); /* Stop new requests from getting into the queue */ del_gendisk(md->disk); } /* Then flush out any already in there */ mmc_cleanup_queue(&md->queue); mmc_blk_put(md); } } static void mmc_blk_remove_parts(struct mmc_card *card, struct mmc_blk_data *md) { struct list_head *pos, *q; struct mmc_blk_data *part_md; __clear_bit(md->name_idx, name_use); list_for_each_safe(pos, q, &md->part) { part_md = list_entry(pos, struct mmc_blk_data, part); list_del(pos); mmc_blk_remove_req(part_md); } } static int mmc_add_disk(struct mmc_blk_data *md) { int ret; struct mmc_card *card = md->queue.card; add_disk(md->disk); md->force_ro.show = force_ro_show; md->force_ro.store = force_ro_store; sysfs_attr_init(&md->force_ro.attr); md->force_ro.attr.name = "force_ro"; md->force_ro.attr.mode = S_IRUGO | S_IWUSR; ret = device_create_file(disk_to_dev(md->disk), &md->force_ro); if (ret) goto force_ro_fail; if ((md->area_type & MMC_BLK_DATA_AREA_BOOT) && card->ext_csd.boot_ro_lockable) { umode_t mode; if (card->ext_csd.boot_ro_lock & EXT_CSD_BOOT_WP_B_PWR_WP_DIS) mode = S_IRUGO; else mode = S_IRUGO | S_IWUSR; md->power_ro_lock.show = power_ro_lock_show; md->power_ro_lock.store = power_ro_lock_store; sysfs_attr_init(&md->power_ro_lock.attr); md->power_ro_lock.attr.mode = mode; md->power_ro_lock.attr.name = "ro_lock_until_next_power_on"; ret = device_create_file(disk_to_dev(md->disk), &md->power_ro_lock); if (ret) goto power_ro_lock_fail; } md->num_wr_reqs_to_start_packing.show = num_wr_reqs_to_start_packing_show; md->num_wr_reqs_to_start_packing.store = num_wr_reqs_to_start_packing_store; sysfs_attr_init(&md->num_wr_reqs_to_start_packing.attr); md->num_wr_reqs_to_start_packing.attr.name = "num_wr_reqs_to_start_packing"; md->num_wr_reqs_to_start_packing.attr.mode = S_IRUGO | S_IWUSR; ret = device_create_file(disk_to_dev(md->disk), &md->num_wr_reqs_to_start_packing); if (ret) goto num_wr_reqs_to_start_packing_fail; md->bkops_check_threshold.show = bkops_check_threshold_show; md->bkops_check_threshold.store = bkops_check_threshold_store; sysfs_attr_init(&md->bkops_check_threshold.attr); md->bkops_check_threshold.attr.name = "bkops_check_threshold"; md->bkops_check_threshold.attr.mode = S_IRUGO | S_IWUSR; ret = device_create_file(disk_to_dev(md->disk), &md->bkops_check_threshold); if (ret) goto bkops_check_threshold_fails; return ret; bkops_check_threshold_fails: device_remove_file(disk_to_dev(md->disk), &md->num_wr_reqs_to_start_packing); num_wr_reqs_to_start_packing_fail: device_remove_file(disk_to_dev(md->disk), &md->power_ro_lock); power_ro_lock_fail: device_remove_file(disk_to_dev(md->disk), &md->force_ro); force_ro_fail: del_gendisk(md->disk); return ret; } #define CID_MANFID_SANDISK 0x2 #define CID_MANFID_TOSHIBA 0x11 #define CID_MANFID_MICRON 0x13 #define CID_MANFID_SAMSUNG 0x15 static const struct mmc_fixup blk_fixups[] = { MMC_FIXUP("SEM02G", CID_MANFID_SANDISK, 0x100, add_quirk, MMC_QUIRK_INAND_CMD38), MMC_FIXUP("SEM04G", CID_MANFID_SANDISK, 0x100, add_quirk, MMC_QUIRK_INAND_CMD38), MMC_FIXUP("SEM08G", CID_MANFID_SANDISK, 0x100, add_quirk, MMC_QUIRK_INAND_CMD38), MMC_FIXUP("SEM16G", CID_MANFID_SANDISK, 0x100, add_quirk, MMC_QUIRK_INAND_CMD38), MMC_FIXUP("SEM32G", CID_MANFID_SANDISK, 0x100, add_quirk, MMC_QUIRK_INAND_CMD38), /* * Some MMC cards experience performance degradation with CMD23 * instead of CMD12-bounded multiblock transfers. For now we'll * black list what's bad... * - Certain Toshiba cards. * * N.B. This doesn't affect SD cards. */ MMC_FIXUP("MMC08G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_BLK_NO_CMD23), MMC_FIXUP("MMC16G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_BLK_NO_CMD23), MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_BLK_NO_CMD23), /* * Some Micron MMC cards needs longer data read timeout than * indicated in CSD. */ MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc, MMC_QUIRK_LONG_READ_TIME), /* Some INAND MCP devices advertise incorrect timeout values */ MMC_FIXUP("SEM04G", 0x45, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_INAND_DATA_TIMEOUT), /* * On these Samsung MoviNAND parts, performing secure erase or * secure trim can result in unrecoverable corruption due to a * firmware bug. */ MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_SEC_ERASE_TRIM_BROKEN), MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_SEC_ERASE_TRIM_BROKEN), MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_SEC_ERASE_TRIM_BROKEN), MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_SEC_ERASE_TRIM_BROKEN), MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_SEC_ERASE_TRIM_BROKEN), MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_SEC_ERASE_TRIM_BROKEN), MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_SEC_ERASE_TRIM_BROKEN), MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc, MMC_QUIRK_SEC_ERASE_TRIM_BROKEN), END_FIXUP }; #ifdef CONFIG_MMC_SUPPORT_BKOPS_MODE static ssize_t bkops_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { struct gendisk *disk; struct mmc_blk_data *md; struct mmc_card *card; disk = dev_to_disk(dev); if (disk) md = disk->private_data; else goto show_out; if (md) card = md->queue.card; else goto show_out; return snprintf(buf, PAGE_SIZE, "%u\n", card->bkops_enable); show_out: return snprintf(buf, PAGE_SIZE, "\n"); } static ssize_t bkops_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct gendisk *disk; struct mmc_blk_data *md; struct mmc_card *card; u8 value; int err = 0; disk = dev_to_disk(dev); if (disk) md = disk->private_data; else goto store_out; if (md) card = md->queue.card; else goto store_out; if (kstrtou8(buf, 0, &value)) goto store_out; err = mmc_bkops_enable(card->host, value); if (err) return err; return count; store_out: return -EINVAL; } static inline void mmc_blk_bkops_sysfs_init(struct mmc_card *card) { struct mmc_blk_data *md = mmc_get_drvdata(card); card->bkops_attr.show = bkops_mode_show; card->bkops_attr.store = bkops_mode_store; sysfs_attr_init(&card->bkops_attr.attr); card->bkops_attr.attr.name = "bkops_en"; card->bkops_attr.attr.mode = S_IRUGO | S_IWUSR | S_IWGRP; if (device_create_file((disk_to_dev(md->disk)), &card->bkops_attr)) { pr_err("%s: Failed to create bkops_en sysfs entry\n", mmc_hostname(card->host)); #if defined(CONFIG_MMC_BKOPS_NODE_UID) || defined(CONFIG_MMC_BKOPS_NODE_GID) } else { int rc; struct device * dev; dev = disk_to_dev(md->disk); rc = sysfs_chown_file(&dev->kobj, &card->bkops_attr.attr, CONFIG_MMC_BKOPS_NODE_UID, CONFIG_MMC_BKOPS_NODE_GID); if (rc) pr_err("%s: Failed to change mode of sysfs entry\n", mmc_hostname(card->host)); #endif } } #else static inline void mmc_blk_bkops_sysfs_init(struct mmc_card *card) { } #endif static int mmc_blk_probe(struct mmc_card *card) { struct mmc_blk_data *md, *part_md; char cap_str[10]; /* * Check that the card supports the command class(es) we need. */ if (!(card->csd.cmdclass & CCC_BLOCK_READ)) return -ENODEV; md = mmc_blk_alloc(card); if (IS_ERR(md)) return PTR_ERR(md); string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2, cap_str, sizeof(cap_str)); pr_info("%s: %s %s %s %s\n", md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), cap_str, md->read_only ? "(ro)" : ""); if (mmc_blk_alloc_parts(card, md)) goto out; mmc_set_drvdata(card, md); mmc_fixup_device(card, blk_fixups); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME mmc_set_bus_resume_policy(card->host, 1); #endif if (mmc_add_disk(md)) goto out; list_for_each_entry(part_md, &md->part, part) { if (mmc_add_disk(part_md)) goto out; } /* init sysfs for bkops mode */ if (card && mmc_card_mmc(card)) { mmc_blk_bkops_sysfs_init(card); spin_lock_init(&card->bkops_lock); } return 0; out: mmc_blk_remove_parts(card, md); mmc_blk_remove_req(md); return 0; } static void mmc_blk_remove(struct mmc_card *card) { struct mmc_blk_data *md = mmc_get_drvdata(card); mmc_blk_remove_parts(card, md); mmc_claim_host(card->host); mmc_blk_part_switch(card, md); mmc_release_host(card->host); mmc_blk_remove_req(md); mmc_set_drvdata(card, NULL); #ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME mmc_set_bus_resume_policy(card->host, 0); #endif } #ifdef CONFIG_PM static int mmc_blk_suspend(struct mmc_card *card) { struct mmc_blk_data *part_md; struct mmc_blk_data *md = mmc_get_drvdata(card); int rc = 0; if (md) { rc = mmc_queue_suspend(&md->queue); if (rc) goto out; list_for_each_entry(part_md, &md->part, part) { rc = mmc_queue_suspend(&part_md->queue); if (rc) goto out_resume; } } goto out; out_resume: mmc_queue_resume(&md->queue); list_for_each_entry(part_md, &md->part, part) { mmc_queue_resume(&part_md->queue); } out: return rc; } static int mmc_blk_resume(struct mmc_card *card) { struct mmc_blk_data *part_md; struct mmc_blk_data *md = mmc_get_drvdata(card); if (md) { /* * Resume involves the card going into idle state, * so current partition is always the main one. */ md->part_curr = md->part_type; mmc_queue_resume(&md->queue); list_for_each_entry(part_md, &md->part, part) { mmc_queue_resume(&part_md->queue); } } return 0; } #else #define mmc_blk_suspend NULL #define mmc_blk_resume NULL #endif static struct mmc_driver mmc_driver = { .drv = { .name = "mmcblk", }, .probe = mmc_blk_probe, .remove = mmc_blk_remove, .suspend = mmc_blk_suspend, .resume = mmc_blk_resume, }; static int __init mmc_blk_init(void) { int res; if (perdev_minors != CONFIG_MMC_BLOCK_MINORS) pr_info("mmcblk: using %d minors per device\n", perdev_minors); max_devices = 256 / perdev_minors; res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); if (res) goto out; res = mmc_register_driver(&mmc_driver); if (res) goto out2; return 0; out2: unregister_blkdev(MMC_BLOCK_MAJOR, "mmc"); out: return res; } static void __exit mmc_blk_exit(void) { mmc_unregister_driver(&mmc_driver); unregister_blkdev(MMC_BLOCK_MAJOR, "mmc"); } module_init(mmc_blk_init); module_exit(mmc_blk_exit); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
Java
--- layout: post title: Air America Radio author: Chris Metcalf date: 2004/03/31 slug: air-america-radio category: tags: [ politics ] --- Apparently <a href="http://www.airamericaradio.com/">Air America Radio</a> launched today. Somehow the idea of listening to Al Franken and Janeane Garofalo all day long doesn't really turn me on. Somehow his days on Comedy Central don't really let me see him as a powerful political figure. If you've got to make Liberalism funny to get people to listen to it, you've got more things to worry about.
Java
using System; using Server.Mobiles; using Server.Network; using Server.Targeting; namespace Server.Spells.First { public class HealSpell : MagerySpell { private static readonly SpellInfo m_Info = new SpellInfo( "Heal", "In Mani", 224, 9061, Reagent.Garlic, Reagent.Ginseng, Reagent.SpidersSilk); public HealSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info) { } public override SpellCircle Circle { get { return SpellCircle.First; } } public override bool CheckCast() { if (Engines.ConPVP.DuelContext.CheckSuddenDeath(this.Caster)) { this.Caster.SendMessage(0x22, "You cannot cast this spell when in sudden death."); return false; } return base.CheckCast(); } public override void OnCast() { this.Caster.Target = new InternalTarget(this); } public void Target(Mobile m) { if (!this.Caster.CanSee(m)) { this.Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (m.IsDeadBondedPet) { this.Caster.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead! } else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead) { this.Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive. } else if (m is IRepairableMobile) { this.Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500951); // You cannot heal that. } else if (m.Poisoned || Server.Items.MortalStrike.IsWounded(m)) { this.Caster.LocalOverheadMessage(MessageType.Regular, 0x22, (this.Caster == m) ? 1005000 : 1010398); } else if (this.CheckBSequence(m)) { SpellHelper.Turn(this.Caster, m); int toHeal; if (Core.AOS) { toHeal = this.Caster.Skills.Magery.Fixed / 120; toHeal += Utility.RandomMinMax(1, 4); if (Core.SE && this.Caster != m) toHeal = (int)(toHeal * 1.5); } else { toHeal = (int)(this.Caster.Skills[SkillName.Magery].Value * 0.1); toHeal += Utility.Random(1, 5); } //m.Heal( toHeal, Caster ); SpellHelper.Heal(toHeal, m, this.Caster); m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist); m.PlaySound(0x1F2); } this.FinishSequence(); } public class InternalTarget : Target { private readonly HealSpell m_Owner; public InternalTarget(HealSpell owner) : base(Core.ML ? 10 : 12, false, TargetFlags.Beneficial) { this.m_Owner = owner; } protected override void OnTarget(Mobile from, object o) { if (o is Mobile) { this.m_Owner.Target((Mobile)o); } } protected override void OnTargetFinish(Mobile from) { this.m_Owner.FinishSequence(); } } } }
Java
--- id: 9987 title: 慈悲为怀 date: 2009-02-17T17:48:00+00:00 author: jiang layout: post guid: http://li-and-jiang.com/blog/2009/02/17/%e6%85%88%e6%82%b2%e4%b8%ba%e6%80%80/ permalink: /2009/02/17/%e6%85%88%e6%82%b2%e4%b8%ba%e6%80%80/ categories: - 生活 --- [<img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px" height="64" alt="rak" src="http://byfiles.storage.msn.com/y1pm4z_6pUecHisRHPg-yJh52XeNtAgI9HX0UQel9yoLSRcrBahPtjY_rS82pNW0kjspkViQYxJlm8hAMazX1hfUg?PARTNER=WRITER" width="244" border="0" />](http://byfiles.storage.msn.com/y1pzm9_q0nFiMzzhHghqPN41-ynTy536wx5LR1DnO1VfkK8trCNNCeS66ebZDtnp9Xr?PARTNER=WRITER) 早上七点半,海淀万柳,起来就见外头地面铺成了一层雪,出门时雪还比较大。待九点,到宣武门,就墙角见一些积雪,天空若无其事地阴着,地面也若无其事地跟昨天一样。噫,南北之大防,其斯之谓与? 下班时习惯地看看公司主页的Quote of the Day,乖乖,今天是洋人们的Random Acts of Kindness Day。<a href="http://en.wikipedia.org/wiki/Random_act_of_kindness " target="_blank">Random Acts of Kindness</a>,就是随意地做些好事,比如替人带份盒饭,多给些小费,再买一份中关村大街小摊的烤红薯之类。有时人们把它翻成“慈悲为怀”,似乎太严肃了。著名的政治家密斯脱Alibaba Gamma说: > If you want others to be happy, practice compassion. If you want to be happy, practice compassion. 有人翻译得好: > 欲令众生离苦得乐,当修大悲心;欲令自我离苦得乐,当修大悲心。 说,宗教这东西,如果不够幽默大度,很容易陷入贾恩市义之类功利主义的泥沼。
Java
<?php /* +---------------------------------------------------------------------------+ | OpenX v2.8 | | ========== | | | | Copyright (c) 2003-2009 OpenX Limited | | For contact details, see: http://www.openx.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 | +---------------------------------------------------------------------------+ $Id: BasePublisherService.php 79311 2011-11-03 21:18:14Z chris.nutting $ */ /** * @package OpenX * @author Andriy Petlyovanyy <apetlyovanyy@lohika.com> * */ // Require Publisher Service Implementation require_once MAX_PATH . '/www/api/v2/xmlrpc/PublisherServiceImpl.php'; /** * Base Publisher Service * */ class BasePublisherService { /** * Reference to Publisher Service implementation. * * @var PublisherServiceImpl $_oPublisherServiceImp */ var $_oPublisherServiceImp; /** * This method initialises Service implementation object field. * */ function BasePublisherService() { $this->_oPublisherServiceImp = new PublisherServiceImpl(); } } ?>
Java
/* * This file is part of the coreboot project. * * Copyright (C) 2007-2009 coresystems GmbH * Copyright (C) 2013 Google Inc. * Copyright (C) 2015 Intel Corporation. * * 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; version 2 of the License. * * 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. */ #include <arch/acpi.h> #include <console/console.h> #include <device/device.h> #include <gpio.h> #include <stdlib.h> #include <string.h> #include <soc/nhlt.h> #include "ec.h" #include "gpio.h" static const char *oem_id_maxim = "INTEL"; static const char *oem_table_id_maxim = "SCRDMAX"; static void mainboard_init(device_t dev) { mainboard_ec_init(); } static uint8_t select_audio_codec(void) { int audio_db_sel = gpio_get(AUDIO_DB_ID); return audio_db_sel; } static unsigned long mainboard_write_acpi_tables( device_t device, unsigned long current, acpi_rsdp_t *rsdp) { uintptr_t start_addr; uintptr_t end_addr; struct nhlt *nhlt; const char *oem_id = NULL; const char *oem_table_id = NULL; start_addr = current; nhlt = nhlt_init(); if (nhlt == NULL) return start_addr; /* 2 Channel DMIC array. */ if (nhlt_soc_add_dmic_array(nhlt, 2)) printk(BIOS_ERR, "Couldn't add 2CH DMIC array.\n"); /* 4 Channel DMIC array. */ if (nhlt_soc_add_dmic_array(nhlt, 4)) printk(BIOS_ERR, "Couldn't add 4CH DMIC arrays.\n"); if (select_audio_codec()) { /* ADI Smart Amps for left and right. */ if (nhlt_soc_add_ssm4567(nhlt, AUDIO_LINK_SSP0)) printk(BIOS_ERR, "Couldn't add ssm4567.\n"); } else { /* MAXIM Smart Amps for left and right. */ if (nhlt_soc_add_max98357(nhlt, AUDIO_LINK_SSP0)) printk(BIOS_ERR, "Couldn't add max98357.\n"); oem_id = oem_id_maxim; oem_table_id = oem_table_id_maxim; } /* NAU88l25 Headset codec. */ if (nhlt_soc_add_nau88l25(nhlt, AUDIO_LINK_SSP1)) printk(BIOS_ERR, "Couldn't add headset codec.\n"); end_addr = nhlt_soc_serialize_oem_overrides(nhlt, start_addr, oem_id, oem_table_id); if (end_addr != start_addr) acpi_add_table(rsdp, (void *)start_addr); return end_addr; } /* * mainboard_enable is executed as first thing after * enumerate_buses(). */ static void mainboard_enable(device_t dev) { dev->ops->init = mainboard_init; dev->ops->write_acpi_tables = mainboard_write_acpi_tables; } struct chip_operations mainboard_ops = { .enable_dev = mainboard_enable, };
Java
/* * Driver O/S-independent utility routines * * Copyright (C) 1999-2010, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2 (the "GPL"), * available at http://www.broadcom.com/licenses/GPLv2.php, with the * following added to such license: * * As a special exception, the copyright holders of this software give you * permission to link this software with 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 this software. The special exception does not apply to any * modifications of the software. * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * $Id: bcmutils.c,v 1.210.4.5.2.4.6.19 2010/04/26 06:05:25 Exp $ */ #include <typedefs.h> #include <bcmdefs.h> #include <stdarg.h> #include <bcmutils.h> #ifdef BCMDRIVER #include <osl.h> #include <siutils.h> #else #include <stdio.h> #include <string.h> /* This case for external supplicant use */ #if defined(BCMEXTSUP) #include <bcm_osl.h> #endif #endif /* BCMDRIVER */ #include <bcmendian.h> #include <bcmdevs.h> #include <proto/ethernet.h> #include <proto/vlan.h> #include <proto/bcmip.h> #include <proto/802.1d.h> #include <proto/802.11.h> #ifdef BCMDRIVER /* copy a pkt buffer chain into a buffer */ uint pktcopy(osl_t *osh, void *p, uint offset, int len, uchar *buf) { uint n, ret = 0; if (len < 0) len = 4096; /* "infinite" */ /* skip 'offset' bytes */ for (; p && offset; p = PKTNEXT(osh, p)) { if (offset < (uint)PKTLEN(osh, p)) break; offset -= PKTLEN(osh, p); } if (!p) return 0; /* copy the data */ for (; p && len; p = PKTNEXT(osh, p)) { n = MIN((uint)PKTLEN(osh, p) - offset, (uint)len); bcopy(PKTDATA(osh, p) + offset, buf, n); buf += n; len -= n; ret += n; offset = 0; } return ret; } /* copy a buffer into a pkt buffer chain */ uint pktfrombuf(osl_t *osh, void *p, uint offset, int len, uchar *buf) { uint n, ret = 0; /* skip 'offset' bytes */ for (; p && offset; p = PKTNEXT(osh, p)) { if (offset < (uint)PKTLEN(osh, p)) break; offset -= PKTLEN(osh, p); } if (!p) return 0; /* copy the data */ for (; p && len; p = PKTNEXT(osh, p)) { n = MIN((uint)PKTLEN(osh, p) - offset, (uint)len); bcopy(buf, PKTDATA(osh, p) + offset, n); buf += n; len -= n; ret += n; offset = 0; } return ret; } /* return total length of buffer chain */ uint pkttotlen(osl_t *osh, void *p) { uint total; total = 0; for (; p; p = PKTNEXT(osh, p)) total += PKTLEN(osh, p); return (total); } /* return the last buffer of chained pkt */ void * pktlast(osl_t *osh, void *p) { for (; PKTNEXT(osh, p); p = PKTNEXT(osh, p)) ; return (p); } /* count segments of a chained packet */ uint pktsegcnt(osl_t *osh, void *p) { uint cnt; for (cnt = 0; p; p = PKTNEXT(osh, p)) cnt++; return cnt; } /* * osl multiple-precedence packet queue * hi_prec is always >= the number of the highest non-empty precedence */ void * pktq_penq(struct pktq *pq, int prec, void *p) { struct pktq_prec *q; ASSERT(prec >= 0 && prec < pq->num_prec); ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */ ASSERT(!pktq_full(pq)); ASSERT(!pktq_pfull(pq, prec)); q = &pq->q[prec]; if (q->head) PKTSETLINK(q->tail, p); else q->head = p; q->tail = p; q->len++; pq->len++; if (pq->hi_prec < prec) pq->hi_prec = (uint8)prec; return p; } void * pktq_penq_head(struct pktq *pq, int prec, void *p) { struct pktq_prec *q; ASSERT(prec >= 0 && prec < pq->num_prec); ASSERT(PKTLINK(p) == NULL); /* queueing chains not allowed */ ASSERT(!pktq_full(pq)); ASSERT(!pktq_pfull(pq, prec)); q = &pq->q[prec]; if (q->head == NULL) q->tail = p; PKTSETLINK(p, q->head); q->head = p; q->len++; pq->len++; if (pq->hi_prec < prec) pq->hi_prec = (uint8)prec; return p; } void * pktq_pdeq(struct pktq *pq, int prec) { struct pktq_prec *q; void *p; ASSERT(prec >= 0 && prec < pq->num_prec); q = &pq->q[prec]; if ((p = q->head) == NULL) return NULL; if ((q->head = PKTLINK(p)) == NULL) q->tail = NULL; q->len--; pq->len--; PKTSETLINK(p, NULL); return p; } void * pktq_pdeq_tail(struct pktq *pq, int prec) { struct pktq_prec *q; void *p, *prev; ASSERT(prec >= 0 && prec < pq->num_prec); q = &pq->q[prec]; if ((p = q->head) == NULL) return NULL; for (prev = NULL; p != q->tail; p = PKTLINK(p)) prev = p; if (prev) PKTSETLINK(prev, NULL); else q->head = NULL; q->tail = prev; q->len--; pq->len--; return p; } void pktq_pflush(osl_t *osh, struct pktq *pq, int prec, bool dir) { struct pktq_prec *q; void *p; q = &pq->q[prec]; p = q->head; while (p) { q->head = PKTLINK(p); PKTSETLINK(p, NULL); PKTFREE(osh, p, dir); q->len--; pq->len--; p = q->head; } ASSERT(q->len == 0); q->tail = NULL; } bool pktq_pdel(struct pktq *pq, void *pktbuf, int prec) { struct pktq_prec *q; void *p; ASSERT(prec >= 0 && prec < pq->num_prec); if (!pktbuf) return FALSE; q = &pq->q[prec]; if (q->head == pktbuf) { if ((q->head = PKTLINK(pktbuf)) == NULL) q->tail = NULL; } else { for (p = q->head; p && PKTLINK(p) != pktbuf; p = PKTLINK(p)) ; if (p == NULL) return FALSE; PKTSETLINK(p, PKTLINK(pktbuf)); if (q->tail == pktbuf) q->tail = p; } q->len--; pq->len--; PKTSETLINK(pktbuf, NULL); return TRUE; } void pktq_init(struct pktq *pq, int num_prec, int max_len) { int prec; ASSERT(num_prec > 0 && num_prec <= PKTQ_MAX_PREC); /* pq is variable size; only zero out what's requested */ bzero(pq, OFFSETOF(struct pktq, q) + (sizeof(struct pktq_prec) * num_prec)); pq->num_prec = (uint16)num_prec; pq->max = (uint16)max_len; for (prec = 0; prec < num_prec; prec++) pq->q[prec].max = pq->max; } void * pktq_deq(struct pktq *pq, int *prec_out) { struct pktq_prec *q; void *p; int prec; if (pq->len == 0) return NULL; while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) pq->hi_prec--; q = &pq->q[prec]; if ((p = q->head) == NULL) return NULL; if ((q->head = PKTLINK(p)) == NULL) q->tail = NULL; q->len--; pq->len--; if (prec_out) *prec_out = prec; PKTSETLINK(p, NULL); return p; } void * pktq_deq_tail(struct pktq *pq, int *prec_out) { struct pktq_prec *q; void *p, *prev; int prec; if (pq->len == 0) return NULL; for (prec = 0; prec < pq->hi_prec; prec++) if (pq->q[prec].head) break; q = &pq->q[prec]; if ((p = q->head) == NULL) return NULL; for (prev = NULL; p != q->tail; p = PKTLINK(p)) prev = p; if (prev) PKTSETLINK(prev, NULL); else q->head = NULL; q->tail = prev; q->len--; pq->len--; if (prec_out) *prec_out = prec; PKTSETLINK(p, NULL); return p; } void * pktq_peek(struct pktq *pq, int *prec_out) { int prec; if (pq->len == 0) return NULL; while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) pq->hi_prec--; if (prec_out) *prec_out = prec; return (pq->q[prec].head); } void * pktq_peek_tail(struct pktq *pq, int *prec_out) { int prec; if (pq->len == 0) return NULL; for (prec = 0; prec < pq->hi_prec; prec++) if (pq->q[prec].head) break; if (prec_out) *prec_out = prec; return (pq->q[prec].tail); } void pktq_flush(osl_t *osh, struct pktq *pq, bool dir) { int prec; for (prec = 0; prec < pq->num_prec; prec++) pktq_pflush(osh, pq, prec, dir); ASSERT(pq->len == 0); } /* Return sum of lengths of a specific set of precedences */ int pktq_mlen(struct pktq *pq, uint prec_bmp) { int prec, len; len = 0; for (prec = 0; prec <= pq->hi_prec; prec++) if (prec_bmp & (1 << prec)) len += pq->q[prec].len; return len; } /* Priority dequeue from a specific set of precedences */ void * pktq_mdeq(struct pktq *pq, uint prec_bmp, int *prec_out) { struct pktq_prec *q; void *p; int prec; if (pq->len == 0) return NULL; while ((prec = pq->hi_prec) > 0 && pq->q[prec].head == NULL) pq->hi_prec--; while ((prec_bmp & (1 << prec)) == 0 || pq->q[prec].head == NULL) if (prec-- == 0) return NULL; q = &pq->q[prec]; if ((p = q->head) == NULL) return NULL; if ((q->head = PKTLINK(p)) == NULL) q->tail = NULL; q->len--; if (prec_out) *prec_out = prec; pq->len--; PKTSETLINK(p, NULL); return p; } #endif /* BCMDRIVER */ const unsigned char bcm_ctype[] = { _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 0-7 */ _BCM_C, _BCM_C|_BCM_S, _BCM_C|_BCM_S, _BCM_C|_BCM_S, _BCM_C|_BCM_S, _BCM_C|_BCM_S, _BCM_C, _BCM_C, /* 8-15 */ _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 16-23 */ _BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C,_BCM_C, /* 24-31 */ _BCM_S|_BCM_SP,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 32-39 */ _BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 40-47 */ _BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D,_BCM_D, /* 48-55 */ _BCM_D,_BCM_D,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 56-63 */ _BCM_P, _BCM_U|_BCM_X, _BCM_U|_BCM_X, _BCM_U|_BCM_X, _BCM_U|_BCM_X, _BCM_U|_BCM_X, _BCM_U|_BCM_X, _BCM_U, /* 64-71 */ _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 72-79 */ _BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U,_BCM_U, /* 80-87 */ _BCM_U,_BCM_U,_BCM_U,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_P, /* 88-95 */ _BCM_P, _BCM_L|_BCM_X, _BCM_L|_BCM_X, _BCM_L|_BCM_X, _BCM_L|_BCM_X, _BCM_L|_BCM_X, _BCM_L|_BCM_X, _BCM_L, /* 96-103 */ _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 104-111 */ _BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L,_BCM_L, /* 112-119 */ _BCM_L,_BCM_L,_BCM_L,_BCM_P,_BCM_P,_BCM_P,_BCM_P,_BCM_C, /* 120-127 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 128-143 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 144-159 */ _BCM_S|_BCM_SP, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, /* 160-175 */ _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, _BCM_P, /* 176-191 */ _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, /* 192-207 */ _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_P, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_U, _BCM_L, /* 208-223 */ _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, /* 224-239 */ _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_P, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L, _BCM_L /* 240-255 */ }; ulong bcm_strtoul(char *cp, char **endp, uint base) { ulong result, last_result = 0, value; bool minus; minus = FALSE; while (bcm_isspace(*cp)) cp++; if (cp[0] == '+') cp++; else if (cp[0] == '-') { minus = TRUE; cp++; } if (base == 0) { if (cp[0] == '0') { if ((cp[1] == 'x') || (cp[1] == 'X')) { base = 16; cp = &cp[2]; } else { base = 8; cp = &cp[1]; } } else base = 10; } else if (base == 16 && (cp[0] == '0') && ((cp[1] == 'x') || (cp[1] == 'X'))) { cp = &cp[2]; } result = 0; while (bcm_isxdigit(*cp) && (value = bcm_isdigit(*cp) ? *cp-'0' : bcm_toupper(*cp)-'A'+10) < base) { result = result*base + value; /* Detected overflow */ if (result < last_result && !minus) return (ulong)-1; last_result = result; cp++; } if (minus) result = (ulong)(-(long)result); if (endp) *endp = (char *)cp; return (result); } int bcm_atoi(char *s) { return (int)bcm_strtoul(s, NULL, 10); } /* return pointer to location of substring 'needle' in 'haystack' */ char* bcmstrstr(char *haystack, char *needle) { int len, nlen; int i; if ((haystack == NULL) || (needle == NULL)) return (haystack); nlen = strlen(needle); len = strlen(haystack) - nlen + 1; for (i = 0; i < len; i++) if (memcmp(needle, &haystack[i], nlen) == 0) return (&haystack[i]); return (NULL); } char* bcmstrcat(char *dest, const char *src) { char *p; p = dest + strlen(dest); while ((*p++ = *src++) != '\0') ; return (dest); } char* bcmstrncat(char *dest, const char *src, uint size) { char *endp; char *p; p = dest + strlen(dest); endp = p + size; while (p != endp && (*p++ = *src++) != '\0') ; return (dest); } /**************************************************************************** * Function: bcmstrtok * * Purpose: * Tokenizes a string. This function is conceptually similiar to ANSI C strtok(), * but allows strToken() to be used by different strings or callers at the same * time. Each call modifies '*string' by substituting a NULL character for the * first delimiter that is encountered, and updates 'string' to point to the char * after the delimiter. Leading delimiters are skipped. * * Parameters: * string (mod) Ptr to string ptr, updated by token. * delimiters (in) Set of delimiter characters. * tokdelim (out) Character that delimits the returned token. (May * be set to NULL if token delimiter is not required). * * Returns: Pointer to the next token found. NULL when no more tokens are found. ***************************************************************************** */ char * bcmstrtok(char **string, const char *delimiters, char *tokdelim) { unsigned char *str; unsigned long map[8]; int count; char *nextoken; if (tokdelim != NULL) { /* Prime the token delimiter */ *tokdelim = '\0'; } /* Clear control map */ for (count = 0; count < 8; count++) { map[count] = 0; } /* Set bits in delimiter table */ do { map[*delimiters >> 5] |= (1 << (*delimiters & 31)); } while (*delimiters++); str = (unsigned char*)*string; /* Find beginning of token (skip over leading delimiters). Note that * there is no token iff this loop sets str to point to the terminal * null (*str == '\0') */ while (((map[*str >> 5] & (1 << (*str & 31))) && *str) || (*str == ' ')) { str++; } nextoken = (char*)str; /* Find the end of the token. If it is not the end of the string, * put a null there. */ for (; *str; str++) { if (map[*str >> 5] & (1 << (*str & 31))) { if (tokdelim != NULL) { *tokdelim = *str; } *str++ = '\0'; break; } } *string = (char*)str; /* Determine if a token has been found. */ if (nextoken == (char *) str) { return NULL; } else { return nextoken; } } #define xToLower(C) \ ((C >= 'A' && C <= 'Z') ? (char)((int)C - (int)'A' + (int)'a') : C) /**************************************************************************** * Function: bcmstricmp * * Purpose: Compare to strings case insensitively. * * Parameters: s1 (in) First string to compare. * s2 (in) Second string to compare. * * Returns: Return 0 if the two strings are equal, -1 if t1 < t2 and 1 if * t1 > t2, when ignoring case sensitivity. ***************************************************************************** */ int bcmstricmp(const char *s1, const char *s2) { char dc, sc; while (*s2 && *s1) { dc = xToLower(*s1); sc = xToLower(*s2); if (dc < sc) return -1; if (dc > sc) return 1; s1++; s2++; } if (*s1 && !*s2) return 1; if (!*s1 && *s2) return -1; return 0; } /**************************************************************************** * Function: bcmstrnicmp * * Purpose: Compare to strings case insensitively, upto a max of 'cnt' * characters. * * Parameters: s1 (in) First string to compare. * s2 (in) Second string to compare. * cnt (in) Max characters to compare. * * Returns: Return 0 if the two strings are equal, -1 if t1 < t2 and 1 if * t1 > t2, when ignoring case sensitivity. ***************************************************************************** */ int bcmstrnicmp(const char* s1, const char* s2, int cnt) { char dc, sc; while (*s2 && *s1 && cnt) { dc = xToLower(*s1); sc = xToLower(*s2); if (dc < sc) return -1; if (dc > sc) return 1; s1++; s2++; cnt--; } if (!cnt) return 0; if (*s1 && !*s2) return 1; if (!*s1 && *s2) return -1; return 0; } /* parse a xx:xx:xx:xx:xx:xx format ethernet address */ int bcm_ether_atoe(char *p, struct ether_addr *ea) { int i = 0; for (;;) { ea->octet[i++] = (char) bcm_strtoul(p, &p, 16); if (!*p++ || i == 6) break; } return (i == 6); } #if defined(CONFIG_USBRNDIS_RETAIL) || defined(NDIS_MINIPORT_DRIVER) /* registry routine buffer preparation utility functions: * parameter order is like strncpy, but returns count * of bytes copied. Minimum bytes copied is null char(1)/wchar(2) */ ulong wchar2ascii(char *abuf, ushort *wbuf, ushort wbuflen, ulong abuflen) { ulong copyct = 1; ushort i; if (abuflen == 0) return 0; /* wbuflen is in bytes */ wbuflen /= sizeof(ushort); for (i = 0; i < wbuflen; ++i) { if (--abuflen == 0) break; *abuf++ = (char) *wbuf++; ++copyct; } *abuf = '\0'; return copyct; } #endif /* CONFIG_USBRNDIS_RETAIL || NDIS_MINIPORT_DRIVER */ char * bcm_ether_ntoa(const struct ether_addr *ea, char *buf) { static const char template[] = "%02x:%02x:%02x:%02x:%02x:%02x"; snprintf(buf, 18, template, ea->octet[0]&0xff, ea->octet[1]&0xff, ea->octet[2]&0xff, ea->octet[3]&0xff, ea->octet[4]&0xff, ea->octet[5]&0xff); return (buf); } char * bcm_ip_ntoa(struct ipv4_addr *ia, char *buf) { snprintf(buf, 16, "%d.%d.%d.%d", ia->addr[0], ia->addr[1], ia->addr[2], ia->addr[3]); return (buf); } #ifdef BCMDRIVER void bcm_mdelay(uint ms) { uint i; for (i = 0; i < ms; i++) { OSL_DELAY(1000); } } #if defined(DHD_DEBUG) /* pretty hex print a pkt buffer chain */ void prpkt(const char *msg, osl_t *osh, void *p0) { void *p; if (msg && (msg[0] != '\0')) printf("%s:\n", msg); for (p = p0; p; p = PKTNEXT(osh, p)) prhex(NULL, PKTDATA(osh, p), PKTLEN(osh, p)); } #endif /* Takes an Ethernet frame and sets out-of-bound PKTPRIO. * Also updates the inplace vlan tag if requested. * For debugging, it returns an indication of what it did. */ uint pktsetprio(void *pkt, bool update_vtag) { struct ether_header *eh; struct ethervlan_header *evh; uint8 *pktdata; int priority = 0; int rc = 0; pktdata = (uint8 *) PKTDATA(NULL, pkt); ASSERT(ISALIGNED((uintptr)pktdata, sizeof(uint16))); eh = (struct ether_header *) pktdata; if (ntoh16(eh->ether_type) == ETHER_TYPE_8021Q) { uint16 vlan_tag; int vlan_prio, dscp_prio = 0; evh = (struct ethervlan_header *)eh; vlan_tag = ntoh16(evh->vlan_tag); vlan_prio = (int) (vlan_tag >> VLAN_PRI_SHIFT) & VLAN_PRI_MASK; if (ntoh16(evh->ether_type) == ETHER_TYPE_IP) { uint8 *ip_body = pktdata + sizeof(struct ethervlan_header); uint8 tos_tc = IP_TOS(ip_body); /* FMC fix */ uint8 tos = tos_tc >> 2; if (tos == 0x2E) { dscp_prio = 6; } else if (tos == 0x1A) { dscp_prio = 4; } else { dscp_prio = (int)(tos_tc >> IPV4_TOS_PREC_SHIFT); } } /* DSCP priority gets precedence over 802.1P (vlan tag) */ if (dscp_prio != 0) { priority = dscp_prio; rc |= PKTPRIO_VDSCP; } else { priority = vlan_prio; rc |= PKTPRIO_VLAN; } /* * If the DSCP priority is not the same as the VLAN priority, * then overwrite the priority field in the vlan tag, with the * DSCP priority value. This is required for Linux APs because * the VLAN driver on Linux, overwrites the skb->priority field * with the priority value in the vlan tag */ if (update_vtag && (priority != vlan_prio)) { vlan_tag &= ~(VLAN_PRI_MASK << VLAN_PRI_SHIFT); vlan_tag |= (uint16)priority << VLAN_PRI_SHIFT; evh->vlan_tag = hton16(vlan_tag); rc |= PKTPRIO_UPD; } } else if (ntoh16(eh->ether_type) == ETHER_TYPE_IP) { uint8 *ip_body = pktdata + sizeof(struct ether_header); uint8 tos_tc = IP_TOS(ip_body); /* FMC fix */ uint8 tos = tos_tc >> 2; if (tos == 0x2E) { priority = 6; } else if (tos == 0x1A) { priority = 4; } else { priority = (int)(tos_tc >> IPV4_TOS_PREC_SHIFT); } rc |= PKTPRIO_DSCP; } ASSERT(priority >= 0 && priority <= MAXPRIO); PKTSETPRIO(pkt, priority); return (rc | priority); } static char bcm_undeferrstr[BCME_STRLEN]; static const char *bcmerrorstrtable[] = BCMERRSTRINGTABLE; /* Convert the error codes into related error strings */ const char * bcmerrorstr(int bcmerror) { /* check if someone added a bcmerror code but forgot to add errorstring */ ASSERT(ABS(BCME_LAST) == (ARRAYSIZE(bcmerrorstrtable) - 1)); if (bcmerror > 0 || bcmerror < BCME_LAST) { snprintf(bcm_undeferrstr, BCME_STRLEN, "Undefined error %d", bcmerror); return bcm_undeferrstr; } ASSERT(strlen(bcmerrorstrtable[-bcmerror]) < BCME_STRLEN); return bcmerrorstrtable[-bcmerror]; } /* iovar table lookup */ const bcm_iovar_t* bcm_iovar_lookup(const bcm_iovar_t *table, const char *name) { const bcm_iovar_t *vi; const char *lookup_name; /* skip any ':' delimited option prefixes */ lookup_name = strrchr(name, ':'); if (lookup_name != NULL) lookup_name++; else lookup_name = name; ASSERT(table != NULL); for (vi = table; vi->name; vi++) { if (!strcmp(vi->name, lookup_name)) return vi; } /* ran to end of table */ return NULL; /* var name not found */ } int bcm_iovar_lencheck(const bcm_iovar_t *vi, void *arg, int len, bool set) { int bcmerror = 0; /* length check on io buf */ switch (vi->type) { case IOVT_BOOL: case IOVT_INT8: case IOVT_INT16: case IOVT_INT32: case IOVT_UINT8: case IOVT_UINT16: case IOVT_UINT32: /* all integers are int32 sized args at the ioctl interface */ if (len < (int)sizeof(int)) { bcmerror = BCME_BUFTOOSHORT; } break; case IOVT_BUFFER: /* buffer must meet minimum length requirement */ if (len < vi->minlen) { bcmerror = BCME_BUFTOOSHORT; } break; case IOVT_VOID: if (!set) { /* Cannot return nil... */ bcmerror = BCME_UNSUPPORTED; } else if (len) { /* Set is an action w/o parameters */ bcmerror = BCME_BUFTOOLONG; } break; default: /* unknown type for length check in iovar info */ ASSERT(0); bcmerror = BCME_UNSUPPORTED; } return bcmerror; } #endif /* BCMDRIVER */ /******************************************************************************* * crc8 * * Computes a crc8 over the input data using the polynomial: * * x^8 + x^7 +x^6 + x^4 + x^2 + 1 * * The caller provides the initial value (either CRC8_INIT_VALUE * or the previous returned value) to allow for processing of * discontiguous blocks of data. When generating the CRC the * caller is responsible for complementing the final return value * and inserting it into the byte stream. When checking, a final * return value of CRC8_GOOD_VALUE indicates a valid CRC. * * Reference: Dallas Semiconductor Application Note 27 * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd., * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt * * **************************************************************************** */ STATIC const uint8 crc8_table[256] = { 0x00, 0xF7, 0xB9, 0x4E, 0x25, 0xD2, 0x9C, 0x6B, 0x4A, 0xBD, 0xF3, 0x04, 0x6F, 0x98, 0xD6, 0x21, 0x94, 0x63, 0x2D, 0xDA, 0xB1, 0x46, 0x08, 0xFF, 0xDE, 0x29, 0x67, 0x90, 0xFB, 0x0C, 0x42, 0xB5, 0x7F, 0x88, 0xC6, 0x31, 0x5A, 0xAD, 0xE3, 0x14, 0x35, 0xC2, 0x8C, 0x7B, 0x10, 0xE7, 0xA9, 0x5E, 0xEB, 0x1C, 0x52, 0xA5, 0xCE, 0x39, 0x77, 0x80, 0xA1, 0x56, 0x18, 0xEF, 0x84, 0x73, 0x3D, 0xCA, 0xFE, 0x09, 0x47, 0xB0, 0xDB, 0x2C, 0x62, 0x95, 0xB4, 0x43, 0x0D, 0xFA, 0x91, 0x66, 0x28, 0xDF, 0x6A, 0x9D, 0xD3, 0x24, 0x4F, 0xB8, 0xF6, 0x01, 0x20, 0xD7, 0x99, 0x6E, 0x05, 0xF2, 0xBC, 0x4B, 0x81, 0x76, 0x38, 0xCF, 0xA4, 0x53, 0x1D, 0xEA, 0xCB, 0x3C, 0x72, 0x85, 0xEE, 0x19, 0x57, 0xA0, 0x15, 0xE2, 0xAC, 0x5B, 0x30, 0xC7, 0x89, 0x7E, 0x5F, 0xA8, 0xE6, 0x11, 0x7A, 0x8D, 0xC3, 0x34, 0xAB, 0x5C, 0x12, 0xE5, 0x8E, 0x79, 0x37, 0xC0, 0xE1, 0x16, 0x58, 0xAF, 0xC4, 0x33, 0x7D, 0x8A, 0x3F, 0xC8, 0x86, 0x71, 0x1A, 0xED, 0xA3, 0x54, 0x75, 0x82, 0xCC, 0x3B, 0x50, 0xA7, 0xE9, 0x1E, 0xD4, 0x23, 0x6D, 0x9A, 0xF1, 0x06, 0x48, 0xBF, 0x9E, 0x69, 0x27, 0xD0, 0xBB, 0x4C, 0x02, 0xF5, 0x40, 0xB7, 0xF9, 0x0E, 0x65, 0x92, 0xDC, 0x2B, 0x0A, 0xFD, 0xB3, 0x44, 0x2F, 0xD8, 0x96, 0x61, 0x55, 0xA2, 0xEC, 0x1B, 0x70, 0x87, 0xC9, 0x3E, 0x1F, 0xE8, 0xA6, 0x51, 0x3A, 0xCD, 0x83, 0x74, 0xC1, 0x36, 0x78, 0x8F, 0xE4, 0x13, 0x5D, 0xAA, 0x8B, 0x7C, 0x32, 0xC5, 0xAE, 0x59, 0x17, 0xE0, 0x2A, 0xDD, 0x93, 0x64, 0x0F, 0xF8, 0xB6, 0x41, 0x60, 0x97, 0xD9, 0x2E, 0x45, 0xB2, 0xFC, 0x0B, 0xBE, 0x49, 0x07, 0xF0, 0x9B, 0x6C, 0x22, 0xD5, 0xF4, 0x03, 0x4D, 0xBA, 0xD1, 0x26, 0x68, 0x9F }; #define CRC_INNER_LOOP(n, c, x) \ (c) = ((c) >> 8) ^ crc##n##_table[((c) ^ (x)) & 0xff] uint8 hndcrc8( uint8 *pdata, /* pointer to array of data to process */ uint nbytes, /* number of input data bytes to process */ uint8 crc /* either CRC8_INIT_VALUE or previous return value */ ) { /* hard code the crc loop instead of using CRC_INNER_LOOP macro * to avoid the undefined and unnecessary (uint8 >> 8) operation. */ while (nbytes-- > 0) crc = crc8_table[(crc ^ *pdata++) & 0xff]; return crc; } /******************************************************************************* * crc16 * * Computes a crc16 over the input data using the polynomial: * * x^16 + x^12 +x^5 + 1 * * The caller provides the initial value (either CRC16_INIT_VALUE * or the previous returned value) to allow for processing of * discontiguous blocks of data. When generating the CRC the * caller is responsible for complementing the final return value * and inserting it into the byte stream. When checking, a final * return value of CRC16_GOOD_VALUE indicates a valid CRC. * * Reference: Dallas Semiconductor Application Note 27 * Williams, Ross N., "A Painless Guide to CRC Error Detection Algorithms", * ver 3, Aug 1993, ross@guest.adelaide.edu.au, Rocksoft Pty Ltd., * ftp://ftp.rocksoft.com/clients/rocksoft/papers/crc_v3.txt * * **************************************************************************** */ static const uint16 crc16_table[256] = { 0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876, 0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD, 0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5, 0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C, 0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974, 0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB, 0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3, 0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A, 0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72, 0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9, 0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1, 0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738, 0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70, 0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7, 0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF, 0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036, 0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E, 0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5, 0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD, 0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134, 0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C, 0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3, 0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB, 0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232, 0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A, 0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1, 0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9, 0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330, 0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78 }; uint16 hndcrc16( uint8 *pdata, /* pointer to array of data to process */ uint nbytes, /* number of input data bytes to process */ uint16 crc /* either CRC16_INIT_VALUE or previous return value */ ) { while (nbytes-- > 0) CRC_INNER_LOOP(16, crc, *pdata++); return crc; } STATIC const uint32 crc32_table[256] = { 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D }; uint32 hndcrc32( uint8 *pdata, /* pointer to array of data to process */ uint nbytes, /* number of input data bytes to process */ uint32 crc /* either CRC32_INIT_VALUE or previous return value */ ) { uint8 *pend; #ifdef __mips__ uint8 tmp[4]; ulong *tptr = (ulong *)tmp; /* in case the beginning of the buffer isn't aligned */ pend = (uint8 *)((uint)(pdata + 3) & 0xfffffffc); nbytes -= (pend - pdata); while (pdata < pend) CRC_INNER_LOOP(32, crc, *pdata++); /* handle bulk of data as 32-bit words */ pend = pdata + (nbytes & 0xfffffffc); while (pdata < pend) { *tptr = *(ulong *)pdata; pdata += sizeof(ulong *); CRC_INNER_LOOP(32, crc, tmp[0]); CRC_INNER_LOOP(32, crc, tmp[1]); CRC_INNER_LOOP(32, crc, tmp[2]); CRC_INNER_LOOP(32, crc, tmp[3]); } /* 1-3 bytes at end of buffer */ pend = pdata + (nbytes & 0x03); while (pdata < pend) CRC_INNER_LOOP(32, crc, *pdata++); #else pend = pdata + nbytes; while (pdata < pend) CRC_INNER_LOOP(32, crc, *pdata++); #endif /* __mips__ */ return crc; } #ifdef notdef #define CLEN 1499 /* CRC Length */ #define CBUFSIZ (CLEN+4) #define CNBUFS 5 /* # of bufs */ void testcrc32(void) { uint j, k, l; uint8 *buf; uint len[CNBUFS]; uint32 crcr; uint32 crc32tv[CNBUFS] = {0xd2cb1faa, 0xd385c8fa, 0xf5b4f3f3, 0x55789e20, 0x00343110}; ASSERT((buf = MALLOC(CBUFSIZ*CNBUFS)) != NULL); /* step through all possible alignments */ for (l = 0; l <= 4; l++) { for (j = 0; j < CNBUFS; j++) { len[j] = CLEN; for (k = 0; k < len[j]; k++) *(buf + j*CBUFSIZ + (k+l)) = (j+k) & 0xff; } for (j = 0; j < CNBUFS; j++) { crcr = crc32(buf + j*CBUFSIZ + l, len[j], CRC32_INIT_VALUE); ASSERT(crcr == crc32tv[j]); } } MFREE(buf, CBUFSIZ*CNBUFS); return; } #endif /* notdef */ /* * Advance from the current 1-byte tag/1-byte length/variable-length value * triple, to the next, returning a pointer to the next. * If the current or next TLV is invalid (does not fit in given buffer length), * NULL is returned. * *buflen is not modified if the TLV elt parameter is invalid, or is decremented * by the TLV parameter's length if it is valid. */ bcm_tlv_t * bcm_next_tlv(bcm_tlv_t *elt, int *buflen) { int len; /* validate current elt */ if (!bcm_valid_tlv(elt, *buflen)) return NULL; /* advance to next elt */ len = elt->len; elt = (bcm_tlv_t*)(elt->data + len); *buflen -= (2 + len); /* validate next elt */ if (!bcm_valid_tlv(elt, *buflen)) return NULL; return elt; } /* * Traverse a string of 1-byte tag/1-byte length/variable-length value * triples, returning a pointer to the substring whose first element * matches tag */ bcm_tlv_t * bcm_parse_tlvs(void *buf, int buflen, uint key) { bcm_tlv_t *elt; int totlen; elt = (bcm_tlv_t*)buf; totlen = buflen; /* find tagged parameter */ while (totlen >= 2) { int len = elt->len; /* validate remaining totlen */ if ((elt->id == key) && (totlen >= (len + 2))) return (elt); elt = (bcm_tlv_t*)((uint8*)elt + (len + 2)); totlen -= (len + 2); } return NULL; } /* * Traverse a string of 1-byte tag/1-byte length/variable-length value * triples, returning a pointer to the substring whose first element * matches tag. Stop parsing when we see an element whose ID is greater * than the target key. */ bcm_tlv_t * bcm_parse_ordered_tlvs(void *buf, int buflen, uint key) { bcm_tlv_t *elt; int totlen; elt = (bcm_tlv_t*)buf; totlen = buflen; /* find tagged parameter */ while (totlen >= 2) { uint id = elt->id; int len = elt->len; /* Punt if we start seeing IDs > than target key */ if (id > key) return (NULL); /* validate remaining totlen */ if ((id == key) && (totlen >= (len + 2))) return (elt); elt = (bcm_tlv_t*)((uint8*)elt + (len + 2)); totlen -= (len + 2); } return NULL; } #if defined(WLMSG_PRHDRS) || defined(WLMSG_PRPKT) || defined(WLMSG_ASSOC) || \ defined(DHD_DEBUG) int bcm_format_flags(const bcm_bit_desc_t *bd, uint32 flags, char* buf, int len) { int i; char* p = buf; char hexstr[16]; int slen = 0; uint32 bit; const char* name; if (len < 2 || !buf) return 0; buf[0] = '\0'; len -= 1; for (i = 0; flags != 0; i++) { bit = bd[i].bit; name = bd[i].name; if (bit == 0 && flags) { /* print any unnamed bits */ sprintf(hexstr, "0x%X", flags); name = hexstr; flags = 0; /* exit loop */ } else if ((flags & bit) == 0) continue; slen += strlen(name); if (len < slen) break; if (p != buf) p += sprintf(p, " "); /* btwn flag space */ strcat(p, name); p += strlen(name); flags &= ~bit; len -= slen; slen = 1; /* account for btwn flag space */ } /* indicate the str was too short */ if (flags != 0) { if (len == 0) p--; /* overwrite last char */ p += sprintf(p, ">"); } return (int)(p - buf); } /* print bytes formatted as hex to a string. return the resulting string length */ int bcm_format_hex(char *str, const void *bytes, int len) { int i; char *p = str; const uint8 *src = (const uint8*)bytes; for (i = 0; i < len; i++) { p += sprintf(p, "%02X", *src); src++; } return (int)(p - str); } /* pretty hex print a contiguous buffer */ void prhex(const char *msg, uchar *buf, uint nbytes) { char line[128], *p; uint i; if (msg && (msg[0] != '\0')) printf("%s:\n", msg); p = line; for (i = 0; i < nbytes; i++) { if (i % 16 == 0) { p += sprintf(p, " %04d: ", i); /* line prefix */ } p += sprintf(p, "%02x ", buf[i]); if (i % 16 == 15) { printf("%s\n", line); /* flush line */ p = line; } } /* flush last partial line */ if (p != line) printf("%s\n", line); } #endif /* Produce a human-readable string for boardrev */ char * bcm_brev_str(uint32 brev, char *buf) { if (brev < 0x100) snprintf(buf, 8, "%d.%d", (brev & 0xf0) >> 4, brev & 0xf); else snprintf(buf, 8, "%c%03x", ((brev & 0xf000) == 0x1000) ? 'P' : 'A', brev & 0xfff); return (buf); } #define BUFSIZE_TODUMP_ATONCE 512 /* Buffer size */ /* dump large strings to console */ void printbig(char *buf) { uint len, max_len; char c; len = strlen(buf); max_len = BUFSIZE_TODUMP_ATONCE; while (len > max_len) { c = buf[max_len]; buf[max_len] = '\0'; printf("%s", buf); buf[max_len] = c; buf += max_len; len -= max_len; } /* print the remaining string */ printf("%s\n", buf); return; } /* routine to dump fields in a fileddesc structure */ uint bcmdumpfields(bcmutl_rdreg_rtn read_rtn, void *arg0, uint arg1, struct fielddesc *fielddesc_array, char *buf, uint32 bufsize) { uint filled_len; int len; struct fielddesc *cur_ptr; filled_len = 0; cur_ptr = fielddesc_array; while (bufsize > 1) { if (cur_ptr->nameandfmt == NULL) break; len = snprintf(buf, bufsize, cur_ptr->nameandfmt, read_rtn(arg0, arg1, cur_ptr->offset)); /* check for snprintf overflow or error */ if (len < 0 || (uint32)len >= bufsize) len = bufsize - 1; buf += len; bufsize -= len; filled_len += len; cur_ptr++; } return filled_len; } uint bcm_mkiovar(char *name, char *data, uint datalen, char *buf, uint buflen) { uint len; len = strlen(name) + 1; if ((len + datalen) > buflen) return 0; strncpy(buf, name, buflen); /* append data onto the end of the name string */ memcpy(&buf[len], data, datalen); len += datalen; return len; } /* Quarter dBm units to mW * Table starts at QDBM_OFFSET, so the first entry is mW for qdBm=153 * Table is offset so the last entry is largest mW value that fits in * a uint16. */ #define QDBM_OFFSET 153 /* Offset for first entry */ #define QDBM_TABLE_LEN 40 /* Table size */ /* Smallest mW value that will round up to the first table entry, QDBM_OFFSET. * Value is ( mW(QDBM_OFFSET - 1) + mW(QDBM_OFFSET) ) / 2 */ #define QDBM_TABLE_LOW_BOUND 6493 /* Low bound */ /* Largest mW value that will round down to the last table entry, * QDBM_OFFSET + QDBM_TABLE_LEN-1. * Value is ( mW(QDBM_OFFSET + QDBM_TABLE_LEN - 1) + mW(QDBM_OFFSET + QDBM_TABLE_LEN) ) / 2. */ #define QDBM_TABLE_HIGH_BOUND 64938 /* High bound */ static const uint16 nqdBm_to_mW_map[QDBM_TABLE_LEN] = { /* qdBm: +0 +1 +2 +3 +4 +5 +6 +7 */ /* 153: */ 6683, 7079, 7499, 7943, 8414, 8913, 9441, 10000, /* 161: */ 10593, 11220, 11885, 12589, 13335, 14125, 14962, 15849, /* 169: */ 16788, 17783, 18836, 19953, 21135, 22387, 23714, 25119, /* 177: */ 26607, 28184, 29854, 31623, 33497, 35481, 37584, 39811, /* 185: */ 42170, 44668, 47315, 50119, 53088, 56234, 59566, 63096 }; uint16 bcm_qdbm_to_mw(uint8 qdbm) { uint factor = 1; int idx = qdbm - QDBM_OFFSET; if (idx >= QDBM_TABLE_LEN) { /* clamp to max uint16 mW value */ return 0xFFFF; } /* scale the qdBm index up to the range of the table 0-40 * where an offset of 40 qdBm equals a factor of 10 mW. */ while (idx < 0) { idx += 40; factor *= 10; } /* return the mW value scaled down to the correct factor of 10, * adding in factor/2 to get proper rounding. */ return ((nqdBm_to_mW_map[idx] + factor/2) / factor); } uint8 bcm_mw_to_qdbm(uint16 mw) { uint8 qdbm; int offset; uint mw_uint = mw; uint boundary; /* handle boundary case */ if (mw_uint <= 1) return 0; offset = QDBM_OFFSET; /* move mw into the range of the table */ while (mw_uint < QDBM_TABLE_LOW_BOUND) { mw_uint *= 10; offset -= 40; } for (qdbm = 0; qdbm < QDBM_TABLE_LEN-1; qdbm++) { boundary = nqdBm_to_mW_map[qdbm] + (nqdBm_to_mW_map[qdbm+1] - nqdBm_to_mW_map[qdbm])/2; if (mw_uint < boundary) break; } qdbm += (uint8)offset; return (qdbm); } uint bcm_bitcount(uint8 *bitmap, uint length) { uint bitcount = 0, i; uint8 tmp; for (i = 0; i < length; i++) { tmp = bitmap[i]; while (tmp) { bitcount++; tmp &= (tmp - 1); } } return bitcount; } #ifdef BCMDRIVER /* Initialization of bcmstrbuf structure */ void bcm_binit(struct bcmstrbuf *b, char *buf, uint size) { b->origsize = b->size = size; b->origbuf = b->buf = buf; } /* Buffer sprintf wrapper to guard against buffer overflow */ int bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...) { va_list ap; int r; va_start(ap, fmt); r = vsnprintf(b->buf, b->size, fmt, ap); /* Non Ansi C99 compliant returns -1, * Ansi compliant return r >= b->size, * bcmstdlib returns 0, handle all */ if ((r == -1) || (r >= (int)b->size) || (r == 0)) { b->size = 0; } else { b->size -= r; b->buf += r; } va_end(ap); return r; } void bcm_inc_bytes(uchar *num, int num_bytes, uint8 amount) { int i; for (i = 0; i < num_bytes; i++) { num[i] += amount; if (num[i] >= amount) break; amount = 1; } } int bcm_cmp_bytes(uchar *arg1, uchar *arg2, uint8 nbytes) { int i; for (i = nbytes - 1; i >= 0; i--) { if (arg1[i] != arg2[i]) return (arg1[i] - arg2[i]); } return 0; } void bcm_print_bytes(char *name, const uchar *data, int len) { int i; int per_line = 0; printf("%s: %d \n", name ? name : "", len); for (i = 0; i < len; i++) { printf("%02x ", *data++); per_line++; if (per_line == 16) { per_line = 0; printf("\n"); } } printf("\n"); } /* * buffer length needed for wlc_format_ssid * 32 SSID chars, max of 4 chars for each SSID char "\xFF", plus NULL. */ #if defined(WLTINYDUMP) || defined(WLMSG_INFORM) || defined(WLMSG_ASSOC) || \ defined(WLMSG_PRPKT) || defined(WLMSG_WSEC) int bcm_format_ssid(char* buf, const uchar ssid[], uint ssid_len) { uint i, c; char *p = buf; char *endp = buf + SSID_FMT_BUF_LEN; if (ssid_len > DOT11_MAX_SSID_LEN) ssid_len = DOT11_MAX_SSID_LEN; for (i = 0; i < ssid_len; i++) { c = (uint)ssid[i]; if (c == '\\') { *p++ = '\\'; *p++ = '\\'; } else if (bcm_isprint((uchar)c)) { *p++ = (char)c; } else { p += snprintf(p, (endp - p), "\\x%02X", c); } } *p = '\0'; ASSERT(p < endp); return (int)(p - buf); } #endif #endif /* BCMDRIVER */
Java
/*************************************************************************** qgsogcutils.cpp --------------------- begin : March 2013 copyright : (C) 2013 by Martin Dobias email : wonder dot sk at gmail dot 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. * * * ***************************************************************************/ #include "qgsogcutils.h" #include "qgsexpression.h" #include "qgsexpressionnodeimpl.h" #include "qgsexpressionfunction.h" #include "qgsexpressionprivate.h" #include "qgsgeometry.h" #include "qgswkbptr.h" #include "qgscoordinatereferencesystem.h" #include "qgsrectangle.h" #include "qgsvectorlayer.h" #include "qgsexpressioncontextutils.h" #include <QColor> #include <QStringList> #include <QTextStream> #include <QObject> #ifndef Q_OS_WIN #include <netinet/in.h> #else #include <winsock.h> #endif static const QString GML_NAMESPACE = QStringLiteral( "http://www.opengis.net/gml" ); static const QString GML32_NAMESPACE = QStringLiteral( "http://www.opengis.net/gml/3.2" ); static const QString OGC_NAMESPACE = QStringLiteral( "http://www.opengis.net/ogc" ); static const QString FES_NAMESPACE = QStringLiteral( "http://www.opengis.net/fes/2.0" ); QgsOgcUtilsExprToFilter::QgsOgcUtilsExprToFilter( QDomDocument &doc, QgsOgcUtils::GMLVersion gmlVersion, QgsOgcUtils::FilterVersion filterVersion, const QString &geometryName, const QString &srsName, bool honourAxisOrientation, bool invertAxisOrientation ) : mDoc( doc ) , mGMLUsed( false ) , mGMLVersion( gmlVersion ) , mFilterVersion( filterVersion ) , mGeometryName( geometryName ) , mSrsName( srsName ) , mInvertAxisOrientation( invertAxisOrientation ) , mFilterPrefix( ( filterVersion == QgsOgcUtils::FILTER_FES_2_0 ) ? "fes" : "ogc" ) , mPropertyName( ( filterVersion == QgsOgcUtils::FILTER_FES_2_0 ) ? "ValueReference" : "PropertyName" ) , mGeomId( 1 ) { QgsCoordinateReferenceSystem crs; if ( !mSrsName.isEmpty() ) crs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( mSrsName ); if ( crs.isValid() ) { if ( honourAxisOrientation && crs.hasAxisInverted() ) { mInvertAxisOrientation = !mInvertAxisOrientation; } } } QgsGeometry QgsOgcUtils::geometryFromGML( const QDomNode &geometryNode ) { QDomElement geometryTypeElement = geometryNode.toElement(); QString geomType = geometryTypeElement.tagName(); if ( !( geomType == QLatin1String( "Point" ) || geomType == QLatin1String( "LineString" ) || geomType == QLatin1String( "Polygon" ) || geomType == QLatin1String( "MultiPoint" ) || geomType == QLatin1String( "MultiLineString" ) || geomType == QLatin1String( "MultiPolygon" ) || geomType == QLatin1String( "Box" ) || geomType == QLatin1String( "Envelope" ) ) ) { QDomNode geometryChild = geometryNode.firstChild(); if ( geometryChild.isNull() ) { return QgsGeometry(); } geometryTypeElement = geometryChild.toElement(); geomType = geometryTypeElement.tagName(); } if ( !( geomType == QLatin1String( "Point" ) || geomType == QLatin1String( "LineString" ) || geomType == QLatin1String( "Polygon" ) || geomType == QLatin1String( "MultiPoint" ) || geomType == QLatin1String( "MultiLineString" ) || geomType == QLatin1String( "MultiPolygon" ) || geomType == QLatin1String( "Box" ) || geomType == QLatin1String( "Envelope" ) ) ) return QgsGeometry(); if ( geomType == QLatin1String( "Point" ) ) { return geometryFromGMLPoint( geometryTypeElement ); } else if ( geomType == QLatin1String( "LineString" ) ) { return geometryFromGMLLineString( geometryTypeElement ); } else if ( geomType == QLatin1String( "Polygon" ) ) { return geometryFromGMLPolygon( geometryTypeElement ); } else if ( geomType == QLatin1String( "MultiPoint" ) ) { return geometryFromGMLMultiPoint( geometryTypeElement ); } else if ( geomType == QLatin1String( "MultiLineString" ) ) { return geometryFromGMLMultiLineString( geometryTypeElement ); } else if ( geomType == QLatin1String( "MultiPolygon" ) ) { return geometryFromGMLMultiPolygon( geometryTypeElement ); } else if ( geomType == QLatin1String( "Box" ) ) { return QgsGeometry::fromRect( rectangleFromGMLBox( geometryTypeElement ) ); } else if ( geomType == QLatin1String( "Envelope" ) ) { return QgsGeometry::fromRect( rectangleFromGMLEnvelope( geometryTypeElement ) ); } else //unknown type { return QgsGeometry(); } } QgsGeometry QgsOgcUtils::geometryFromGML( const QString &xmlString ) { // wrap the string into a root tag to have "gml" namespace (and also as a default namespace) QString xml = QStringLiteral( "<tmp xmlns=\"%1\" xmlns:gml=\"%1\">%2</tmp>" ).arg( GML_NAMESPACE, xmlString ); QDomDocument doc; if ( !doc.setContent( xml, true ) ) return QgsGeometry(); return geometryFromGML( doc.documentElement().firstChildElement() ); } QgsGeometry QgsOgcUtils::geometryFromGMLPoint( const QDomElement &geometryElement ) { QgsPolylineXY pointCoordinate; QDomNodeList coordList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "coordinates" ) ); if ( !coordList.isEmpty() ) { QDomElement coordElement = coordList.at( 0 ).toElement(); if ( readGMLCoordinates( pointCoordinate, coordElement ) != 0 ) { return QgsGeometry(); } } else { QDomNodeList posList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "pos" ) ); if ( posList.size() < 1 ) { return QgsGeometry(); } QDomElement posElement = posList.at( 0 ).toElement(); if ( readGMLPositions( pointCoordinate, posElement ) != 0 ) { return QgsGeometry(); } } if ( pointCoordinate.empty() ) { return QgsGeometry(); } QgsPolylineXY::const_iterator point_it = pointCoordinate.constBegin(); char e = htonl( 1 ) != 1; double x = point_it->x(); double y = point_it->y(); int size = 1 + sizeof( int ) + 2 * sizeof( double ); QgsWkbTypes::Type type = QgsWkbTypes::Point; unsigned char *wkb = new unsigned char[size]; int wkbPosition = 0; //current offset from wkb beginning (in bytes) memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); memcpy( &( wkb )[wkbPosition], &x, sizeof( double ) ); wkbPosition += sizeof( double ); memcpy( &( wkb )[wkbPosition], &y, sizeof( double ) ); QgsGeometry g; g.fromWkb( wkb, size ); return g; } QgsGeometry QgsOgcUtils::geometryFromGMLLineString( const QDomElement &geometryElement ) { QgsPolylineXY lineCoordinates; QDomNodeList coordList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "coordinates" ) ); if ( !coordList.isEmpty() ) { QDomElement coordElement = coordList.at( 0 ).toElement(); if ( readGMLCoordinates( lineCoordinates, coordElement ) != 0 ) { return QgsGeometry(); } } else { QDomNodeList posList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "posList" ) ); if ( posList.size() < 1 ) { return QgsGeometry(); } QDomElement posElement = posList.at( 0 ).toElement(); if ( readGMLPositions( lineCoordinates, posElement ) != 0 ) { return QgsGeometry(); } } char e = htonl( 1 ) != 1; int size = 1 + 2 * sizeof( int ) + lineCoordinates.size() * 2 * sizeof( double ); QgsWkbTypes::Type type = QgsWkbTypes::LineString; unsigned char *wkb = new unsigned char[size]; int wkbPosition = 0; //current offset from wkb beginning (in bytes) double x, y; int nPoints = lineCoordinates.size(); //fill the contents into *wkb memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); memcpy( &( wkb )[wkbPosition], &nPoints, sizeof( int ) ); wkbPosition += sizeof( int ); QgsPolylineXY::const_iterator iter; for ( iter = lineCoordinates.constBegin(); iter != lineCoordinates.constEnd(); ++iter ) { x = iter->x(); y = iter->y(); memcpy( &( wkb )[wkbPosition], &x, sizeof( double ) ); wkbPosition += sizeof( double ); memcpy( &( wkb )[wkbPosition], &y, sizeof( double ) ); wkbPosition += sizeof( double ); } QgsGeometry g; g.fromWkb( wkb, size ); return g; } QgsGeometry QgsOgcUtils::geometryFromGMLPolygon( const QDomElement &geometryElement ) { //read all the coordinates (as QgsPoint) into memory. Each linear ring has an entry in the vector QgsMultiPolylineXY ringCoordinates; //read coordinates for outer boundary QgsPolylineXY exteriorPointList; QDomNodeList outerBoundaryList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "outerBoundaryIs" ) ); if ( !outerBoundaryList.isEmpty() ) //outer ring is necessary { QDomElement coordinatesElement = outerBoundaryList.at( 0 ).firstChild().firstChild().toElement(); if ( coordinatesElement.isNull() ) { return QgsGeometry(); } if ( readGMLCoordinates( exteriorPointList, coordinatesElement ) != 0 ) { return QgsGeometry(); } ringCoordinates.push_back( exteriorPointList ); //read coordinates for inner boundary QDomNodeList innerBoundaryList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "innerBoundaryIs" ) ); for ( int i = 0; i < innerBoundaryList.size(); ++i ) { QgsPolylineXY interiorPointList; coordinatesElement = innerBoundaryList.at( i ).firstChild().firstChild().toElement(); if ( coordinatesElement.isNull() ) { return QgsGeometry(); } if ( readGMLCoordinates( interiorPointList, coordinatesElement ) != 0 ) { return QgsGeometry(); } ringCoordinates.push_back( interiorPointList ); } } else { //read coordinates for exterior QDomNodeList exteriorList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "exterior" ) ); if ( exteriorList.size() < 1 ) //outer ring is necessary { return QgsGeometry(); } QDomElement posElement = exteriorList.at( 0 ).firstChild().firstChild().toElement(); if ( posElement.isNull() ) { return QgsGeometry(); } if ( readGMLPositions( exteriorPointList, posElement ) != 0 ) { return QgsGeometry(); } ringCoordinates.push_back( exteriorPointList ); //read coordinates for inner boundary QDomNodeList interiorList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "interior" ) ); for ( int i = 0; i < interiorList.size(); ++i ) { QgsPolylineXY interiorPointList; QDomElement posElement = interiorList.at( i ).firstChild().firstChild().toElement(); if ( posElement.isNull() ) { return QgsGeometry(); } if ( readGMLPositions( interiorPointList, posElement ) != 0 ) { return QgsGeometry(); } ringCoordinates.push_back( interiorPointList ); } } //calculate number of bytes to allocate int nrings = ringCoordinates.size(); if ( nrings < 1 ) return QgsGeometry(); int npoints = 0;//total number of points for ( QgsMultiPolylineXY::const_iterator it = ringCoordinates.constBegin(); it != ringCoordinates.constEnd(); ++it ) { npoints += it->size(); } int size = 1 + 2 * sizeof( int ) + nrings * sizeof( int ) + 2 * npoints * sizeof( double ); QgsWkbTypes::Type type = QgsWkbTypes::Polygon; unsigned char *wkb = new unsigned char[size]; //char e = QgsApplication::endian(); char e = htonl( 1 ) != 1; int wkbPosition = 0; //current offset from wkb beginning (in bytes) int nPointsInRing = 0; double x, y; //fill the contents into *wkb memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); memcpy( &( wkb )[wkbPosition], &nrings, sizeof( int ) ); wkbPosition += sizeof( int ); for ( QgsMultiPolylineXY::const_iterator it = ringCoordinates.constBegin(); it != ringCoordinates.constEnd(); ++it ) { nPointsInRing = it->size(); memcpy( &( wkb )[wkbPosition], &nPointsInRing, sizeof( int ) ); wkbPosition += sizeof( int ); //iterate through the string list converting the strings to x-/y- doubles QgsPolylineXY::const_iterator iter; for ( iter = it->begin(); iter != it->end(); ++iter ) { x = iter->x(); y = iter->y(); //qWarning("currentCoordinate: " + QString::number(x) + " // " + QString::number(y)); memcpy( &( wkb )[wkbPosition], &x, sizeof( double ) ); wkbPosition += sizeof( double ); memcpy( &( wkb )[wkbPosition], &y, sizeof( double ) ); wkbPosition += sizeof( double ); } } QgsGeometry g; g.fromWkb( wkb, size ); return g; } QgsGeometry QgsOgcUtils::geometryFromGMLMultiPoint( const QDomElement &geometryElement ) { QgsPolylineXY pointList; QgsPolylineXY currentPoint; QDomNodeList pointMemberList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "pointMember" ) ); if ( pointMemberList.size() < 1 ) { return QgsGeometry(); } QDomNodeList pointNodeList; // coordinates or pos element QDomNodeList coordinatesList; QDomNodeList posList; for ( int i = 0; i < pointMemberList.size(); ++i ) { //<Point> element pointNodeList = pointMemberList.at( i ).toElement().elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "Point" ) ); if ( pointNodeList.size() < 1 ) { continue; } //<coordinates> element coordinatesList = pointNodeList.at( 0 ).toElement().elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "coordinates" ) ); if ( !coordinatesList.isEmpty() ) { currentPoint.clear(); if ( readGMLCoordinates( currentPoint, coordinatesList.at( 0 ).toElement() ) != 0 ) { continue; } if ( currentPoint.empty() ) { continue; } pointList.push_back( ( *currentPoint.begin() ) ); continue; } else { //<pos> element posList = pointNodeList.at( 0 ).toElement().elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "pos" ) ); if ( posList.size() < 1 ) { continue; } currentPoint.clear(); if ( readGMLPositions( currentPoint, posList.at( 0 ).toElement() ) != 0 ) { continue; } if ( currentPoint.empty() ) { continue; } pointList.push_back( ( *currentPoint.begin() ) ); } } int nPoints = pointList.size(); //number of points if ( nPoints < 1 ) return QgsGeometry(); //calculate the required wkb size int size = 1 + 2 * sizeof( int ) + pointList.size() * ( 2 * sizeof( double ) + 1 + sizeof( int ) ); QgsWkbTypes::Type type = QgsWkbTypes::MultiPoint; unsigned char *wkb = new unsigned char[size]; //fill the wkb content char e = htonl( 1 ) != 1; int wkbPosition = 0; //current offset from wkb beginning (in bytes) double x, y; memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); memcpy( &( wkb )[wkbPosition], &nPoints, sizeof( int ) ); wkbPosition += sizeof( int ); type = QgsWkbTypes::Point; for ( QgsPolylineXY::const_iterator it = pointList.constBegin(); it != pointList.constEnd(); ++it ) { memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); x = it->x(); memcpy( &( wkb )[wkbPosition], &x, sizeof( double ) ); wkbPosition += sizeof( double ); y = it->y(); memcpy( &( wkb )[wkbPosition], &y, sizeof( double ) ); wkbPosition += sizeof( double ); } QgsGeometry g; g.fromWkb( wkb, size ); return g; } QgsGeometry QgsOgcUtils::geometryFromGMLMultiLineString( const QDomElement &geometryElement ) { //geoserver has //<gml:MultiLineString> //<gml:lineStringMember> //<gml:LineString> //mapserver has directly //<gml:MultiLineString //<gml:LineString QList< QgsPolylineXY > lineCoordinates; //first list: lines, second list: points of one line QDomElement currentLineStringElement; QDomNodeList currentCoordList; QDomNodeList currentPosList; QDomNodeList lineStringMemberList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "lineStringMember" ) ); if ( !lineStringMemberList.isEmpty() ) //geoserver { for ( int i = 0; i < lineStringMemberList.size(); ++i ) { QDomNodeList lineStringNodeList = lineStringMemberList.at( i ).toElement().elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "LineString" ) ); if ( lineStringNodeList.size() < 1 ) { return QgsGeometry(); } currentLineStringElement = lineStringNodeList.at( 0 ).toElement(); currentCoordList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "coordinates" ) ); if ( !currentCoordList.isEmpty() ) { QgsPolylineXY currentPointList; if ( readGMLCoordinates( currentPointList, currentCoordList.at( 0 ).toElement() ) != 0 ) { return QgsGeometry(); } lineCoordinates.push_back( currentPointList ); } else { currentPosList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "posList" ) ); if ( currentPosList.size() < 1 ) { return QgsGeometry(); } QgsPolylineXY currentPointList; if ( readGMLPositions( currentPointList, currentPosList.at( 0 ).toElement() ) != 0 ) { return QgsGeometry(); } lineCoordinates.push_back( currentPointList ); } } } else { QDomNodeList lineStringList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "LineString" ) ); if ( !lineStringList.isEmpty() ) //mapserver { for ( int i = 0; i < lineStringList.size(); ++i ) { currentLineStringElement = lineStringList.at( i ).toElement(); currentCoordList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "coordinates" ) ); if ( !currentCoordList.isEmpty() ) { QgsPolylineXY currentPointList; if ( readGMLCoordinates( currentPointList, currentCoordList.at( 0 ).toElement() ) != 0 ) { return QgsGeometry(); } lineCoordinates.push_back( currentPointList ); return QgsGeometry(); } else { currentPosList = currentLineStringElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "posList" ) ); if ( currentPosList.size() < 1 ) { return QgsGeometry(); } QgsPolylineXY currentPointList; if ( readGMLPositions( currentPointList, currentPosList.at( 0 ).toElement() ) != 0 ) { return QgsGeometry(); } lineCoordinates.push_back( currentPointList ); } } } else { return QgsGeometry(); } } int nLines = lineCoordinates.size(); if ( nLines < 1 ) return QgsGeometry(); //calculate the required wkb size int size = ( lineCoordinates.size() + 1 ) * ( 1 + 2 * sizeof( int ) ); for ( QList< QgsPolylineXY >::const_iterator it = lineCoordinates.constBegin(); it != lineCoordinates.constEnd(); ++it ) { size += it->size() * 2 * sizeof( double ); } QgsWkbTypes::Type type = QgsWkbTypes::MultiLineString; unsigned char *wkb = new unsigned char[size]; //fill the wkb content char e = htonl( 1 ) != 1; int wkbPosition = 0; //current offset from wkb beginning (in bytes) int nPoints; //number of points in a line double x, y; memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); memcpy( &( wkb )[wkbPosition], &nLines, sizeof( int ) ); wkbPosition += sizeof( int ); type = QgsWkbTypes::LineString; for ( QList< QgsPolylineXY >::const_iterator it = lineCoordinates.constBegin(); it != lineCoordinates.constEnd(); ++it ) { memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); nPoints = it->size(); memcpy( &( wkb )[wkbPosition], &nPoints, sizeof( int ) ); wkbPosition += sizeof( int ); for ( QgsPolylineXY::const_iterator iter = it->begin(); iter != it->end(); ++iter ) { x = iter->x(); y = iter->y(); // QgsDebugMsg( QStringLiteral( "x, y is %1,%2" ).arg( x, 'f' ).arg( y, 'f' ) ); memcpy( &( wkb )[wkbPosition], &x, sizeof( double ) ); wkbPosition += sizeof( double ); memcpy( &( wkb )[wkbPosition], &y, sizeof( double ) ); wkbPosition += sizeof( double ); } } QgsGeometry g; g.fromWkb( wkb, size ); return g; } QgsGeometry QgsOgcUtils::geometryFromGMLMultiPolygon( const QDomElement &geometryElement ) { //first list: different polygons, second list: different rings, third list: different points QgsMultiPolygonXY multiPolygonPoints; QDomElement currentPolygonMemberElement; QDomNodeList polygonList; QDomElement currentPolygonElement; // rings in GML2 QDomNodeList outerBoundaryList; QDomElement currentOuterBoundaryElement; QDomNodeList innerBoundaryList; QDomElement currentInnerBoundaryElement; // rings in GML3 QDomNodeList exteriorList; QDomElement currentExteriorElement; QDomElement currentInteriorElement; QDomNodeList interiorList; // lienar ring QDomNodeList linearRingNodeList; QDomElement currentLinearRingElement; // Coordinates or position list QDomNodeList currentCoordinateList; QDomNodeList currentPosList; QDomNodeList polygonMemberList = geometryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "polygonMember" ) ); QgsPolygonXY currentPolygonList; for ( int i = 0; i < polygonMemberList.size(); ++i ) { currentPolygonList.resize( 0 ); // preserve capacity - don't use clear currentPolygonMemberElement = polygonMemberList.at( i ).toElement(); polygonList = currentPolygonMemberElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "Polygon" ) ); if ( polygonList.size() < 1 ) { continue; } currentPolygonElement = polygonList.at( 0 ).toElement(); //find exterior ring outerBoundaryList = currentPolygonElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "outerBoundaryIs" ) ); if ( !outerBoundaryList.isEmpty() ) { currentOuterBoundaryElement = outerBoundaryList.at( 0 ).toElement(); QgsPolylineXY ringCoordinates; linearRingNodeList = currentOuterBoundaryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "LinearRing" ) ); if ( linearRingNodeList.size() < 1 ) { continue; } currentLinearRingElement = linearRingNodeList.at( 0 ).toElement(); currentCoordinateList = currentLinearRingElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "coordinates" ) ); if ( currentCoordinateList.size() < 1 ) { continue; } if ( readGMLCoordinates( ringCoordinates, currentCoordinateList.at( 0 ).toElement() ) != 0 ) { continue; } currentPolygonList.push_back( ringCoordinates ); //find interior rings QDomNodeList innerBoundaryList = currentPolygonElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "innerBoundaryIs" ) ); for ( int j = 0; j < innerBoundaryList.size(); ++j ) { QgsPolylineXY ringCoordinates; currentInnerBoundaryElement = innerBoundaryList.at( j ).toElement(); linearRingNodeList = currentInnerBoundaryElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "LinearRing" ) ); if ( linearRingNodeList.size() < 1 ) { continue; } currentLinearRingElement = linearRingNodeList.at( 0 ).toElement(); currentCoordinateList = currentLinearRingElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "coordinates" ) ); if ( currentCoordinateList.size() < 1 ) { continue; } if ( readGMLCoordinates( ringCoordinates, currentCoordinateList.at( 0 ).toElement() ) != 0 ) { continue; } currentPolygonList.push_back( ringCoordinates ); } } else { //find exterior ring exteriorList = currentPolygonElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "exterior" ) ); if ( exteriorList.size() < 1 ) { continue; } currentExteriorElement = exteriorList.at( 0 ).toElement(); QgsPolylineXY ringPositions; linearRingNodeList = currentExteriorElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "LinearRing" ) ); if ( linearRingNodeList.size() < 1 ) { continue; } currentLinearRingElement = linearRingNodeList.at( 0 ).toElement(); currentPosList = currentLinearRingElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "posList" ) ); if ( currentPosList.size() < 1 ) { continue; } if ( readGMLPositions( ringPositions, currentPosList.at( 0 ).toElement() ) != 0 ) { continue; } currentPolygonList.push_back( ringPositions ); //find interior rings QDomNodeList interiorList = currentPolygonElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "interior" ) ); for ( int j = 0; j < interiorList.size(); ++j ) { QgsPolylineXY ringPositions; currentInteriorElement = interiorList.at( j ).toElement(); linearRingNodeList = currentInteriorElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "LinearRing" ) ); if ( linearRingNodeList.size() < 1 ) { continue; } currentLinearRingElement = linearRingNodeList.at( 0 ).toElement(); currentPosList = currentLinearRingElement.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "posList" ) ); if ( currentPosList.size() < 1 ) { continue; } if ( readGMLPositions( ringPositions, currentPosList.at( 0 ).toElement() ) != 0 ) { continue; } currentPolygonList.push_back( ringPositions ); } } multiPolygonPoints.push_back( currentPolygonList ); } int nPolygons = multiPolygonPoints.size(); if ( nPolygons < 1 ) return QgsGeometry(); int size = 1 + 2 * sizeof( int ); //calculate the wkb size for ( QgsMultiPolygonXY::const_iterator it = multiPolygonPoints.constBegin(); it != multiPolygonPoints.constEnd(); ++it ) { size += 1 + 2 * sizeof( int ); for ( QgsPolygonXY::const_iterator iter = it->begin(); iter != it->end(); ++iter ) { size += sizeof( int ) + 2 * iter->size() * sizeof( double ); } } QgsWkbTypes::Type type = QgsWkbTypes::MultiPolygon; unsigned char *wkb = new unsigned char[size]; char e = htonl( 1 ) != 1; int wkbPosition = 0; //current offset from wkb beginning (in bytes) double x, y; int nRings; int nPointsInRing; //fill the contents into *wkb memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); memcpy( &( wkb )[wkbPosition], &nPolygons, sizeof( int ) ); wkbPosition += sizeof( int ); type = QgsWkbTypes::Polygon; for ( QgsMultiPolygonXY::const_iterator it = multiPolygonPoints.constBegin(); it != multiPolygonPoints.constEnd(); ++it ) { memcpy( &( wkb )[wkbPosition], &e, 1 ); wkbPosition += 1; memcpy( &( wkb )[wkbPosition], &type, sizeof( int ) ); wkbPosition += sizeof( int ); nRings = it->size(); memcpy( &( wkb )[wkbPosition], &nRings, sizeof( int ) ); wkbPosition += sizeof( int ); for ( QgsPolygonXY::const_iterator iter = it->begin(); iter != it->end(); ++iter ) { nPointsInRing = iter->size(); memcpy( &( wkb )[wkbPosition], &nPointsInRing, sizeof( int ) ); wkbPosition += sizeof( int ); for ( QgsPolylineXY::const_iterator iterator = iter->begin(); iterator != iter->end(); ++iterator ) { x = iterator->x(); y = iterator->y(); memcpy( &( wkb )[wkbPosition], &x, sizeof( double ) ); wkbPosition += sizeof( double ); memcpy( &( wkb )[wkbPosition], &y, sizeof( double ) ); wkbPosition += sizeof( double ); } } } QgsGeometry g; g.fromWkb( wkb, size ); return g; } bool QgsOgcUtils::readGMLCoordinates( QgsPolylineXY &coords, const QDomElement &elem ) { QString coordSeparator = QStringLiteral( "," ); QString tupelSeparator = QStringLiteral( " " ); //"decimal" has to be "." coords.clear(); if ( elem.hasAttribute( QStringLiteral( "cs" ) ) ) { coordSeparator = elem.attribute( QStringLiteral( "cs" ) ); } if ( elem.hasAttribute( QStringLiteral( "ts" ) ) ) { tupelSeparator = elem.attribute( QStringLiteral( "ts" ) ); } QStringList tupels = elem.text().split( tupelSeparator, QString::SkipEmptyParts ); QStringList tuple_coords; double x, y; bool conversionSuccess; QStringList::const_iterator it; for ( it = tupels.constBegin(); it != tupels.constEnd(); ++it ) { tuple_coords = ( *it ).split( coordSeparator, QString::SkipEmptyParts ); if ( tuple_coords.size() < 2 ) { continue; } x = tuple_coords.at( 0 ).toDouble( &conversionSuccess ); if ( !conversionSuccess ) { return true; } y = tuple_coords.at( 1 ).toDouble( &conversionSuccess ); if ( !conversionSuccess ) { return true; } coords.push_back( QgsPointXY( x, y ) ); } return false; } QgsRectangle QgsOgcUtils::rectangleFromGMLBox( const QDomNode &boxNode ) { QgsRectangle rect; QDomElement boxElem = boxNode.toElement(); if ( boxElem.tagName() != QLatin1String( "Box" ) ) return rect; QDomElement bElem = boxElem.firstChild().toElement(); QString coordSeparator = QStringLiteral( "," ); QString tupelSeparator = QStringLiteral( " " ); if ( bElem.hasAttribute( QStringLiteral( "cs" ) ) ) { coordSeparator = bElem.attribute( QStringLiteral( "cs" ) ); } if ( bElem.hasAttribute( QStringLiteral( "ts" ) ) ) { tupelSeparator = bElem.attribute( QStringLiteral( "ts" ) ); } QString bString = bElem.text(); bool ok1, ok2, ok3, ok4; double xmin = bString.section( tupelSeparator, 0, 0 ).section( coordSeparator, 0, 0 ).toDouble( &ok1 ); double ymin = bString.section( tupelSeparator, 0, 0 ).section( coordSeparator, 1, 1 ).toDouble( &ok2 ); double xmax = bString.section( tupelSeparator, 1, 1 ).section( coordSeparator, 0, 0 ).toDouble( &ok3 ); double ymax = bString.section( tupelSeparator, 1, 1 ).section( coordSeparator, 1, 1 ).toDouble( &ok4 ); if ( ok1 && ok2 && ok3 && ok4 ) { rect = QgsRectangle( xmin, ymin, xmax, ymax ); rect.normalize(); } return rect; } bool QgsOgcUtils::readGMLPositions( QgsPolylineXY &coords, const QDomElement &elem ) { coords.clear(); QStringList pos = elem.text().split( ' ', QString::SkipEmptyParts ); double x, y; bool conversionSuccess; int posSize = pos.size(); int srsDimension = 2; if ( elem.hasAttribute( QStringLiteral( "srsDimension" ) ) ) { srsDimension = elem.attribute( QStringLiteral( "srsDimension" ) ).toInt( &conversionSuccess ); if ( !conversionSuccess ) { srsDimension = 2; } } else if ( elem.hasAttribute( QStringLiteral( "dimension" ) ) ) { srsDimension = elem.attribute( QStringLiteral( "dimension" ) ).toInt( &conversionSuccess ); if ( !conversionSuccess ) { srsDimension = 2; } } for ( int i = 0; i < posSize / srsDimension; i++ ) { x = pos.at( i * srsDimension ).toDouble( &conversionSuccess ); if ( !conversionSuccess ) { return true; } y = pos.at( i * srsDimension + 1 ).toDouble( &conversionSuccess ); if ( !conversionSuccess ) { return true; } coords.push_back( QgsPointXY( x, y ) ); } return false; } QgsRectangle QgsOgcUtils::rectangleFromGMLEnvelope( const QDomNode &envelopeNode ) { QgsRectangle rect; QDomElement envelopeElem = envelopeNode.toElement(); if ( envelopeElem.tagName() != QLatin1String( "Envelope" ) ) return rect; QDomNodeList lowerCornerList = envelopeElem.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "lowerCorner" ) ); if ( lowerCornerList.size() < 1 ) return rect; QDomNodeList upperCornerList = envelopeElem.elementsByTagNameNS( GML_NAMESPACE, QStringLiteral( "upperCorner" ) ); if ( upperCornerList.size() < 1 ) return rect; bool conversionSuccess; int srsDimension = 2; QDomElement elem = lowerCornerList.at( 0 ).toElement(); if ( elem.hasAttribute( QStringLiteral( "srsDimension" ) ) ) { srsDimension = elem.attribute( QStringLiteral( "srsDimension" ) ).toInt( &conversionSuccess ); if ( !conversionSuccess ) { srsDimension = 2; } } else if ( elem.hasAttribute( QStringLiteral( "dimension" ) ) ) { srsDimension = elem.attribute( QStringLiteral( "dimension" ) ).toInt( &conversionSuccess ); if ( !conversionSuccess ) { srsDimension = 2; } } QString bString = elem.text(); double xmin = bString.section( ' ', 0, 0 ).toDouble( &conversionSuccess ); if ( !conversionSuccess ) return rect; double ymin = bString.section( ' ', 1, 1 ).toDouble( &conversionSuccess ); if ( !conversionSuccess ) return rect; elem = upperCornerList.at( 0 ).toElement(); if ( elem.hasAttribute( QStringLiteral( "srsDimension" ) ) ) { srsDimension = elem.attribute( QStringLiteral( "srsDimension" ) ).toInt( &conversionSuccess ); if ( !conversionSuccess ) { srsDimension = 2; } } else if ( elem.hasAttribute( QStringLiteral( "dimension" ) ) ) { srsDimension = elem.attribute( QStringLiteral( "dimension" ) ).toInt( &conversionSuccess ); if ( !conversionSuccess ) { srsDimension = 2; } } Q_UNUSED( srsDimension ) bString = elem.text(); double xmax = bString.section( ' ', 0, 0 ).toDouble( &conversionSuccess ); if ( !conversionSuccess ) return rect; double ymax = bString.section( ' ', 1, 1 ).toDouble( &conversionSuccess ); if ( !conversionSuccess ) return rect; rect = QgsRectangle( xmin, ymin, xmax, ymax ); rect.normalize(); return rect; } QDomElement QgsOgcUtils::rectangleToGMLBox( QgsRectangle *box, QDomDocument &doc, int precision ) { return rectangleToGMLBox( box, doc, QString(), false, precision ); } QDomElement QgsOgcUtils::rectangleToGMLBox( QgsRectangle *box, QDomDocument &doc, const QString &srsName, bool invertAxisOrientation, int precision ) { if ( !box ) { return QDomElement(); } QDomElement boxElem = doc.createElement( QStringLiteral( "gml:Box" ) ); if ( !srsName.isEmpty() ) { boxElem.setAttribute( QStringLiteral( "srsName" ), srsName ); } QDomElement coordElem = doc.createElement( QStringLiteral( "gml:coordinates" ) ); coordElem.setAttribute( QStringLiteral( "cs" ), QStringLiteral( "," ) ); coordElem.setAttribute( QStringLiteral( "ts" ), QStringLiteral( " " ) ); QString coordString; coordString += qgsDoubleToString( invertAxisOrientation ? box->yMinimum() : box->xMinimum(), precision ); coordString += ','; coordString += qgsDoubleToString( invertAxisOrientation ? box->xMinimum() : box->yMinimum(), precision ); coordString += ' '; coordString += qgsDoubleToString( invertAxisOrientation ? box->yMaximum() : box->xMaximum(), precision ); coordString += ','; coordString += qgsDoubleToString( invertAxisOrientation ? box->xMaximum() : box->yMaximum(), precision ); QDomText coordText = doc.createTextNode( coordString ); coordElem.appendChild( coordText ); boxElem.appendChild( coordElem ); return boxElem; } QDomElement QgsOgcUtils::rectangleToGMLEnvelope( QgsRectangle *env, QDomDocument &doc, int precision ) { return rectangleToGMLEnvelope( env, doc, QString(), false, precision ); } QDomElement QgsOgcUtils::rectangleToGMLEnvelope( QgsRectangle *env, QDomDocument &doc, const QString &srsName, bool invertAxisOrientation, int precision ) { if ( !env ) { return QDomElement(); } QDomElement envElem = doc.createElement( QStringLiteral( "gml:Envelope" ) ); if ( !srsName.isEmpty() ) { envElem.setAttribute( QStringLiteral( "srsName" ), srsName ); } QString posList; QDomElement lowerCornerElem = doc.createElement( QStringLiteral( "gml:lowerCorner" ) ); posList = qgsDoubleToString( invertAxisOrientation ? env->yMinimum() : env->xMinimum(), precision ); posList += ' '; posList += qgsDoubleToString( invertAxisOrientation ? env->xMinimum() : env->yMinimum(), precision ); QDomText lowerCornerText = doc.createTextNode( posList ); lowerCornerElem.appendChild( lowerCornerText ); envElem.appendChild( lowerCornerElem ); QDomElement upperCornerElem = doc.createElement( QStringLiteral( "gml:upperCorner" ) ); posList = qgsDoubleToString( invertAxisOrientation ? env->yMaximum() : env->xMaximum(), precision ); posList += ' '; posList += qgsDoubleToString( invertAxisOrientation ? env->xMaximum() : env->yMaximum(), precision ); QDomText upperCornerText = doc.createTextNode( posList ); upperCornerElem.appendChild( upperCornerText ); envElem.appendChild( upperCornerElem ); return envElem; } QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocument &doc, const QString &format, int precision ) { return geometryToGML( geometry, doc, ( format == QLatin1String( "GML2" ) ) ? GML_2_1_2 : GML_3_2_1, QString(), false, QString(), precision ); } QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocument &doc, GMLVersion gmlVersion, const QString &srsName, bool invertAxisOrientation, const QString &gmlIdBase, int precision ) { if ( geometry.isNull() ) return QDomElement(); // coordinate separator QString cs = QStringLiteral( "," ); // tuple separator QString ts = QStringLiteral( " " ); // coord element tagname QDomElement baseCoordElem; bool hasZValue = false; QByteArray wkb( geometry.asWkb() ); QgsConstWkbPtr wkbPtr( wkb ); try { wkbPtr.readHeader(); } catch ( const QgsWkbException &e ) { Q_UNUSED( e ) // WKB exception while reading header return QDomElement(); } if ( gmlVersion != GML_2_1_2 ) { switch ( geometry.wkbType() ) { case QgsWkbTypes::Point25D: case QgsWkbTypes::Point: case QgsWkbTypes::MultiPoint25D: case QgsWkbTypes::MultiPoint: baseCoordElem = doc.createElement( QStringLiteral( "gml:pos" ) ); break; default: baseCoordElem = doc.createElement( QStringLiteral( "gml:posList" ) ); break; } baseCoordElem.setAttribute( QStringLiteral( "srsDimension" ), QStringLiteral( "2" ) ); cs = ' '; } else { baseCoordElem = doc.createElement( QStringLiteral( "gml:coordinates" ) ); baseCoordElem.setAttribute( QStringLiteral( "cs" ), cs ); baseCoordElem.setAttribute( QStringLiteral( "ts" ), ts ); } try { switch ( geometry.wkbType() ) { case QgsWkbTypes::Point25D: case QgsWkbTypes::Point: { QDomElement pointElem = doc.createElement( QStringLiteral( "gml:Point" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) pointElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase ); if ( !srsName.isEmpty() ) pointElem.setAttribute( QStringLiteral( "srsName" ), srsName ); QDomElement coordElem = baseCoordElem.cloneNode().toElement(); double x, y; if ( invertAxisOrientation ) wkbPtr >> y >> x; else wkbPtr >> x >> y; QDomText coordText = doc.createTextNode( qgsDoubleToString( x, precision ) + cs + qgsDoubleToString( y, precision ) ); coordElem.appendChild( coordText ); pointElem.appendChild( coordElem ); return pointElem; } case QgsWkbTypes::MultiPoint25D: hasZValue = true; //intentional fall-through FALLTHROUGH case QgsWkbTypes::MultiPoint: { QDomElement multiPointElem = doc.createElement( QStringLiteral( "gml:MultiPoint" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) multiPointElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase ); if ( !srsName.isEmpty() ) multiPointElem.setAttribute( QStringLiteral( "srsName" ), srsName ); int nPoints; wkbPtr >> nPoints; for ( int idx = 0; idx < nPoints; ++idx ) { QDomElement pointMemberElem = doc.createElement( QStringLiteral( "gml:pointMember" ) ); QDomElement pointElem = doc.createElement( QStringLiteral( "gml:Point" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) pointElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase + QStringLiteral( ".%1" ).arg( idx + 1 ) ); QDomElement coordElem = baseCoordElem.cloneNode().toElement(); wkbPtr.readHeader(); double x, y; if ( invertAxisOrientation ) wkbPtr >> y >> x; else wkbPtr >> x >> y; QDomText coordText = doc.createTextNode( qgsDoubleToString( x, precision ) + cs + qgsDoubleToString( y, precision ) ); coordElem.appendChild( coordText ); pointElem.appendChild( coordElem ); if ( hasZValue ) { wkbPtr += sizeof( double ); } pointMemberElem.appendChild( pointElem ); multiPointElem.appendChild( pointMemberElem ); } return multiPointElem; } case QgsWkbTypes::LineString25D: hasZValue = true; //intentional fall-through FALLTHROUGH case QgsWkbTypes::LineString: { QDomElement lineStringElem = doc.createElement( QStringLiteral( "gml:LineString" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) lineStringElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase ); if ( !srsName.isEmpty() ) lineStringElem.setAttribute( QStringLiteral( "srsName" ), srsName ); // get number of points in the line int nPoints; wkbPtr >> nPoints; QDomElement coordElem = baseCoordElem.cloneNode().toElement(); QString coordString; for ( int idx = 0; idx < nPoints; ++idx ) { if ( idx != 0 ) { coordString += ts; } double x, y; if ( invertAxisOrientation ) wkbPtr >> y >> x; else wkbPtr >> x >> y; coordString += qgsDoubleToString( x, precision ) + cs + qgsDoubleToString( y, precision ); if ( hasZValue ) { wkbPtr += sizeof( double ); } } QDomText coordText = doc.createTextNode( coordString ); coordElem.appendChild( coordText ); lineStringElem.appendChild( coordElem ); return lineStringElem; } case QgsWkbTypes::MultiLineString25D: hasZValue = true; //intentional fall-through FALLTHROUGH case QgsWkbTypes::MultiLineString: { QDomElement multiLineStringElem = doc.createElement( QStringLiteral( "gml:MultiLineString" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) multiLineStringElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase ); if ( !srsName.isEmpty() ) multiLineStringElem.setAttribute( QStringLiteral( "srsName" ), srsName ); int nLines; wkbPtr >> nLines; for ( int jdx = 0; jdx < nLines; jdx++ ) { QDomElement lineStringMemberElem = doc.createElement( QStringLiteral( "gml:lineStringMember" ) ); QDomElement lineStringElem = doc.createElement( QStringLiteral( "gml:LineString" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) lineStringElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase + QStringLiteral( ".%1" ).arg( jdx + 1 ) ); wkbPtr.readHeader(); int nPoints; wkbPtr >> nPoints; QDomElement coordElem = baseCoordElem.cloneNode().toElement(); QString coordString; for ( int idx = 0; idx < nPoints; idx++ ) { if ( idx != 0 ) { coordString += ts; } double x, y; if ( invertAxisOrientation ) wkbPtr >> y >> x; else wkbPtr >> x >> y; coordString += qgsDoubleToString( x, precision ) + cs + qgsDoubleToString( y, precision ); if ( hasZValue ) { wkbPtr += sizeof( double ); } } QDomText coordText = doc.createTextNode( coordString ); coordElem.appendChild( coordText ); lineStringElem.appendChild( coordElem ); lineStringMemberElem.appendChild( lineStringElem ); multiLineStringElem.appendChild( lineStringMemberElem ); } return multiLineStringElem; } case QgsWkbTypes::Polygon25D: hasZValue = true; //intentional fall-through FALLTHROUGH case QgsWkbTypes::Polygon: { QDomElement polygonElem = doc.createElement( QStringLiteral( "gml:Polygon" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) polygonElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase ); if ( !srsName.isEmpty() ) polygonElem.setAttribute( QStringLiteral( "srsName" ), srsName ); // get number of rings in the polygon int numRings; wkbPtr >> numRings; if ( numRings == 0 ) // sanity check for zero rings in polygon return QDomElement(); int *ringNumPoints = new int[numRings]; // number of points in each ring for ( int idx = 0; idx < numRings; idx++ ) { QString boundaryName = ( gmlVersion == GML_2_1_2 ) ? "gml:outerBoundaryIs" : "gml:exterior"; if ( idx != 0 ) { boundaryName = ( gmlVersion == GML_2_1_2 ) ? "gml:innerBoundaryIs" : "gml:interior"; } QDomElement boundaryElem = doc.createElement( boundaryName ); QDomElement ringElem = doc.createElement( QStringLiteral( "gml:LinearRing" ) ); // get number of points in the ring int nPoints; wkbPtr >> nPoints; ringNumPoints[idx] = nPoints; QDomElement coordElem = baseCoordElem.cloneNode().toElement(); QString coordString; for ( int jdx = 0; jdx < nPoints; jdx++ ) { if ( jdx != 0 ) { coordString += ts; } double x, y; if ( invertAxisOrientation ) wkbPtr >> y >> x; else wkbPtr >> x >> y; coordString += qgsDoubleToString( x, precision ) + cs + qgsDoubleToString( y, precision ); if ( hasZValue ) { wkbPtr += sizeof( double ); } } QDomText coordText = doc.createTextNode( coordString ); coordElem.appendChild( coordText ); ringElem.appendChild( coordElem ); boundaryElem.appendChild( ringElem ); polygonElem.appendChild( boundaryElem ); } delete [] ringNumPoints; return polygonElem; } case QgsWkbTypes::MultiPolygon25D: hasZValue = true; //intentional fall-through FALLTHROUGH case QgsWkbTypes::MultiPolygon: { QDomElement multiPolygonElem = doc.createElement( QStringLiteral( "gml:MultiPolygon" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) multiPolygonElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase ); if ( !srsName.isEmpty() ) multiPolygonElem.setAttribute( QStringLiteral( "srsName" ), srsName ); int numPolygons; wkbPtr >> numPolygons; for ( int kdx = 0; kdx < numPolygons; kdx++ ) { QDomElement polygonMemberElem = doc.createElement( QStringLiteral( "gml:polygonMember" ) ); QDomElement polygonElem = doc.createElement( QStringLiteral( "gml:Polygon" ) ); if ( gmlVersion == GML_3_2_1 && !gmlIdBase.isEmpty() ) polygonElem.setAttribute( QStringLiteral( "gml:id" ), gmlIdBase + QStringLiteral( ".%1" ).arg( kdx + 1 ) ); wkbPtr.readHeader(); int numRings; wkbPtr >> numRings; for ( int idx = 0; idx < numRings; idx++ ) { QString boundaryName = ( gmlVersion == GML_2_1_2 ) ? "gml:outerBoundaryIs" : "gml:exterior"; if ( idx != 0 ) { boundaryName = ( gmlVersion == GML_2_1_2 ) ? "gml:innerBoundaryIs" : "gml:interior"; } QDomElement boundaryElem = doc.createElement( boundaryName ); QDomElement ringElem = doc.createElement( QStringLiteral( "gml:LinearRing" ) ); int nPoints; wkbPtr >> nPoints; QDomElement coordElem = baseCoordElem.cloneNode().toElement(); QString coordString; for ( int jdx = 0; jdx < nPoints; jdx++ ) { if ( jdx != 0 ) { coordString += ts; } double x, y; if ( invertAxisOrientation ) wkbPtr >> y >> x; else wkbPtr >> x >> y; coordString += qgsDoubleToString( x, precision ) + cs + qgsDoubleToString( y, precision ); if ( hasZValue ) { wkbPtr += sizeof( double ); } } QDomText coordText = doc.createTextNode( coordString ); coordElem.appendChild( coordText ); ringElem.appendChild( coordElem ); boundaryElem.appendChild( ringElem ); polygonElem.appendChild( boundaryElem ); polygonMemberElem.appendChild( polygonElem ); multiPolygonElem.appendChild( polygonMemberElem ); } } return multiPolygonElem; } default: return QDomElement(); } } catch ( const QgsWkbException &e ) { Q_UNUSED( e ) return QDomElement(); } } QDomElement QgsOgcUtils::geometryToGML( const QgsGeometry &geometry, QDomDocument &doc, int precision ) { return geometryToGML( geometry, doc, QStringLiteral( "GML2" ), precision ); } QDomElement QgsOgcUtils::createGMLCoordinates( const QgsPolylineXY &points, QDomDocument &doc ) { QDomElement coordElem = doc.createElement( QStringLiteral( "gml:coordinates" ) ); coordElem.setAttribute( QStringLiteral( "cs" ), QStringLiteral( "," ) ); coordElem.setAttribute( QStringLiteral( "ts" ), QStringLiteral( " " ) ); QString coordString; QVector<QgsPointXY>::const_iterator pointIt = points.constBegin(); for ( ; pointIt != points.constEnd(); ++pointIt ) { if ( pointIt != points.constBegin() ) { coordString += ' '; } coordString += qgsDoubleToString( pointIt->x() ); coordString += ','; coordString += qgsDoubleToString( pointIt->y() ); } QDomText coordText = doc.createTextNode( coordString ); coordElem.appendChild( coordText ); return coordElem; } QDomElement QgsOgcUtils::createGMLPositions( const QgsPolylineXY &points, QDomDocument &doc ) { QDomElement posElem = doc.createElement( QStringLiteral( "gml:pos" ) ); if ( points.size() > 1 ) posElem = doc.createElement( QStringLiteral( "gml:posList" ) ); posElem.setAttribute( QStringLiteral( "srsDimension" ), QStringLiteral( "2" ) ); QString coordString; QVector<QgsPointXY>::const_iterator pointIt = points.constBegin(); for ( ; pointIt != points.constEnd(); ++pointIt ) { if ( pointIt != points.constBegin() ) { coordString += ' '; } coordString += qgsDoubleToString( pointIt->x() ); coordString += ' '; coordString += qgsDoubleToString( pointIt->y() ); } QDomText coordText = doc.createTextNode( coordString ); posElem.appendChild( coordText ); return posElem; } // ----------------------------------------- QColor QgsOgcUtils::colorFromOgcFill( const QDomElement &fillElement ) { if ( fillElement.isNull() || !fillElement.hasChildNodes() ) { return QColor(); } QString cssName; QString elemText; QColor color; QDomElement cssElem = fillElement.firstChildElement( QStringLiteral( "CssParameter" ) ); while ( !cssElem.isNull() ) { cssName = cssElem.attribute( QStringLiteral( "name" ), QStringLiteral( "not_found" ) ); if ( cssName != QLatin1String( "not_found" ) ) { elemText = cssElem.text(); if ( cssName == QLatin1String( "fill" ) ) { color.setNamedColor( elemText ); } else if ( cssName == QLatin1String( "fill-opacity" ) ) { bool ok; double opacity = elemText.toDouble( &ok ); if ( ok ) { color.setAlphaF( opacity ); } } } cssElem = cssElem.nextSiblingElement( QStringLiteral( "CssParameter" ) ); } return color; } QgsExpression *QgsOgcUtils::expressionFromOgcFilter( const QDomElement &element, QgsVectorLayer *layer ) { return expressionFromOgcFilter( element, QgsOgcUtils::FILTER_OGC_1_0, layer ); } QgsExpression *QgsOgcUtils::expressionFromOgcFilter( const QDomElement &element, const FilterVersion version, QgsVectorLayer *layer ) { if ( element.isNull() || !element.hasChildNodes() ) return nullptr; QgsExpression *expr = new QgsExpression(); // check if it is a single string value not having DOM elements // that express OGC operators if ( element.firstChild().nodeType() == QDomNode::TextNode ) { expr->setExpression( element.firstChild().nodeValue() ); return expr; } QgsOgcUtilsExpressionFromFilter utils( version, layer ); // then check OGC DOM elements that contain OGC tags specifying // OGC operators. QDomElement childElem = element.firstChildElement(); while ( !childElem.isNull() ) { QgsExpressionNode *node = utils.nodeFromOgcFilter( childElem ); if ( !node ) { // invalid expression, parser error expr->d->mParserErrorString = utils.errorMessage(); return expr; } // use the concat binary operator to append to the root node if ( !expr->d->mRootNode ) { expr->d->mRootNode = node; } else { expr->d->mRootNode = new QgsExpressionNodeBinaryOperator( QgsExpressionNodeBinaryOperator::boConcat, expr->d->mRootNode, node ); } childElem = childElem.nextSiblingElement(); } // update expression string expr->d->mExp = expr->dump(); return expr; } static const QMap<QString, int> BINARY_OPERATORS_TAG_NAMES_MAP { // logical { QStringLiteral( "Or" ), QgsExpressionNodeBinaryOperator::boOr }, { QStringLiteral( "And" ), QgsExpressionNodeBinaryOperator::boAnd }, // comparison { QStringLiteral( "PropertyIsEqualTo" ), QgsExpressionNodeBinaryOperator::boEQ }, { QStringLiteral( "PropertyIsNotEqualTo" ), QgsExpressionNodeBinaryOperator::boNE }, { QStringLiteral( "PropertyIsLessThanOrEqualTo" ), QgsExpressionNodeBinaryOperator::boLE }, { QStringLiteral( "PropertyIsGreaterThanOrEqualTo" ), QgsExpressionNodeBinaryOperator::boGE }, { QStringLiteral( "PropertyIsLessThan" ), QgsExpressionNodeBinaryOperator::boLT }, { QStringLiteral( "PropertyIsGreaterThan" ), QgsExpressionNodeBinaryOperator::boGT }, { QStringLiteral( "PropertyIsLike" ), QgsExpressionNodeBinaryOperator::boLike }, // arithmetic { QStringLiteral( "Add" ), QgsExpressionNodeBinaryOperator::boPlus }, { QStringLiteral( "Sub" ), QgsExpressionNodeBinaryOperator::boMinus }, { QStringLiteral( "Mul" ), QgsExpressionNodeBinaryOperator::boMul }, { QStringLiteral( "Div" ), QgsExpressionNodeBinaryOperator::boDiv }, }; static int binaryOperatorFromTagName( const QString &tagName ) { return BINARY_OPERATORS_TAG_NAMES_MAP.value( tagName, -1 ); } static QString binaryOperatorToTagName( QgsExpressionNodeBinaryOperator::BinaryOperator op ) { if ( op == QgsExpressionNodeBinaryOperator::boILike ) { return QStringLiteral( "PropertyIsLike" ); } return BINARY_OPERATORS_TAG_NAMES_MAP.key( op, QString() ); } static bool isBinaryOperator( const QString &tagName ) { return binaryOperatorFromTagName( tagName ) >= 0; } static bool isSpatialOperator( const QString &tagName ) { static QStringList spatialOps; if ( spatialOps.isEmpty() ) { spatialOps << QStringLiteral( "BBOX" ) << QStringLiteral( "Intersects" ) << QStringLiteral( "Contains" ) << QStringLiteral( "Crosses" ) << QStringLiteral( "Equals" ) << QStringLiteral( "Disjoint" ) << QStringLiteral( "Overlaps" ) << QStringLiteral( "Touches" ) << QStringLiteral( "Within" ); } return spatialOps.contains( tagName ); } QgsExpressionNode *QgsOgcUtils::nodeFromOgcFilter( QDomElement &element, QString &errorMessage, QgsVectorLayer *layer ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0, layer ); QgsExpressionNode *node = utils.nodeFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } QgsExpressionNodeBinaryOperator *QgsOgcUtils::nodeBinaryOperatorFromOgcFilter( QDomElement &element, QString &errorMessage, QgsVectorLayer *layer ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0, layer ); QgsExpressionNodeBinaryOperator *node = utils.nodeBinaryOperatorFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } QgsExpressionNodeFunction *QgsOgcUtils::nodeSpatialOperatorFromOgcFilter( QDomElement &element, QString &errorMessage ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0 ); QgsExpressionNodeFunction *node = utils.nodeSpatialOperatorFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } QgsExpressionNodeUnaryOperator *QgsOgcUtils::nodeNotFromOgcFilter( QDomElement &element, QString &errorMessage ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0 ); QgsExpressionNodeUnaryOperator *node = utils.nodeNotFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } QgsExpressionNodeFunction *QgsOgcUtils::nodeFunctionFromOgcFilter( QDomElement &element, QString &errorMessage ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0 ); QgsExpressionNodeFunction *node = utils.nodeFunctionFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } QgsExpressionNode *QgsOgcUtils::nodeLiteralFromOgcFilter( QDomElement &element, QString &errorMessage, QgsVectorLayer *layer ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0, layer ); QgsExpressionNode *node = utils.nodeLiteralFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } QgsExpressionNodeColumnRef *QgsOgcUtils::nodeColumnRefFromOgcFilter( QDomElement &element, QString &errorMessage ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0 ); QgsExpressionNodeColumnRef *node = utils.nodeColumnRefFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } QgsExpressionNode *QgsOgcUtils::nodeIsBetweenFromOgcFilter( QDomElement &element, QString &errorMessage ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0 ); QgsExpressionNode *node = utils.nodeIsBetweenFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } QgsExpressionNodeBinaryOperator *QgsOgcUtils::nodePropertyIsNullFromOgcFilter( QDomElement &element, QString &errorMessage ) { QgsOgcUtilsExpressionFromFilter utils( QgsOgcUtils::FILTER_OGC_1_0 ); QgsExpressionNodeBinaryOperator *node = utils.nodePropertyIsNullFromOgcFilter( element ); errorMessage = utils.errorMessage(); return node; } ///////////////// QDomElement QgsOgcUtils::expressionToOgcFilter( const QgsExpression &exp, QDomDocument &doc, QString *errorMessage ) { return expressionToOgcFilter( exp, doc, GML_2_1_2, FILTER_OGC_1_0, QStringLiteral( "geometry" ), QString(), false, false, errorMessage ); } QDomElement QgsOgcUtils::expressionToOgcExpression( const QgsExpression &exp, QDomDocument &doc, QString *errorMessage ) { return expressionToOgcExpression( exp, doc, GML_2_1_2, FILTER_OGC_1_0, QStringLiteral( "geometry" ), QString(), false, false, errorMessage ); } QDomElement QgsOgcUtils::expressionToOgcFilter( const QgsExpression &expression, QDomDocument &doc, GMLVersion gmlVersion, FilterVersion filterVersion, const QString &geometryName, const QString &srsName, bool honourAxisOrientation, bool invertAxisOrientation, QString *errorMessage ) { if ( !expression.rootNode() ) return QDomElement(); QgsExpression exp = expression; QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope(); QgsOgcUtilsExprToFilter utils( doc, gmlVersion, filterVersion, geometryName, srsName, honourAxisOrientation, invertAxisOrientation ); QDomElement exprRootElem = utils.expressionNodeToOgcFilter( exp.rootNode(), &exp, &context ); if ( errorMessage ) *errorMessage = utils.errorMessage(); if ( exprRootElem.isNull() ) return QDomElement(); QDomElement filterElem = ( filterVersion == FILTER_FES_2_0 ) ? doc.createElementNS( FES_NAMESPACE, QStringLiteral( "fes:Filter" ) ) : doc.createElementNS( OGC_NAMESPACE, QStringLiteral( "ogc:Filter" ) ); if ( utils.GMLNamespaceUsed() ) { QDomAttr attr = doc.createAttribute( QStringLiteral( "xmlns:gml" ) ); if ( gmlVersion == GML_3_2_1 ) attr.setValue( GML32_NAMESPACE ); else attr.setValue( GML_NAMESPACE ); filterElem.setAttributeNode( attr ); } filterElem.appendChild( exprRootElem ); return filterElem; } QDomElement QgsOgcUtils::expressionToOgcExpression( const QgsExpression &expression, QDomDocument &doc, GMLVersion gmlVersion, FilterVersion filterVersion, const QString &geometryName, const QString &srsName, bool honourAxisOrientation, bool invertAxisOrientation, QString *errorMessage ) { QgsExpressionContext context; context << QgsExpressionContextUtils::globalScope(); QgsExpression exp = expression; const QgsExpressionNode *node = exp.rootNode(); if ( !node ) return QDomElement(); switch ( node->nodeType() ) { case QgsExpressionNode::ntFunction: case QgsExpressionNode::ntLiteral: case QgsExpressionNode::ntColumnRef: { QgsOgcUtilsExprToFilter utils( doc, gmlVersion, filterVersion, geometryName, srsName, honourAxisOrientation, invertAxisOrientation ); QDomElement exprRootElem = utils.expressionNodeToOgcFilter( node, &exp, &context ); if ( errorMessage ) *errorMessage = utils.errorMessage(); if ( !exprRootElem.isNull() ) { return exprRootElem; } break; } default: { if ( errorMessage ) *errorMessage = QObject::tr( "Node type not supported in expression translation: %1" ).arg( node->nodeType() ); } } // got an error return QDomElement(); } QDomElement QgsOgcUtils::SQLStatementToOgcFilter( const QgsSQLStatement &statement, QDomDocument &doc, GMLVersion gmlVersion, FilterVersion filterVersion, const QList<LayerProperties> &layerProperties, bool honourAxisOrientation, bool invertAxisOrientation, const QMap< QString, QString> &mapUnprefixedTypenameToPrefixedTypename, QString *errorMessage ) { if ( !statement.rootNode() ) return QDomElement(); QgsOgcUtilsSQLStatementToFilter utils( doc, gmlVersion, filterVersion, layerProperties, honourAxisOrientation, invertAxisOrientation, mapUnprefixedTypenameToPrefixedTypename ); QDomElement exprRootElem = utils.toOgcFilter( statement.rootNode() ); if ( errorMessage ) *errorMessage = utils.errorMessage(); if ( exprRootElem.isNull() ) return QDomElement(); QDomElement filterElem = ( filterVersion == FILTER_FES_2_0 ) ? doc.createElementNS( FES_NAMESPACE, QStringLiteral( "fes:Filter" ) ) : doc.createElementNS( OGC_NAMESPACE, QStringLiteral( "ogc:Filter" ) ); if ( utils.GMLNamespaceUsed() ) { QDomAttr attr = doc.createAttribute( QStringLiteral( "xmlns:gml" ) ); if ( gmlVersion == GML_3_2_1 ) attr.setValue( GML32_NAMESPACE ); else attr.setValue( GML_NAMESPACE ); filterElem.setAttributeNode( attr ); } filterElem.appendChild( exprRootElem ); return filterElem; } // QDomElement QgsOgcUtilsExprToFilter::expressionNodeToOgcFilter( const QgsExpressionNode *node, QgsExpression *expression, const QgsExpressionContext *context ) { switch ( node->nodeType() ) { case QgsExpressionNode::ntUnaryOperator: return expressionUnaryOperatorToOgcFilter( static_cast<const QgsExpressionNodeUnaryOperator *>( node ), expression, context ); case QgsExpressionNode::ntBinaryOperator: return expressionBinaryOperatorToOgcFilter( static_cast<const QgsExpressionNodeBinaryOperator *>( node ), expression, context ); case QgsExpressionNode::ntInOperator: return expressionInOperatorToOgcFilter( static_cast<const QgsExpressionNodeInOperator *>( node ), expression, context ); case QgsExpressionNode::ntFunction: return expressionFunctionToOgcFilter( static_cast<const QgsExpressionNodeFunction *>( node ), expression, context ); case QgsExpressionNode::ntLiteral: return expressionLiteralToOgcFilter( static_cast<const QgsExpressionNodeLiteral *>( node ), expression, context ); case QgsExpressionNode::ntColumnRef: return expressionColumnRefToOgcFilter( static_cast<const QgsExpressionNodeColumnRef *>( node ), expression, context ); default: mErrorMessage = QObject::tr( "Node type not supported: %1" ).arg( node->nodeType() ); return QDomElement(); } } QDomElement QgsOgcUtilsExprToFilter::expressionUnaryOperatorToOgcFilter( const QgsExpressionNodeUnaryOperator *node, QgsExpression *expression, const QgsExpressionContext *context ) { QDomElement operandElem = expressionNodeToOgcFilter( node->operand(), expression, context ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); QDomElement uoElem; switch ( node->op() ) { case QgsExpressionNodeUnaryOperator::uoMinus: uoElem = mDoc.createElement( mFilterPrefix + ":Literal" ); if ( node->operand()->nodeType() == QgsExpressionNode::ntLiteral ) { // operand expression already created a Literal node: // take the literal value, prepend - and remove old literal node uoElem.appendChild( mDoc.createTextNode( "-" + operandElem.text() ) ); mDoc.removeChild( operandElem ); } else { mErrorMessage = QObject::tr( "This use of unary operator not implemented yet" ); return QDomElement(); } break; case QgsExpressionNodeUnaryOperator::uoNot: uoElem = mDoc.createElement( mFilterPrefix + ":Not" ); uoElem.appendChild( operandElem ); break; default: mErrorMessage = QObject::tr( "Unary operator '%1' not implemented yet" ).arg( node->text() ); return QDomElement(); } return uoElem; } QDomElement QgsOgcUtilsExprToFilter::expressionBinaryOperatorToOgcFilter( const QgsExpressionNodeBinaryOperator *node, QgsExpression *expression, const QgsExpressionContext *context ) { QDomElement leftElem = expressionNodeToOgcFilter( node->opLeft(), expression, context ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); QgsExpressionNodeBinaryOperator::BinaryOperator op = node->op(); // before right operator is parsed: to allow NULL handling if ( op == QgsExpressionNodeBinaryOperator::boIs || op == QgsExpressionNodeBinaryOperator::boIsNot ) { if ( node->opRight()->nodeType() == QgsExpressionNode::ntLiteral ) { const QgsExpressionNodeLiteral *rightLit = static_cast<const QgsExpressionNodeLiteral *>( node->opRight() ); if ( rightLit->value().isNull() ) { QDomElement elem = mDoc.createElement( mFilterPrefix + ":PropertyIsNull" ); elem.appendChild( leftElem ); if ( op == QgsExpressionNodeBinaryOperator::boIsNot ) { QDomElement notElem = mDoc.createElement( mFilterPrefix + ":Not" ); notElem.appendChild( elem ); return notElem; } return elem; } // continue with equal / not equal operator once the null case is handled op = ( op == QgsExpressionNodeBinaryOperator::boIs ? QgsExpressionNodeBinaryOperator::boEQ : QgsExpressionNodeBinaryOperator::boNE ); } } QDomElement rightElem = expressionNodeToOgcFilter( node->opRight(), expression, context ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); QString opText = binaryOperatorToTagName( op ); if ( opText.isEmpty() ) { // not implemented binary operators // TODO: regex, % (mod), ^ (pow) are not supported yet mErrorMessage = QObject::tr( "Binary operator %1 not implemented yet" ).arg( node->text() ); return QDomElement(); } QDomElement boElem = mDoc.createElement( mFilterPrefix + ":" + opText ); if ( op == QgsExpressionNodeBinaryOperator::boLike || op == QgsExpressionNodeBinaryOperator::boILike ) { if ( op == QgsExpressionNodeBinaryOperator::boILike ) boElem.setAttribute( QStringLiteral( "matchCase" ), QStringLiteral( "false" ) ); // setup wildCards to <ogc:PropertyIsLike> boElem.setAttribute( QStringLiteral( "wildCard" ), QStringLiteral( "%" ) ); boElem.setAttribute( QStringLiteral( "singleChar" ), QStringLiteral( "_" ) ); if ( mFilterVersion == QgsOgcUtils::FILTER_OGC_1_0 ) boElem.setAttribute( QStringLiteral( "escape" ), QStringLiteral( "\\" ) ); else boElem.setAttribute( QStringLiteral( "escapeChar" ), QStringLiteral( "\\" ) ); } boElem.appendChild( leftElem ); boElem.appendChild( rightElem ); return boElem; } QDomElement QgsOgcUtilsExprToFilter::expressionLiteralToOgcFilter( const QgsExpressionNodeLiteral *node, QgsExpression *expression, const QgsExpressionContext *context ) { Q_UNUSED( expression ) Q_UNUSED( context ) QString value; switch ( node->value().type() ) { case QVariant::Int: value = QString::number( node->value().toInt() ); break; case QVariant::Double: value = qgsDoubleToString( node->value().toDouble() ); break; case QVariant::String: value = node->value().toString(); break; case QVariant::Date: value = node->value().toDate().toString( Qt::ISODate ); break; case QVariant::DateTime: value = node->value().toDateTime().toString( Qt::ISODate ); break; default: mErrorMessage = QObject::tr( "Literal type not supported: %1" ).arg( node->value().type() ); return QDomElement(); } QDomElement litElem = mDoc.createElement( mFilterPrefix + ":Literal" ); litElem.appendChild( mDoc.createTextNode( value ) ); return litElem; } QDomElement QgsOgcUtilsExprToFilter::expressionColumnRefToOgcFilter( const QgsExpressionNodeColumnRef *node, QgsExpression *expression, const QgsExpressionContext *context ) { Q_UNUSED( expression ) Q_UNUSED( context ) QDomElement propElem = mDoc.createElement( mFilterPrefix + ":" + mPropertyName ); propElem.appendChild( mDoc.createTextNode( node->name() ) ); return propElem; } QDomElement QgsOgcUtilsExprToFilter::expressionInOperatorToOgcFilter( const QgsExpressionNodeInOperator *node, QgsExpression *expression, const QgsExpressionContext *context ) { if ( node->list()->list().size() == 1 ) return expressionNodeToOgcFilter( node->list()->list()[0], expression, context ); QDomElement orElem = mDoc.createElement( mFilterPrefix + ":Or" ); QDomElement leftNode = expressionNodeToOgcFilter( node->node(), expression, context ); const auto constList = node->list()->list(); for ( QgsExpressionNode *n : constList ) { QDomElement listNode = expressionNodeToOgcFilter( n, expression, context ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); QDomElement eqElem = mDoc.createElement( mFilterPrefix + ":PropertyIsEqualTo" ); eqElem.appendChild( leftNode.cloneNode() ); eqElem.appendChild( listNode ); orElem.appendChild( eqElem ); } if ( node->isNotIn() ) { QDomElement notElem = mDoc.createElement( mFilterPrefix + ":Not" ); notElem.appendChild( orElem ); return notElem; } return orElem; } static const QMap<QString, QString> BINARY_SPATIAL_OPS_MAP { { QStringLiteral( "disjoint" ), QStringLiteral( "Disjoint" ) }, { QStringLiteral( "intersects" ), QStringLiteral( "Intersects" )}, { QStringLiteral( "touches" ), QStringLiteral( "Touches" ) }, { QStringLiteral( "crosses" ), QStringLiteral( "Crosses" ) }, { QStringLiteral( "contains" ), QStringLiteral( "Contains" ) }, { QStringLiteral( "overlaps" ), QStringLiteral( "Overlaps" ) }, { QStringLiteral( "within" ), QStringLiteral( "Within" ) } }; static bool isBinarySpatialOperator( const QString &fnName ) { return BINARY_SPATIAL_OPS_MAP.contains( fnName ); } static QString tagNameForSpatialOperator( const QString &fnName ) { return BINARY_SPATIAL_OPS_MAP.value( fnName ); } static bool isGeometryColumn( const QgsExpressionNode *node ) { if ( node->nodeType() != QgsExpressionNode::ntFunction ) return false; const QgsExpressionNodeFunction *fn = static_cast<const QgsExpressionNodeFunction *>( node ); QgsExpressionFunction *fd = QgsExpression::Functions()[fn->fnIndex()]; return fd->name() == QLatin1String( "$geometry" ); } static QgsGeometry geometryFromConstExpr( const QgsExpressionNode *node ) { // Right now we support only geomFromWKT(' ..... ') // Ideally we should support any constant sub-expression (not dependent on feature's geometry or attributes) if ( node->nodeType() == QgsExpressionNode::ntFunction ) { const QgsExpressionNodeFunction *fnNode = static_cast<const QgsExpressionNodeFunction *>( node ); QgsExpressionFunction *fnDef = QgsExpression::Functions()[fnNode->fnIndex()]; if ( fnDef->name() == QLatin1String( "geom_from_wkt" ) ) { const QList<QgsExpressionNode *> &args = fnNode->args()->list(); if ( args[0]->nodeType() == QgsExpressionNode::ntLiteral ) { QString wkt = static_cast<const QgsExpressionNodeLiteral *>( args[0] )->value().toString(); return QgsGeometry::fromWkt( wkt ); } } } return QgsGeometry(); } QDomElement QgsOgcUtilsExprToFilter::expressionFunctionToOgcFilter( const QgsExpressionNodeFunction *node, QgsExpression *expression, const QgsExpressionContext *context ) { QgsExpressionFunction *fd = QgsExpression::Functions()[node->fnIndex()]; if ( fd->name() == QLatin1String( "intersects_bbox" ) ) { QList<QgsExpressionNode *> argNodes = node->args()->list(); Q_ASSERT( argNodes.count() == 2 ); // binary spatial ops must have two args QgsGeometry geom = geometryFromConstExpr( argNodes[1] ); if ( !geom.isNull() && isGeometryColumn( argNodes[0] ) ) { QgsRectangle rect = geom.boundingBox(); mGMLUsed = true; QDomElement elemBox = ( mGMLVersion == QgsOgcUtils::GML_2_1_2 ) ? QgsOgcUtils::rectangleToGMLBox( &rect, mDoc, mSrsName, mInvertAxisOrientation ) : QgsOgcUtils::rectangleToGMLEnvelope( &rect, mDoc, mSrsName, mInvertAxisOrientation ); QDomElement geomProperty = mDoc.createElement( mFilterPrefix + ":" + mPropertyName ); geomProperty.appendChild( mDoc.createTextNode( mGeometryName ) ); QDomElement funcElem = mDoc.createElement( mFilterPrefix + ":BBOX" ); funcElem.appendChild( geomProperty ); funcElem.appendChild( elemBox ); return funcElem; } else { mErrorMessage = QObject::tr( "<BBOX> is currently supported only in form: bbox($geometry, geomFromWKT('…'))" ); return QDomElement(); } } if ( isBinarySpatialOperator( fd->name() ) ) { QList<QgsExpressionNode *> argNodes = node->args()->list(); Q_ASSERT( argNodes.count() == 2 ); // binary spatial ops must have two args QgsExpressionNode *otherNode = nullptr; if ( isGeometryColumn( argNodes[0] ) ) otherNode = argNodes[1]; else if ( isGeometryColumn( argNodes[1] ) ) otherNode = argNodes[0]; else { mErrorMessage = QObject::tr( "Unable to translate spatial operator: at least one must refer to geometry." ); return QDomElement(); } QDomElement otherGeomElem; // the other node must be a geometry constructor if ( otherNode->nodeType() != QgsExpressionNode::ntFunction ) { mErrorMessage = QObject::tr( "spatial operator: the other operator must be a geometry constructor function" ); return QDomElement(); } const QgsExpressionNodeFunction *otherFn = static_cast<const QgsExpressionNodeFunction *>( otherNode ); QgsExpressionFunction *otherFnDef = QgsExpression::Functions()[otherFn->fnIndex()]; if ( otherFnDef->name() == QLatin1String( "geom_from_wkt" ) ) { QgsExpressionNode *firstFnArg = otherFn->args()->list()[0]; if ( firstFnArg->nodeType() != QgsExpressionNode::ntLiteral ) { mErrorMessage = QObject::tr( "geom_from_wkt: argument must be string literal" ); return QDomElement(); } QString wkt = static_cast<const QgsExpressionNodeLiteral *>( firstFnArg )->value().toString(); QgsGeometry geom = QgsGeometry::fromWkt( wkt ); otherGeomElem = QgsOgcUtils::geometryToGML( geom, mDoc, mGMLVersion, mSrsName, mInvertAxisOrientation, QStringLiteral( "qgis_id_geom_%1" ).arg( mGeomId ) ); mGeomId ++; } else if ( otherFnDef->name() == QLatin1String( "geom_from_gml" ) ) { QgsExpressionNode *firstFnArg = otherFn->args()->list()[0]; if ( firstFnArg->nodeType() != QgsExpressionNode::ntLiteral ) { mErrorMessage = QObject::tr( "geom_from_gml: argument must be string literal" ); return QDomElement(); } QDomDocument geomDoc; QString gml = static_cast<const QgsExpressionNodeLiteral *>( firstFnArg )->value().toString(); if ( !geomDoc.setContent( gml, true ) ) { mErrorMessage = QObject::tr( "geom_from_gml: unable to parse XML" ); return QDomElement(); } QDomNode geomNode = mDoc.importNode( geomDoc.documentElement(), true ); otherGeomElem = geomNode.toElement(); } else { mErrorMessage = QObject::tr( "spatial operator: unknown geometry constructor function" ); return QDomElement(); } mGMLUsed = true; QDomElement funcElem = mDoc.createElement( mFilterPrefix + ":" + tagNameForSpatialOperator( fd->name() ) ); QDomElement geomProperty = mDoc.createElement( mFilterPrefix + ":" + mPropertyName ); geomProperty.appendChild( mDoc.createTextNode( mGeometryName ) ); funcElem.appendChild( geomProperty ); funcElem.appendChild( otherGeomElem ); return funcElem; } if ( fd->isStatic( node, expression, context ) ) { QVariant result = fd->run( node->args(), context, expression, node ); QgsExpressionNodeLiteral literal( result ); return expressionLiteralToOgcFilter( &literal, expression, context ); } if ( fd->params() == 0 ) { mErrorMessage = QObject::tr( "Special columns/constants are not supported." ); return QDomElement(); } // this is somehow wrong - we are just hoping that the other side supports the same functions as we do... QDomElement funcElem = mDoc.createElement( mFilterPrefix + ":Function" ); funcElem.setAttribute( QStringLiteral( "name" ), fd->name() ); const auto constList = node->args()->list(); for ( QgsExpressionNode *n : constList ) { QDomElement childElem = expressionNodeToOgcFilter( n, expression, context ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); funcElem.appendChild( childElem ); } return funcElem; } // QgsOgcUtilsSQLStatementToFilter::QgsOgcUtilsSQLStatementToFilter( QDomDocument &doc, QgsOgcUtils::GMLVersion gmlVersion, QgsOgcUtils::FilterVersion filterVersion, const QList<QgsOgcUtils::LayerProperties> &layerProperties, bool honourAxisOrientation, bool invertAxisOrientation, const QMap< QString, QString> &mapUnprefixedTypenameToPrefixedTypename ) : mDoc( doc ) , mGMLUsed( false ) , mGMLVersion( gmlVersion ) , mFilterVersion( filterVersion ) , mLayerProperties( layerProperties ) , mHonourAxisOrientation( honourAxisOrientation ) , mInvertAxisOrientation( invertAxisOrientation ) , mFilterPrefix( ( filterVersion == QgsOgcUtils::FILTER_FES_2_0 ) ? "fes" : "ogc" ) , mPropertyName( ( filterVersion == QgsOgcUtils::FILTER_FES_2_0 ) ? "ValueReference" : "PropertyName" ) , mGeomId( 1 ) , mMapUnprefixedTypenameToPrefixedTypename( mapUnprefixedTypenameToPrefixedTypename ) { } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::Node *node ) { switch ( node->nodeType() ) { case QgsSQLStatement::ntUnaryOperator: return toOgcFilter( static_cast<const QgsSQLStatement::NodeUnaryOperator *>( node ) ); case QgsSQLStatement::ntBinaryOperator: return toOgcFilter( static_cast<const QgsSQLStatement::NodeBinaryOperator *>( node ) ); case QgsSQLStatement::ntInOperator: return toOgcFilter( static_cast<const QgsSQLStatement::NodeInOperator *>( node ) ); case QgsSQLStatement::ntBetweenOperator: return toOgcFilter( static_cast<const QgsSQLStatement::NodeBetweenOperator *>( node ) ); case QgsSQLStatement::ntFunction: return toOgcFilter( static_cast<const QgsSQLStatement::NodeFunction *>( node ) ); case QgsSQLStatement::ntLiteral: return toOgcFilter( static_cast<const QgsSQLStatement::NodeLiteral *>( node ) ); case QgsSQLStatement::ntColumnRef: return toOgcFilter( static_cast<const QgsSQLStatement::NodeColumnRef *>( node ) ); case QgsSQLStatement::ntSelect: return toOgcFilter( static_cast<const QgsSQLStatement::NodeSelect *>( node ) ); default: mErrorMessage = QObject::tr( "Node type not supported: %1" ).arg( node->nodeType() ); return QDomElement(); } } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeUnaryOperator *node ) { QDomElement operandElem = toOgcFilter( node->operand() ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); QDomElement uoElem; switch ( node->op() ) { case QgsSQLStatement::uoMinus: uoElem = mDoc.createElement( mFilterPrefix + ":Literal" ); if ( node->operand()->nodeType() == QgsSQLStatement::ntLiteral ) { // operand expression already created a Literal node: // take the literal value, prepend - and remove old literal node uoElem.appendChild( mDoc.createTextNode( "-" + operandElem.text() ) ); mDoc.removeChild( operandElem ); } else { mErrorMessage = QObject::tr( "This use of unary operator not implemented yet" ); return QDomElement(); } break; case QgsSQLStatement::uoNot: uoElem = mDoc.createElement( mFilterPrefix + ":Not" ); uoElem.appendChild( operandElem ); break; default: mErrorMessage = QObject::tr( "Unary operator %1 not implemented yet" ).arg( QgsSQLStatement::UNARY_OPERATOR_TEXT[node->op()] ); return QDomElement(); } return uoElem; } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeBinaryOperator *node ) { QDomElement leftElem = toOgcFilter( node->opLeft() ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); QgsSQLStatement::BinaryOperator op = node->op(); // before right operator is parsed: to allow NULL handling if ( op == QgsSQLStatement::boIs || op == QgsSQLStatement::boIsNot ) { if ( node->opRight()->nodeType() == QgsSQLStatement::ntLiteral ) { const QgsSQLStatement::NodeLiteral *rightLit = static_cast<const QgsSQLStatement::NodeLiteral *>( node->opRight() ); if ( rightLit->value().isNull() ) { QDomElement elem = mDoc.createElement( mFilterPrefix + ":PropertyIsNull" ); elem.appendChild( leftElem ); if ( op == QgsSQLStatement::boIsNot ) { QDomElement notElem = mDoc.createElement( mFilterPrefix + ":Not" ); notElem.appendChild( elem ); return notElem; } return elem; } // continue with equal / not equal operator once the null case is handled op = ( op == QgsSQLStatement::boIs ? QgsSQLStatement::boEQ : QgsSQLStatement::boNE ); } } QDomElement rightElem = toOgcFilter( node->opRight() ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); QString opText; if ( op == QgsSQLStatement::boOr ) opText = QStringLiteral( "Or" ); else if ( op == QgsSQLStatement::boAnd ) opText = QStringLiteral( "And" ); else if ( op == QgsSQLStatement::boEQ ) opText = QStringLiteral( "PropertyIsEqualTo" ); else if ( op == QgsSQLStatement::boNE ) opText = QStringLiteral( "PropertyIsNotEqualTo" ); else if ( op == QgsSQLStatement::boLE ) opText = QStringLiteral( "PropertyIsLessThanOrEqualTo" ); else if ( op == QgsSQLStatement::boGE ) opText = QStringLiteral( "PropertyIsGreaterThanOrEqualTo" ); else if ( op == QgsSQLStatement::boLT ) opText = QStringLiteral( "PropertyIsLessThan" ); else if ( op == QgsSQLStatement::boGT ) opText = QStringLiteral( "PropertyIsGreaterThan" ); else if ( op == QgsSQLStatement::boLike ) opText = QStringLiteral( "PropertyIsLike" ); else if ( op == QgsSQLStatement::boILike ) opText = QStringLiteral( "PropertyIsLike" ); if ( opText.isEmpty() ) { // not implemented binary operators mErrorMessage = QObject::tr( "Binary operator %1 not implemented yet" ).arg( QgsSQLStatement::BINARY_OPERATOR_TEXT[op] ); return QDomElement(); } QDomElement boElem = mDoc.createElement( mFilterPrefix + ":" + opText ); if ( op == QgsSQLStatement::boLike || op == QgsSQLStatement::boILike ) { if ( op == QgsSQLStatement::boILike ) boElem.setAttribute( QStringLiteral( "matchCase" ), QStringLiteral( "false" ) ); // setup wildCards to <ogc:PropertyIsLike> boElem.setAttribute( QStringLiteral( "wildCard" ), QStringLiteral( "%" ) ); boElem.setAttribute( QStringLiteral( "singleChar" ), QStringLiteral( "_" ) ); if ( mFilterVersion == QgsOgcUtils::FILTER_OGC_1_0 ) boElem.setAttribute( QStringLiteral( "escape" ), QStringLiteral( "\\" ) ); else boElem.setAttribute( QStringLiteral( "escapeChar" ), QStringLiteral( "\\" ) ); } boElem.appendChild( leftElem ); boElem.appendChild( rightElem ); return boElem; } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeLiteral *node ) { QString value; switch ( node->value().type() ) { case QVariant::Int: value = QString::number( node->value().toInt() ); break; case QVariant::LongLong: value = QString::number( node->value().toLongLong() ); break; case QVariant::Double: value = qgsDoubleToString( node->value().toDouble() ); break; case QVariant::String: value = node->value().toString(); break; default: mErrorMessage = QObject::tr( "Literal type not supported: %1" ).arg( node->value().type() ); return QDomElement(); } QDomElement litElem = mDoc.createElement( mFilterPrefix + ":Literal" ); litElem.appendChild( mDoc.createTextNode( value ) ); return litElem; } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeColumnRef *node ) { QDomElement propElem = mDoc.createElement( mFilterPrefix + ":" + mPropertyName ); if ( node->tableName().isEmpty() || mLayerProperties.size() == 1 ) propElem.appendChild( mDoc.createTextNode( node->name() ) ); else { QString tableName( mMapTableAliasToNames[node->tableName()] ); if ( mMapUnprefixedTypenameToPrefixedTypename.contains( tableName ) ) tableName = mMapUnprefixedTypenameToPrefixedTypename[tableName]; propElem.appendChild( mDoc.createTextNode( tableName + "/" + node->name() ) ); } return propElem; } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeInOperator *node ) { if ( node->list()->list().size() == 1 ) return toOgcFilter( node->list()->list()[0] ); QDomElement orElem = mDoc.createElement( mFilterPrefix + ":Or" ); QDomElement leftNode = toOgcFilter( node->node() ); const auto constList = node->list()->list(); for ( QgsSQLStatement::Node *n : constList ) { QDomElement listNode = toOgcFilter( n ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); QDomElement eqElem = mDoc.createElement( mFilterPrefix + ":PropertyIsEqualTo" ); eqElem.appendChild( leftNode.cloneNode() ); eqElem.appendChild( listNode ); orElem.appendChild( eqElem ); } if ( node->isNotIn() ) { QDomElement notElem = mDoc.createElement( mFilterPrefix + ":Not" ); notElem.appendChild( orElem ); return notElem; } return orElem; } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeBetweenOperator *node ) { QDomElement elem = mDoc.createElement( mFilterPrefix + ":PropertyIsBetween" ); elem.appendChild( toOgcFilter( node->node() ) ); QDomElement lowerBoundary = mDoc.createElement( mFilterPrefix + ":LowerBoundary" ); lowerBoundary.appendChild( toOgcFilter( node->minVal() ) ); elem.appendChild( lowerBoundary ); QDomElement upperBoundary = mDoc.createElement( mFilterPrefix + ":UpperBoundary" ); upperBoundary.appendChild( toOgcFilter( node->maxVal() ) ); elem.appendChild( upperBoundary ); if ( node->isNotBetween() ) { QDomElement notElem = mDoc.createElement( mFilterPrefix + ":Not" ); notElem.appendChild( elem ); return notElem; } return elem; } static QString mapBinarySpatialToOgc( const QString &name ) { QString nameCompare( name ); if ( name.size() > 3 && name.midRef( 0, 3 ).compare( QLatin1String( "ST_" ), Qt::CaseInsensitive ) == 0 ) nameCompare = name.mid( 3 ); QStringList spatialOps; spatialOps << QStringLiteral( "BBOX" ) << QStringLiteral( "Intersects" ) << QStringLiteral( "Contains" ) << QStringLiteral( "Crosses" ) << QStringLiteral( "Equals" ) << QStringLiteral( "Disjoint" ) << QStringLiteral( "Overlaps" ) << QStringLiteral( "Touches" ) << QStringLiteral( "Within" ); const auto constSpatialOps = spatialOps; for ( QString op : constSpatialOps ) { if ( nameCompare.compare( op, Qt::CaseInsensitive ) == 0 ) return op; } return QString(); } static QString mapTernarySpatialToOgc( const QString &name ) { QString nameCompare( name ); if ( name.size() > 3 && name.midRef( 0, 3 ).compare( QLatin1String( "ST_" ), Qt::CaseInsensitive ) == 0 ) nameCompare = name.mid( 3 ); if ( nameCompare.compare( QLatin1String( "DWithin" ), Qt::CaseInsensitive ) == 0 ) return QStringLiteral( "DWithin" ); if ( nameCompare.compare( QLatin1String( "Beyond" ), Qt::CaseInsensitive ) == 0 ) return QStringLiteral( "Beyond" ); return QString(); } QString QgsOgcUtilsSQLStatementToFilter::getGeometryColumnSRSName( const QgsSQLStatement::Node *node ) { if ( node->nodeType() != QgsSQLStatement::ntColumnRef ) return QString(); const QgsSQLStatement::NodeColumnRef *col = static_cast<const QgsSQLStatement::NodeColumnRef *>( node ); if ( !col->tableName().isEmpty() ) { const auto constMLayerProperties = mLayerProperties; for ( QgsOgcUtils::LayerProperties prop : constMLayerProperties ) { if ( prop.mName.compare( mMapTableAliasToNames[col->tableName()], Qt::CaseInsensitive ) == 0 && prop.mGeometryAttribute.compare( col->name(), Qt::CaseInsensitive ) == 0 ) { return prop.mSRSName; } } } if ( !mLayerProperties.empty() && mLayerProperties.at( 0 ).mGeometryAttribute.compare( col->name(), Qt::CaseInsensitive ) == 0 ) { return mLayerProperties.at( 0 ).mSRSName; } return QString(); } bool QgsOgcUtilsSQLStatementToFilter::processSRSName( const QgsSQLStatement::NodeFunction *mainNode, QList<QgsSQLStatement::Node *> args, bool lastArgIsSRSName, QString &srsName, bool &axisInversion ) { srsName = mCurrentSRSName; axisInversion = mInvertAxisOrientation; if ( lastArgIsSRSName ) { QgsSQLStatement::Node *lastArg = args[ args.size() - 1 ]; if ( lastArg->nodeType() != QgsSQLStatement::ntLiteral ) { mErrorMessage = QObject::tr( "%1: Last argument must be string or integer literal" ).arg( mainNode->name() ); return false; } const QgsSQLStatement::NodeLiteral *lit = static_cast<const QgsSQLStatement::NodeLiteral *>( lastArg ); if ( lit->value().type() == QVariant::Int ) { if ( mFilterVersion == QgsOgcUtils::FILTER_OGC_1_0 ) { srsName = "EPSG:" + QString::number( lit->value().toInt() ); } else { srsName = "urn:ogc:def:crs:EPSG::" + QString::number( lit->value().toInt() ); } } else { srsName = lit->value().toString(); if ( srsName.startsWith( QLatin1String( "EPSG:" ), Qt::CaseInsensitive ) ) return true; } } QgsCoordinateReferenceSystem crs; if ( !srsName.isEmpty() ) crs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( srsName ); if ( crs.isValid() ) { if ( mHonourAxisOrientation && crs.hasAxisInverted() ) { axisInversion = !axisInversion; } } return true; } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeFunction *node ) { // ST_GeometryFromText if ( node->name().compare( QLatin1String( "ST_GeometryFromText" ), Qt::CaseInsensitive ) == 0 ) { QList<QgsSQLStatement::Node *> args = node->args()->list(); if ( args.size() != 1 && args.size() != 2 ) { mErrorMessage = QObject::tr( "Function %1 should have 1 or 2 arguments" ).arg( node->name() ); return QDomElement(); } QgsSQLStatement::Node *firstFnArg = args[0]; if ( firstFnArg->nodeType() != QgsSQLStatement::ntLiteral ) { mErrorMessage = QObject::tr( "%1: First argument must be string literal" ).arg( node->name() ); return QDomElement(); } QString srsName; bool axisInversion; if ( ! processSRSName( node, args, args.size() == 2, srsName, axisInversion ) ) { return QDomElement(); } QString wkt = static_cast<const QgsSQLStatement::NodeLiteral *>( firstFnArg )->value().toString(); QgsGeometry geom = QgsGeometry::fromWkt( wkt ); QDomElement geomElem = QgsOgcUtils::geometryToGML( geom, mDoc, mGMLVersion, srsName, axisInversion, QStringLiteral( "qgis_id_geom_%1" ).arg( mGeomId ) ); mGeomId ++; if ( geomElem.isNull() ) { mErrorMessage = QObject::tr( "%1: invalid WKT" ).arg( node->name() ); return QDomElement(); } mGMLUsed = true; return geomElem; } // ST_MakeEnvelope if ( node->name().compare( QLatin1String( "ST_MakeEnvelope" ), Qt::CaseInsensitive ) == 0 ) { QList<QgsSQLStatement::Node *> args = node->args()->list(); if ( args.size() != 4 && args.size() != 5 ) { mErrorMessage = QObject::tr( "Function %1 should have 4 or 5 arguments" ).arg( node->name() ); return QDomElement(); } QgsRectangle rect; for ( int i = 0; i < 4; i++ ) { QgsSQLStatement::Node *arg = args[i]; if ( arg->nodeType() != QgsSQLStatement::ntLiteral ) { mErrorMessage = QObject::tr( "%1: Argument %2 must be numeric literal" ).arg( node->name() ).arg( i + 1 ); return QDomElement(); } const QgsSQLStatement::NodeLiteral *lit = static_cast<const QgsSQLStatement::NodeLiteral *>( arg ); double val = 0.0; if ( lit->value().type() == QVariant::Int ) val = lit->value().toInt(); else if ( lit->value().type() == QVariant::LongLong ) val = lit->value().toLongLong(); else if ( lit->value().type() == QVariant::Double ) val = lit->value().toDouble(); else { mErrorMessage = QObject::tr( "%1 Argument %2 must be numeric literal" ).arg( node->name() ).arg( i + 1 ); return QDomElement(); } if ( i == 0 ) rect.setXMinimum( val ); else if ( i == 1 ) rect.setYMinimum( val ); else if ( i == 2 ) rect.setXMaximum( val ); else rect.setYMaximum( val ); } QString srsName; bool axisInversion; if ( ! processSRSName( node, args, args.size() == 5, srsName, axisInversion ) ) { return QDomElement(); } mGMLUsed = true; return ( mGMLVersion == QgsOgcUtils::GML_2_1_2 ) ? QgsOgcUtils::rectangleToGMLBox( &rect, mDoc, srsName, axisInversion, 15 ) : QgsOgcUtils::rectangleToGMLEnvelope( &rect, mDoc, srsName, axisInversion, 15 ); } // ST_GeomFromGML if ( node->name().compare( QLatin1String( "ST_GeomFromGML" ), Qt::CaseInsensitive ) == 0 ) { QList<QgsSQLStatement::Node *> args = node->args()->list(); if ( args.size() != 1 ) { mErrorMessage = QObject::tr( "Function %1 should have 1 argument" ).arg( node->name() ); return QDomElement(); } QgsSQLStatement::Node *firstFnArg = args[0]; if ( firstFnArg->nodeType() != QgsSQLStatement::ntLiteral ) { mErrorMessage = QObject::tr( "%1: Argument must be string literal" ).arg( node->name() ); return QDomElement(); } QDomDocument geomDoc; QString gml = static_cast<const QgsSQLStatement::NodeLiteral *>( firstFnArg )->value().toString(); if ( !geomDoc.setContent( gml, true ) ) { mErrorMessage = QObject::tr( "ST_GeomFromGML: unable to parse XML" ); return QDomElement(); } QDomNode geomNode = mDoc.importNode( geomDoc.documentElement(), true ); mGMLUsed = true; return geomNode.toElement(); } // Binary geometry operators QString ogcName( mapBinarySpatialToOgc( node->name() ) ); if ( !ogcName.isEmpty() ) { QList<QgsSQLStatement::Node *> args = node->args()->list(); if ( args.size() != 2 ) { mErrorMessage = QObject::tr( "Function %1 should have 2 arguments" ).arg( node->name() ); return QDomElement(); } for ( int i = 0; i < 2; i ++ ) { if ( args[i]->nodeType() == QgsSQLStatement::ntFunction && ( static_cast<const QgsSQLStatement::NodeFunction *>( args[i] )->name().compare( QLatin1String( "ST_GeometryFromText" ), Qt::CaseInsensitive ) == 0 || static_cast<const QgsSQLStatement::NodeFunction *>( args[i] )->name().compare( QLatin1String( "ST_MakeEnvelope" ), Qt::CaseInsensitive ) == 0 ) ) { mCurrentSRSName = getGeometryColumnSRSName( args[1 - i] ); break; } } //if( ogcName == "Intersects" && mFilterVersion == QgsOgcUtils::FILTER_OGC_1_0 ) // ogcName = "Intersect"; QDomElement funcElem = mDoc.createElement( mFilterPrefix + ":" + ogcName ); const auto constArgs = args; for ( QgsSQLStatement::Node *n : constArgs ) { QDomElement childElem = toOgcFilter( n ); if ( !mErrorMessage.isEmpty() ) { mCurrentSRSName.clear(); return QDomElement(); } funcElem.appendChild( childElem ); } mCurrentSRSName.clear(); return funcElem; } ogcName = mapTernarySpatialToOgc( node->name() ); if ( !ogcName.isEmpty() ) { QList<QgsSQLStatement::Node *> args = node->args()->list(); if ( args.size() != 3 ) { mErrorMessage = QObject::tr( "Function %1 should have 3 arguments" ).arg( node->name() ); return QDomElement(); } for ( int i = 0; i < 2; i ++ ) { if ( args[i]->nodeType() == QgsSQLStatement::ntFunction && ( static_cast<const QgsSQLStatement::NodeFunction *>( args[i] )->name().compare( QLatin1String( "ST_GeometryFromText" ), Qt::CaseInsensitive ) == 0 || static_cast<const QgsSQLStatement::NodeFunction *>( args[i] )->name().compare( QLatin1String( "ST_MakeEnvelope" ), Qt::CaseInsensitive ) == 0 ) ) { mCurrentSRSName = getGeometryColumnSRSName( args[1 - i] ); break; } } QDomElement funcElem = mDoc.createElement( mFilterPrefix + ":" + node->name().mid( 3 ) ); for ( int i = 0; i < 2; i++ ) { QDomElement childElem = toOgcFilter( args[i] ); if ( !mErrorMessage.isEmpty() ) { mCurrentSRSName.clear(); return QDomElement(); } funcElem.appendChild( childElem ); } mCurrentSRSName.clear(); QgsSQLStatement::Node *distanceNode = args[2]; if ( distanceNode->nodeType() != QgsSQLStatement::ntLiteral ) { mErrorMessage = QObject::tr( "Function %1 3rd argument should be a numeric value or a string made of a numeric value followed by a string" ).arg( node->name() ); return QDomElement(); } const QgsSQLStatement::NodeLiteral *lit = static_cast<const QgsSQLStatement::NodeLiteral *>( distanceNode ); if ( lit->value().isNull() ) { mErrorMessage = QObject::tr( "Function %1 3rd argument should be a numeric value or a string made of a numeric value followed by a string" ).arg( node->name() ); return QDomElement(); } QString distance; QString unit( QStringLiteral( "m" ) ); switch ( lit->value().type() ) { case QVariant::Int: distance = QString::number( lit->value().toInt() ); break; case QVariant::LongLong: distance = QString::number( lit->value().toLongLong() ); break; case QVariant::Double: distance = qgsDoubleToString( lit->value().toDouble() ); break; case QVariant::String: { distance = lit->value().toString(); for ( int i = 0; i < distance.size(); i++ ) { if ( !( ( distance[i] >= '0' && distance[i] <= '9' ) || distance[i] == '-' || distance[i] == '.' || distance[i] == 'e' || distance[i] == 'E' ) ) { unit = distance.mid( i ).trimmed(); distance = distance.mid( 0, i ); break; } } break; } default: mErrorMessage = QObject::tr( "Literal type not supported: %1" ).arg( lit->value().type() ); return QDomElement(); } QDomElement distanceElem = mDoc.createElement( mFilterPrefix + ":Distance" ); if ( mFilterVersion == QgsOgcUtils::FILTER_FES_2_0 ) distanceElem.setAttribute( QStringLiteral( "uom" ), unit ); else distanceElem.setAttribute( QStringLiteral( "unit" ), unit ); distanceElem.appendChild( mDoc.createTextNode( distance ) ); funcElem.appendChild( distanceElem ); return funcElem; } // Other function QDomElement funcElem = mDoc.createElement( mFilterPrefix + ":Function" ); funcElem.setAttribute( QStringLiteral( "name" ), node->name() ); const auto constList = node->args()->list(); for ( QgsSQLStatement::Node *n : constList ) { QDomElement childElem = toOgcFilter( n ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); funcElem.appendChild( childElem ); } return funcElem; } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeJoin *node, const QString &leftTable ) { QgsSQLStatement::Node *onExpr = node->onExpr(); if ( onExpr ) { return toOgcFilter( onExpr ); } QList<QDomElement> listElem; const auto constUsingColumns = node->usingColumns(); for ( const QString &columnName : constUsingColumns ) { QDomElement eqElem = mDoc.createElement( mFilterPrefix + ":PropertyIsEqualTo" ); QDomElement propElem1 = mDoc.createElement( mFilterPrefix + ":" + mPropertyName ); propElem1.appendChild( mDoc.createTextNode( leftTable + "/" + columnName ) ); eqElem.appendChild( propElem1 ); QDomElement propElem2 = mDoc.createElement( mFilterPrefix + ":" + mPropertyName ); propElem2.appendChild( mDoc.createTextNode( node->tableDef()->name() + "/" + columnName ) ); eqElem.appendChild( propElem2 ); listElem.append( eqElem ); } if ( listElem.size() == 1 ) { return listElem[0]; } else if ( listElem.size() > 1 ) { QDomElement andElem = mDoc.createElement( mFilterPrefix + ":And" ); const auto constListElem = listElem; for ( const QDomElement &elem : constListElem ) { andElem.appendChild( elem ); } return andElem; } return QDomElement(); } void QgsOgcUtilsSQLStatementToFilter::visit( const QgsSQLStatement::NodeTableDef *node ) { if ( node->alias().isEmpty() ) { mMapTableAliasToNames[ node->name()] = node->name(); } else { mMapTableAliasToNames[ node->alias()] = node->name(); } } QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement::NodeSelect *node ) { QList<QDomElement> listElem; if ( mFilterVersion != QgsOgcUtils::FILTER_FES_2_0 && ( node->tables().size() != 1 || !node->joins().empty() ) ) { mErrorMessage = QObject::tr( "Joins are only supported with WFS 2.0" ); return QDomElement(); } // Register all table name aliases const auto constTables = node->tables(); for ( QgsSQLStatement::NodeTableDef *table : constTables ) { visit( table ); } const auto constJoins = node->joins(); for ( QgsSQLStatement::NodeJoin *join : constJoins ) { visit( join->tableDef() ); } // Process JOIN conditions QList< QgsSQLStatement::NodeTableDef *> nodeTables = node->tables(); QString leftTable = nodeTables.at( nodeTables.length() - 1 )->name(); for ( QgsSQLStatement::NodeJoin *join : constJoins ) { QDomElement joinElem = toOgcFilter( join, leftTable ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); listElem.append( joinElem ); leftTable = join->tableDef()->name(); } // Process WHERE conditions if ( node->where() ) { QDomElement whereElem = toOgcFilter( node->where() ); if ( !mErrorMessage.isEmpty() ) return QDomElement(); listElem.append( whereElem ); } // Concatenate all conditions if ( listElem.size() == 1 ) { return listElem[0]; } else if ( listElem.size() > 1 ) { QDomElement andElem = mDoc.createElement( mFilterPrefix + ":And" ); const auto constListElem = listElem; for ( const QDomElement &elem : constListElem ) { andElem.appendChild( elem ); } return andElem; } return QDomElement(); } QgsOgcUtilsExpressionFromFilter::QgsOgcUtilsExpressionFromFilter( const QgsOgcUtils::FilterVersion version, const QgsVectorLayer *layer ) : mLayer( layer ) { mPropertyName = QStringLiteral( "PropertyName" ); mPrefix = QStringLiteral( "ogc" ); if ( version == QgsOgcUtils::FILTER_FES_2_0 ) { mPropertyName = QStringLiteral( "ValueReference" ); mPrefix = QStringLiteral( "fes" ); } } QgsExpressionNode *QgsOgcUtilsExpressionFromFilter::nodeFromOgcFilter( const QDomElement &element ) { if ( element.isNull() ) return nullptr; // check for binary operators if ( isBinaryOperator( element.tagName() ) ) { return nodeBinaryOperatorFromOgcFilter( element ); } // check for spatial operators if ( isSpatialOperator( element.tagName() ) ) { return nodeSpatialOperatorFromOgcFilter( element ); } // check for other OGC operators, convert them to expressions if ( element.tagName() == QLatin1String( "Not" ) ) { return nodeNotFromOgcFilter( element ); } else if ( element.tagName() == QLatin1String( "PropertyIsNull" ) ) { return nodePropertyIsNullFromOgcFilter( element ); } else if ( element.tagName() == QLatin1String( "Literal" ) ) { return nodeLiteralFromOgcFilter( element ); } else if ( element.tagName() == QLatin1String( "Function" ) ) { return nodeFunctionFromOgcFilter( element ); } else if ( element.tagName() == mPropertyName ) { return nodeColumnRefFromOgcFilter( element ); } else if ( element.tagName() == QLatin1String( "PropertyIsBetween" ) ) { return nodeIsBetweenFromOgcFilter( element ); } mErrorMessage += QObject::tr( "unable to convert '%1' element to a valid expression: it is not supported yet or it has invalid arguments" ).arg( element.tagName() ); return nullptr; } QgsExpressionNodeBinaryOperator *QgsOgcUtilsExpressionFromFilter::nodeBinaryOperatorFromOgcFilter( const QDomElement &element ) { if ( element.isNull() ) return nullptr; int op = binaryOperatorFromTagName( element.tagName() ); if ( op < 0 ) { mErrorMessage = QObject::tr( "'%1' binary operator not supported." ).arg( element.tagName() ); return nullptr; } if ( op == QgsExpressionNodeBinaryOperator::boLike && element.hasAttribute( QStringLiteral( "matchCase" ) ) && element.attribute( QStringLiteral( "matchCase" ) ) == QLatin1String( "false" ) ) { op = QgsExpressionNodeBinaryOperator::boILike; } QDomElement operandElem = element.firstChildElement(); std::unique_ptr<QgsExpressionNode> expr( nodeFromOgcFilter( operandElem ) ); if ( !expr ) { mErrorMessage = QObject::tr( "invalid left operand for '%1' binary operator" ).arg( element.tagName() ); return nullptr; } std::unique_ptr<QgsExpressionNode> leftOp( expr->clone() ); for ( operandElem = operandElem.nextSiblingElement(); !operandElem.isNull(); operandElem = operandElem.nextSiblingElement() ) { std::unique_ptr<QgsExpressionNode> opRight( nodeFromOgcFilter( operandElem ) ); if ( !opRight ) { mErrorMessage = QObject::tr( "invalid right operand for '%1' binary operator" ).arg( element.tagName() ); return nullptr; } if ( op == QgsExpressionNodeBinaryOperator::boLike || op == QgsExpressionNodeBinaryOperator::boILike ) { QString wildCard; if ( element.hasAttribute( QStringLiteral( "wildCard" ) ) ) { wildCard = element.attribute( QStringLiteral( "wildCard" ) ); } QString singleChar; if ( element.hasAttribute( QStringLiteral( "singleChar" ) ) ) { singleChar = element.attribute( QStringLiteral( "singleChar" ) ); } QString escape = QStringLiteral( "\\" ); if ( element.hasAttribute( QStringLiteral( "escape" ) ) ) { escape = element.attribute( QStringLiteral( "escape" ) ); } if ( element.hasAttribute( QStringLiteral( "escapeChar" ) ) ) { escape = element.attribute( QStringLiteral( "escapeChar" ) ); } // replace QString oprValue = static_cast<const QgsExpressionNodeLiteral *>( opRight.get() )->value().toString(); if ( !wildCard.isEmpty() && wildCard != QLatin1String( "%" ) ) { oprValue.replace( '%', QLatin1String( "\\%" ) ); if ( oprValue.startsWith( wildCard ) ) { oprValue.replace( 0, 1, QStringLiteral( "%" ) ); } QRegExp rx( "[^" + QRegExp::escape( escape ) + "](" + QRegExp::escape( wildCard ) + ")" ); int pos = 0; while ( ( pos = rx.indexIn( oprValue, pos ) ) != -1 ) { oprValue.replace( pos + 1, 1, QStringLiteral( "%" ) ); pos += 1; } oprValue.replace( escape + wildCard, wildCard ); } if ( !singleChar.isEmpty() && singleChar != QLatin1String( "_" ) ) { oprValue.replace( '_', QLatin1String( "\\_" ) ); if ( oprValue.startsWith( singleChar ) ) { oprValue.replace( 0, 1, QStringLiteral( "_" ) ); } QRegExp rx( "[^" + QRegExp::escape( escape ) + "](" + QRegExp::escape( singleChar ) + ")" ); int pos = 0; while ( ( pos = rx.indexIn( oprValue, pos ) ) != -1 ) { oprValue.replace( pos + 1, 1, QStringLiteral( "_" ) ); pos += 1; } oprValue.replace( escape + singleChar, singleChar ); } if ( !escape.isEmpty() && escape != QLatin1String( "\\" ) ) { oprValue.replace( escape + escape, escape ); } opRight.reset( new QgsExpressionNodeLiteral( oprValue ) ); } expr.reset( new QgsExpressionNodeBinaryOperator( static_cast< QgsExpressionNodeBinaryOperator::BinaryOperator >( op ), expr.release(), opRight.release() ) ); } if ( expr == leftOp ) { mErrorMessage = QObject::tr( "only one operand for '%1' binary operator" ).arg( element.tagName() ); return nullptr; } return dynamic_cast< QgsExpressionNodeBinaryOperator * >( expr.release() ); } QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeSpatialOperatorFromOgcFilter( const QDomElement &element ) { // we are exploiting the fact that our function names are the same as the XML tag names const int opIdx = QgsExpression::functionIndex( element.tagName().toLower() ); std::unique_ptr<QgsExpressionNode::NodeList> gml2Args( new QgsExpressionNode::NodeList() ); QDomElement childElem = element.firstChildElement(); QString gml2Str; while ( !childElem.isNull() && gml2Str.isEmpty() ) { if ( childElem.tagName() != mPropertyName ) { QTextStream gml2Stream( &gml2Str ); childElem.save( gml2Stream, 0 ); } childElem = childElem.nextSiblingElement(); } if ( !gml2Str.isEmpty() ) { gml2Args->append( new QgsExpressionNodeLiteral( QVariant( gml2Str.remove( '\n' ) ) ) ); } else { mErrorMessage = QObject::tr( "No OGC Geometry found" ); return nullptr; } std::unique_ptr<QgsExpressionNode::NodeList> opArgs( new QgsExpressionNode::NodeList() ); opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "$geometry" ) ), new QgsExpressionNode::NodeList() ) ); opArgs->append( new QgsExpressionNodeFunction( QgsExpression::functionIndex( QStringLiteral( "geomFromGML" ) ), gml2Args.release() ) ); return new QgsExpressionNodeFunction( opIdx, opArgs.release() ); } QgsExpressionNodeColumnRef *QgsOgcUtilsExpressionFromFilter::nodeColumnRefFromOgcFilter( const QDomElement &element ) { if ( element.isNull() || element.tagName() != mPropertyName ) { mErrorMessage = QObject::tr( "%1:PropertyName expected, got %2" ).arg( mPrefix, element.tagName() ); return nullptr; } return new QgsExpressionNodeColumnRef( element.firstChild().nodeValue() ); } QgsExpressionNode *QgsOgcUtilsExpressionFromFilter::nodeLiteralFromOgcFilter( const QDomElement &element ) { if ( element.isNull() || element.tagName() != QLatin1String( "Literal" ) ) { mErrorMessage = QObject::tr( "%1:Literal expected, got %2" ).arg( mPrefix, element.tagName() ); return nullptr; } std::unique_ptr<QgsExpressionNode> root; // the literal content can have more children (e.g. CDATA section, text, ...) QDomNode childNode = element.firstChild(); while ( !childNode.isNull() ) { std::unique_ptr<QgsExpressionNode> operand; if ( childNode.nodeType() == QDomNode::ElementNode ) { // found a element node (e.g. PropertyName), convert it const QDomElement operandElem = childNode.toElement(); operand.reset( nodeFromOgcFilter( operandElem ) ); if ( !operand ) { mErrorMessage = QObject::tr( "'%1' is an invalid or not supported content for %2:Literal" ).arg( operandElem.tagName(), mPrefix ); return nullptr; } } else { // probably a text/CDATA node QVariant value = childNode.nodeValue(); bool converted = false; // try to convert the node content to corresponding field type if possible if ( mLayer ) { QDomElement propertyNameElement = element.previousSiblingElement( mPropertyName ); if ( propertyNameElement.isNull() || propertyNameElement.tagName() != mPropertyName ) { propertyNameElement = element.nextSiblingElement( mPropertyName ); } if ( !propertyNameElement.isNull() || propertyNameElement.tagName() == mPropertyName ) { const int fieldIndex = mLayer->fields().indexOf( propertyNameElement.firstChild().nodeValue() ); if ( fieldIndex != -1 ) { QgsField field = mLayer->fields().field( propertyNameElement.firstChild().nodeValue() ); field.convertCompatible( value ); converted = true; } } } if ( !converted ) { // try to convert the node content to number if possible, // otherwise let's use it as string bool ok; const double d = value.toDouble( &ok ); if ( ok ) value = d; } operand.reset( new QgsExpressionNodeLiteral( value ) ); if ( !operand ) continue; } // use the concat operator to merge the ogc:Literal children if ( !root ) { root = std::move( operand ); } else { root.reset( new QgsExpressionNodeBinaryOperator( QgsExpressionNodeBinaryOperator::boConcat, root.release(), operand.release() ) ); } childNode = childNode.nextSibling(); } if ( root ) return root.release(); return nullptr; } QgsExpressionNodeUnaryOperator *QgsOgcUtilsExpressionFromFilter::nodeNotFromOgcFilter( const QDomElement &element ) { if ( element.tagName() != QLatin1String( "Not" ) ) return nullptr; const QDomElement operandElem = element.firstChildElement(); std::unique_ptr<QgsExpressionNode> operand( nodeFromOgcFilter( operandElem ) ); if ( !operand ) { mErrorMessage = QObject::tr( "invalid operand for '%1' unary operator" ).arg( element.tagName() ); return nullptr; } return new QgsExpressionNodeUnaryOperator( QgsExpressionNodeUnaryOperator::uoNot, operand.release() ); } QgsExpressionNodeBinaryOperator *QgsOgcUtilsExpressionFromFilter::nodePropertyIsNullFromOgcFilter( const QDomElement &element ) { // convert ogc:PropertyIsNull to IS operator with NULL right operand if ( element.tagName() != QLatin1String( "PropertyIsNull" ) ) { return nullptr; } const QDomElement operandElem = element.firstChildElement(); std::unique_ptr<QgsExpressionNode> opLeft( nodeFromOgcFilter( operandElem ) ); if ( !opLeft ) return nullptr; std::unique_ptr<QgsExpressionNode> opRight( new QgsExpressionNodeLiteral( QVariant() ) ); return new QgsExpressionNodeBinaryOperator( QgsExpressionNodeBinaryOperator::boIs, opLeft.release(), opRight.release() ); } QgsExpressionNodeFunction *QgsOgcUtilsExpressionFromFilter::nodeFunctionFromOgcFilter( const QDomElement &element ) { if ( element.isNull() || element.tagName() != QLatin1String( "Function" ) ) { mErrorMessage = QObject::tr( "%1:Function expected, got %2" ).arg( mPrefix, element.tagName() ); return nullptr; } for ( int i = 0; i < QgsExpression::Functions().size(); i++ ) { const QgsExpressionFunction *funcDef = QgsExpression::Functions()[i]; if ( element.attribute( QStringLiteral( "name" ) ) != funcDef->name() ) continue; std::unique_ptr<QgsExpressionNode::NodeList> args( new QgsExpressionNode::NodeList() ); QDomElement operandElem = element.firstChildElement(); while ( !operandElem.isNull() ) { std::unique_ptr<QgsExpressionNode> op( nodeFromOgcFilter( operandElem ) ); if ( !op ) { return nullptr; } args->append( op.release() ); operandElem = operandElem.nextSiblingElement(); } return new QgsExpressionNodeFunction( i, args.release() ); } return nullptr; } QgsExpressionNode *QgsOgcUtilsExpressionFromFilter::nodeIsBetweenFromOgcFilter( const QDomElement &element ) { // <ogc:PropertyIsBetween> encode a Range check std::unique_ptr<QgsExpressionNode> operand; std::unique_ptr<QgsExpressionNode> lowerBound; std::unique_ptr<QgsExpressionNode> upperBound; QDomElement operandElem = element.firstChildElement(); while ( !operandElem.isNull() ) { if ( operandElem.tagName() == QLatin1String( "LowerBoundary" ) ) { QDomElement lowerBoundElem = operandElem.firstChildElement(); lowerBound.reset( nodeFromOgcFilter( lowerBoundElem ) ); } else if ( operandElem.tagName() == QLatin1String( "UpperBoundary" ) ) { QDomElement upperBoundElem = operandElem.firstChildElement(); upperBound.reset( nodeFromOgcFilter( upperBoundElem ) ); } else { // <ogc:expression> operand.reset( nodeFromOgcFilter( operandElem ) ); } if ( operand && lowerBound && upperBound ) break; operandElem = operandElem.nextSiblingElement(); } if ( !operand || !lowerBound || !upperBound ) { mErrorMessage = QObject::tr( "missing some required sub-elements in %1:PropertyIsBetween" ).arg( mPrefix ); return nullptr; } std::unique_ptr<QgsExpressionNode> leOperator( new QgsExpressionNodeBinaryOperator( QgsExpressionNodeBinaryOperator::boLE, operand->clone(), upperBound.release() ) ); std::unique_ptr<QgsExpressionNode> geOperator( new QgsExpressionNodeBinaryOperator( QgsExpressionNodeBinaryOperator::boGE, operand.release(), lowerBound.release() ) ); return new QgsExpressionNodeBinaryOperator( QgsExpressionNodeBinaryOperator::boAnd, geOperator.release(), leOperator.release() ); } QString QgsOgcUtilsExpressionFromFilter::errorMessage() const { return mErrorMessage; }
Java
{# This file was generated with the ext-templateevents:generate command. #} {%- if marttiphpbb_templateevents.enable -%} <a class="templateevents" title="3.1.0-a1&#10;navbar_header.html" href="https://github.com/phpbb/phpbb/tree/prep-release-3.2.2/phpBB/styles/prosilver/template/navbar_header.html#L86">overall_header_navigation_append</a> {%- endif -%}
Java
<?php /** *------------------------------------------------------------------------------ * @package T3 Framework for Joomla! *------------------------------------------------------------------------------ * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ // No direct access defined('_JEXEC') or die(); /** * T3Action class * * @package T3 */ class T3Action { public static function run ($action) { if (method_exists('T3Action', $action)) { $option = preg_replace('/[^A-Z0-9_\.-]/i', '', JFactory::getApplication()->input->getCmd('view')); if(!defined('JPATH_COMPONENT')){ define('JPATH_COMPONENT', JPATH_BASE . '/components/' . $option); } if(!defined('JPATH_COMPONENT_SITE')){ define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option); } if(!defined('JPATH_COMPONENT_ADMINISTRATOR')){ define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option); } T3Action::$action(); } exit; } public static function lessc () { $path = JFactory::getApplication()->input->getString ('s'); T3::import ('core/less'); $t3less = new T3Less; $css = $t3less->getCss($path); header("Content-Type: text/css"); header("Content-length: ".strlen($css)); echo $css; } public static function lesscall(){ T3::import ('core/less'); $result = array(); try{ T3Less::compileAll(); $result['successful'] = JText::_('T3_MSG_COMPILE_SUCCESS'); }catch(Exception $e){ $result['error'] = JText::sprintf('T3_MSG_COMPILE_FAILURE', $e->getMessage()); } echo json_encode($result); } public static function theme(){ JFactory::getLanguage()->load('tpl_' . T3_TEMPLATE, JPATH_SITE); if(!defined('T3')) { die(json_encode(array( 'error' => JText::_('T3_MSG_PLUGIN_NOT_READY') ))); } $user = JFactory::getUser(); $action = JFactory::getApplication()->input->getCmd('t3task', ''); if ($action != 'thememagic' && !$user->authorise('core.manage', 'com_templates')) { die(json_encode(array( 'error' => JText::_('T3_MSG_NO_PERMISSION') ))); } if(empty($action)){ die(json_encode(array( 'error' => JText::_('T3_MSG_UNKNOW_ACTION') ))); } T3::import('admin/theme'); if(method_exists('T3AdminTheme', $action)){ T3AdminTheme::$action(T3_TEMPLATE_PATH); } else { die(json_encode(array( 'error' => JText::_('T3_MSG_UNKNOW_ACTION') ))); } } public static function layout(){ self::cloneParam('t3layout'); if(!defined('T3')) { die(json_encode(array( 'error' => JText::_('T3_MSG_PLUGIN_NOT_READY') ))); } $action = JFactory::getApplication()->input->get('t3task', ''); if(empty($action)){ die(json_encode(array( 'error' => JText::_('T3_MSG_UNKNOW_ACTION') ))); } if($action != 'display'){ $user = JFactory::getUser(); if (!$user->authorise('core.manage', 'com_templates')) { die(json_encode(array( 'error' => JText::_('T3_MSG_NO_PERMISSION') ))); } } T3::import('admin/layout'); if(method_exists('T3AdminLayout', $action)){ T3AdminLayout::$action(T3_TEMPLATE_PATH); } else { die(json_encode(array( 'error' => JText::_('T3_MSG_UNKNOW_ACTION') ))); } } public static function megamenu() { self::cloneParam('t3menu'); if(!defined('T3')) { die(json_encode(array( 'error' => JText::_('T3_MSG_PLUGIN_NOT_READY') ))); } $action = JFactory::getApplication()->input->get('t3task', ''); if(empty($action)){ die(json_encode(array( 'error' => JText::_('T3_MSG_UNKNOW_ACTION') ))); } if($action != 'display'){ $user = JFactory::getUser(); if (!$user->authorise('core.manage', 'com_templates')) { die(json_encode(array( 'error' => JText::_('T3_MSG_NO_PERMISSION') ))); } } T3::import('admin/megamenu'); if(method_exists('T3AdminMegamenu', $action)){ T3AdminMegamenu::$action(); exit; } else { die(json_encode(array( 'error' => JText::_('T3_MSG_UNKNOW_ACTION') ))); } } public static function module () { $input = JFactory::getApplication()->input; $id = $input->getInt ('mid'); $module = null; if ($id) { // load module $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('m.id, m.title, m.module, m.position, m.content, m.showtitle, m.params') ->from('#__modules AS m') ->where('m.id = '.$id) ->where('m.published = 1'); $db->setQuery($query); $module = $db->loadObject (); } if (!empty ($module)) { $style = $input->getCmd ('style', 'T3Xhtml'); $buffer = JModuleHelper::renderModule($module, array('style'=>$style)); // replace relative images url $base = JURI::base(true).'/'; $protocols = '[a-zA-Z0-9]+:'; //To check for all unknown protocals (a protocol must contain at least one alpahnumeric fillowed by : $regex = '#(src)="(?!/|' . $protocols . '|\#|\')([^"]*)"#m'; $buffer = preg_replace($regex, "$1=\"$base\$2\"", $buffer); } //remove invisibile content, there are more ... but ... $buffer = preg_replace(array( '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu'), array('', ''), $buffer); echo $buffer; } //translate param name to new name, from jvalue => to desired param name public static function cloneParam($param = '', $from = 'jvalue'){ $input = JFactory::getApplication()->input; if(!empty($param) && $input->getWord($param, '') == ''){ $input->set($param, $input->getCmd($from)); } } }
Java
/** * This file has no copyright assigned and is placed in the Public Domain. * This file is part of the mingw-w64 runtime package. * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ #ifndef _INC_NLDEF #define _INC_NLDEF typedef enum _NL_ADDRESS_TYPE { NlatUnspecified, NlatUnicast, NlatAnycast, NlatMulticast, NlatBroadcast, NlatInvalid } NL_ADDRESS_TYPE, *PNL_ADDRESS_TYPE; typedef enum _NL_DAD_STATE { NldsInvalid = 0, NldsTentative, NldsDuplicate, NldsDeprecated, NldsPreferred, IpDadStateInvalid = 0, IpDadStateTentative, IpDadStateDuplicate, IpDadStateDeprecated, IpDadStatePreferred } NL_DAD_STATE; typedef enum _NL_LINK_LOCAL_ADDRESS_BEHAVIOR { LinkLocalAlwaysOff = 0, LinkLocalDelayed, LinkLocalAlwaysOn, LinkLocalUnchanged = -1 } NL_LINK_LOCAL_ADDRESS_BEHAVIOR; typedef enum _NL_NEIGHBOR_STATE { NlnsUnreachable, NlnsIncomplete, NlnsProbe, NlnsDelay, NlnsStale, NlnsReachable, NlnsPermanent, NlnsMaximum } NL_NEIGHBOR_STATE, *PNL_NEIGHBOR_STATE; typedef enum _tag_NL_PREFIX_ORIGIN { IpPrefixOriginOther = 0, IpPrefixOriginManual, IpPrefixOriginWellKnown, IpPrefixOriginDhcp, IpPrefixOriginRouterAdvertisement, IpPrefixOriginUnchanged = 1 << 4 } NL_PREFIX_ORIGIN; typedef enum _NL_ROUTE_ORIGIN { NlroManual, NlroWellKnown, NlroDHCP, NlroRouterAdvertisement, Nlro6to4 } NL_ROUTE_ORIGIN, *PNL_ROUTE_ORIGIN; typedef enum _NL_ROUTE_PROTOCOL { RouteProtocolOther = 1, RouteProtocolLocal, RouteProtocolNetMgmt, RouteProtocolIcmp, RouteProtocolEgp, RouteProtocolGgp, RouteProtocolHello, RouteProtocolRip, RouteProtocolIsIs, RouteProtocolEsIs, RouteProtocolCisco, RouteProtocolBbn, RouteProtocolOspf, RouteProtocolBgp, MIB_IPPROTO_OTHER = 1, PROTO_IP_OTHER = 1, MIB_IPPROTO_LOCAL = 2, PROTO_IP_LOCAL = 2, MIB_IPPROTO_NETMGMT = 3, PROTO_IP_NETMGMT = 3, MIB_IPPROTO_ICMP = 4, PROTO_IP_ICMP = 4, MIB_IPPROTO_EGP = 5, PROTO_IP_EGP = 5, MIB_IPPROTO_GGP = 6, PROTO_IP_GGP = 6, MIB_IPPROTO_HELLO = 7, PROTO_IP_HELLO = 7, MIB_IPPROTO_RIP = 8, PROTO_IP_RIP = 8, MIB_IPPROTO_IS_IS = 9, PROTO_IP_IS_IS = 9, MIB_IPPROTO_ES_IS = 10, PROTO_IP_ES_IS = 10, MIB_IPPROTO_CISCO = 11, PROTO_IP_CISCO = 11, MIB_IPPROTO_BBN = 12, PROTO_IP_BBN = 12, MIB_IPPROTO_OSPF = 13, PROTO_IP_OSPF = 13, MIB_IPPROTO_BGP = 14, PROTO_IP_BGP = 14, MIB_IPPROTO_NT_AUTOSTATIC = 10002, PROTO_IP_NT_AUTOSTATIC = 10002, MIB_IPPROTO_NT_STATIC = 10006, PROTO_IP_NT_STATIC = 10006, MIB_IPPROTO_NT_STATIC_NON_DOD = 10007, PROTO_IP_NT_STATIC_NON_DOD = 10007 } NL_ROUTE_PROTOCOL, *PNL_ROUTE_PROTOCOL; typedef enum _NL_ROUTER_DISCOVERY_BEHAVIOR { RouterDiscoveryDisabled = 0, RouterDiscoveryEnabled, RouterDiscoveryDhcp, RouterDiscoveryUnchanged = -1 } NL_ROUTER_DISCOVERY_BEHAVIOR; typedef enum _tag_NL_SUFFIX_ORIGIN { NlsoOther = 0, NlsoManual, NlsoWellKnown, NlsoDhcp, NlsoLinkLayerAddress, NlsoRandom, IpSuffixOriginOther = 0, IpSuffixOriginManual, IpSuffixOriginWellKnown, IpSuffixOriginDhcp, IpSuffixOriginLinkLayerAddress, IpSuffixOriginRandom, IpSuffixOriginUnchanged = 1 << 4 } NL_SUFFIX_ORIGIN; typedef struct _NL_INTERFACE_OFFLOAD_ROD { BOOLEAN NlChecksumSupported :1; BOOLEAN NlOptionsSupported :1; BOOLEAN TlDatagramChecksumSupported :1; BOOLEAN TlStreamChecksumSupported :1; BOOLEAN TlStreamOptionsSupported :1; BOOLEAN FastPathCompatible : 1; BOOLEAN TlLargeSendOffloadSupported :1; BOOLEAN TlGiantSendOffloadSupported :1; } NL_INTERFACE_OFFLOAD_ROD, *PNL_INTERFACE_OFFLOAD_ROD; #endif /*_INC_NLDEF*/
Java
/* Copyright (C) 2003 - 2018 by David White <dave@whitevine.net> Part of the Battle for Wesnoth Project https://www.wesnoth.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. See the COPYING file for more details. */ /** * @file * Fighting. */ #include "actions/attack.hpp" #include "actions/advancement.hpp" #include "actions/vision.hpp" #include "ai/lua/aspect_advancements.hpp" #include "formula/callable_objects.hpp" #include "formula/formula.hpp" #include "game_config.hpp" #include "game_data.hpp" #include "game_events/pump.hpp" #include "gettext.hpp" #include "log.hpp" #include "map/map.hpp" #include "mouse_handler_base.hpp" #include "play_controller.hpp" #include "preferences/game.hpp" #include "random.hpp" #include "replay.hpp" #include "resources.hpp" #include "statistics.hpp" #include "synced_checkup.hpp" #include "synced_user_choice.hpp" #include "team.hpp" #include "tod_manager.hpp" #include "units/abilities.hpp" #include "units/animation_component.hpp" #include "units/helper.hpp" #include "units/filter.hpp" #include "units/map.hpp" #include "units/udisplay.hpp" #include "units/unit.hpp" #include "whiteboard/manager.hpp" #include "wml_exception.hpp" static lg::log_domain log_engine("engine"); #define DBG_NG LOG_STREAM(debug, log_engine) #define LOG_NG LOG_STREAM(info, log_engine) #define WRN_NG LOG_STREAM(err, log_engine) #define ERR_NG LOG_STREAM(err, log_engine) static lg::log_domain log_attack("engine/attack"); #define DBG_AT LOG_STREAM(debug, log_attack) #define LOG_AT LOG_STREAM(info, log_attack) #define WRN_AT LOG_STREAM(err, log_attack) #define ERR_AT LOG_STREAM(err, log_attack) static lg::log_domain log_config("config"); #define LOG_CF LOG_STREAM(info, log_config) // ================================================================================== // BATTLE CONTEXT UNIT STATS // ================================================================================== battle_context_unit_stats::battle_context_unit_stats(const unit& u, const map_location& u_loc, int u_attack_num, bool attacking, const unit& opp, const map_location& opp_loc, const_attack_ptr opp_weapon, const unit_map& units) : weapon(nullptr) , attack_num(u_attack_num) , is_attacker(attacking) , is_poisoned(u.get_state(unit::STATE_POISONED)) , is_slowed(u.get_state(unit::STATE_SLOWED)) , slows(false) , drains(false) , petrifies(false) , plagues(false) , poisons(false) , backstab_pos(false) , swarm(false) , firststrike(false) , disable(false) , experience(u.experience()) , max_experience(u.max_experience()) , level(u.level()) , rounds(1) , hp(0) , max_hp(u.max_hitpoints()) , chance_to_hit(0) , damage(0) , slow_damage(0) , drain_percent(0) , drain_constant(0) , num_blows(0) , swarm_min(0) , swarm_max(0) , plague_type() { // Get the current state of the unit. if(attack_num >= 0) { weapon = u.attacks()[attack_num].shared_from_this(); } if(u.hitpoints() < 0) { LOG_CF << "Unit with " << u.hitpoints() << " hitpoints found, set to 0 for damage calculations\n"; hp = 0; } else if(u.hitpoints() > u.max_hitpoints()) { // If a unit has more hp than its maximum, the engine will fail with an // assertion failure due to accessing the prob_matrix out of bounds. hp = u.max_hitpoints(); } else { hp = u.hitpoints(); } // Exit if no weapon. if(!weapon) { return; } // Get the weapon characteristics as appropriate. auto ctx = weapon->specials_context(&u, &opp, u_loc, opp_loc, attacking, opp_weapon); boost::optional<decltype(ctx)> opp_ctx; if(opp_weapon) { opp_ctx.emplace(opp_weapon->specials_context(&opp, &u, opp_loc, u_loc, !attacking, weapon)); } slows = weapon->bool_ability("slow"); drains = !opp.get_state("undrainable") && weapon->bool_ability("drains"); petrifies = weapon->bool_ability("petrifies"); poisons = !opp.get_state("unpoisonable") && weapon->bool_ability("poison") && !opp.get_state(unit::STATE_POISONED); backstab_pos = is_attacker && backstab_check(u_loc, opp_loc, units, resources::gameboard->teams()); rounds = weapon->get_specials("berserk").highest("value", 1).first; if(weapon->combat_ability("berserk", 1).second) { rounds = weapon->combat_ability("berserk", 1).first; } firststrike = weapon->bool_ability("firststrike"); { const int distance = distance_between(u_loc, opp_loc); const bool out_of_range = distance > weapon->max_range() || distance < weapon->min_range(); disable = weapon->get_special_bool("disable") || out_of_range; } // Handle plague. unit_ability_list plague_specials = weapon->get_specials("plague"); plagues = !opp.get_state("unplagueable") && !plague_specials.empty() && opp.undead_variation() != "null" && !resources::gameboard->map().is_village(opp_loc); if(plagues) { plague_type = (*plague_specials.front().first)["type"].str(); if(plague_type.empty()) { plague_type = u.type().base_id(); } } // Compute chance to hit. signed int cth = opp.defense_modifier(resources::gameboard->map().get_terrain(opp_loc)) + weapon->accuracy() - (opp_weapon ? opp_weapon->parry() : 0); cth = utils::clamp(cth, 0, 100); unit_ability_list cth_specials = weapon->get_specials("chance_to_hit"); unit_abilities::effect cth_effects(cth_specials, cth, backstab_pos); cth = cth_effects.get_composite_value(); cth = utils::clamp(cth, 0, 100); cth = weapon->combat_ability("chance_to_hit", cth, backstab_pos).first; if(opp.get_state("invulnerable")) { cth = 0; } chance_to_hit = utils::clamp(cth, 0, 100); // Compute base damage done with the weapon. int base_damage = weapon->modified_damage(backstab_pos); // Get the damage multiplier applied to the base damage of the weapon. int damage_multiplier = 100; // Time of day bonus. damage_multiplier += combat_modifier( resources::gameboard->units(), resources::gameboard->map(), u_loc, u.alignment(), u.is_fearless()); // Leadership bonus. int leader_bonus = under_leadership(u, u_loc, weapon, opp_weapon); if(leader_bonus != 0) { damage_multiplier += leader_bonus; } // Resistance modifier. damage_multiplier *= opp.damage_from(*weapon, !attacking, opp_loc, opp_weapon); // Compute both the normal and slowed damage. damage = round_damage(base_damage, damage_multiplier, 10000); slow_damage = round_damage(base_damage, damage_multiplier, 20000); if(is_slowed) { damage = slow_damage; } // Compute drain amounts only if draining is possible. if(drains) { if (weapon->get_special_bool("drains")) { unit_ability_list drain_specials = weapon->get_specials("drains"); // Compute the drain percent (with 50% as the base for backward compatibility) unit_abilities::effect drain_percent_effects(drain_specials, 50, backstab_pos); drain_percent = drain_percent_effects.get_composite_value(); } if (weapon->combat_ability("drains", 50, backstab_pos).second) { drain_percent = weapon->combat_ability("drains", 50, backstab_pos).first; } } // Add heal_on_hit (the drain constant) unit_ability_list heal_on_hit_specials = weapon->get_specials("heal_on_hit"); unit_abilities::effect heal_on_hit_effects(heal_on_hit_specials, 0, backstab_pos); drain_constant += heal_on_hit_effects.get_composite_value(); drains = drain_constant || drain_percent; // Compute the number of blows and handle swarm. weapon->modified_attacks(backstab_pos, swarm_min, swarm_max); swarm = swarm_min != swarm_max; num_blows = calc_blows(hp); } battle_context_unit_stats::battle_context_unit_stats(const unit_type* u_type, const_attack_ptr att_weapon, bool attacking, const unit_type* opp_type, const_attack_ptr opp_weapon, unsigned int opp_terrain_defense, int lawful_bonus) : weapon(att_weapon) , attack_num(-2) // This is and stays invalid. Always use weapon when using this constructor. , is_attacker(attacking) , is_poisoned(false) , is_slowed(false) , slows(false) , drains(false) , petrifies(false) , plagues(false) , poisons(false) , backstab_pos(false) , swarm(false) , firststrike(false) , disable(false) , experience(0) , max_experience(0) , level(0) , rounds(1) , hp(0) , max_hp(0) , chance_to_hit(0) , damage(0) , slow_damage(0) , drain_percent(0) , drain_constant(0) , num_blows(0) , swarm_min(0) , swarm_max(0) , plague_type() { if(!u_type || !opp_type) { return; } // Get the current state of the unit. if(u_type->hitpoints() < 0) { hp = 0; } else { hp = u_type->hitpoints(); } max_experience = u_type->experience_needed(); level = (u_type->level()); max_hp = (u_type->hitpoints()); // Exit if no weapon. if(!weapon) { return; } // Get the weapon characteristics as appropriate. auto ctx = weapon->specials_context(*u_type, map_location::null_location(), attacking); boost::optional<decltype(ctx)> opp_ctx; if(opp_weapon) { opp_ctx.emplace(opp_weapon->specials_context(*opp_type, map_location::null_location(), !attacking)); } slows = weapon->get_special_bool("slow"); drains = !opp_type->musthave_status("undrainable") && weapon->get_special_bool("drains"); petrifies = weapon->get_special_bool("petrifies"); poisons = !opp_type->musthave_status("unpoisonable") && weapon->get_special_bool("poison"); rounds = weapon->get_specials("berserk").highest("value", 1).first; firststrike = weapon->get_special_bool("firststrike"); disable = weapon->get_special_bool("disable"); unit_ability_list plague_specials = weapon->get_specials("plague"); plagues = !opp_type->musthave_status("unplagueable") && !plague_specials.empty() && opp_type->undead_variation() != "null"; if(plagues) { plague_type = (*plague_specials.front().first)["type"].str(); if(plague_type.empty()) { plague_type = u_type->base_id(); } } signed int cth = 100 - opp_terrain_defense + weapon->accuracy() - (opp_weapon ? opp_weapon->parry() : 0); cth = utils::clamp(cth, 0, 100); unit_ability_list cth_specials = weapon->get_specials("chance_to_hit"); unit_abilities::effect cth_effects(cth_specials, cth, backstab_pos); cth = cth_effects.get_composite_value(); chance_to_hit = utils::clamp(cth, 0, 100); int base_damage = weapon->modified_damage(backstab_pos); int damage_multiplier = 100; damage_multiplier += generic_combat_modifier(lawful_bonus, u_type->alignment(), u_type->musthave_status("fearless"), 0); damage_multiplier *= opp_type->resistance_against(weapon->type(), !attacking); damage = round_damage(base_damage, damage_multiplier, 10000); slow_damage = round_damage(base_damage, damage_multiplier, 20000); if(drains) { unit_ability_list drain_specials = weapon->get_specials("drains"); // Compute the drain percent (with 50% as the base for backward compatibility) unit_abilities::effect drain_percent_effects(drain_specials, 50, backstab_pos); drain_percent = drain_percent_effects.get_composite_value(); } // Add heal_on_hit (the drain constant) unit_ability_list heal_on_hit_specials = weapon->get_specials("heal_on_hit"); unit_abilities::effect heal_on_hit_effects(heal_on_hit_specials, 0, backstab_pos); drain_constant += heal_on_hit_effects.get_composite_value(); drains = drain_constant || drain_percent; // Compute the number of blows and handle swarm. weapon->modified_attacks(backstab_pos, swarm_min, swarm_max); swarm = swarm_min != swarm_max; num_blows = calc_blows(hp); } // ================================================================================== // BATTLE CONTEXT // ================================================================================== battle_context::battle_context( const unit& attacker, const map_location& a_loc, int a_wep_index, const unit& defender, const map_location& d_loc, int d_wep_index, const unit_map& units) : attacker_stats_() , defender_stats_() , attacker_combatant_() , defender_combatant_() { size_t a_wep_uindex = static_cast<size_t>(a_wep_index); size_t d_wep_uindex = static_cast<size_t>(d_wep_index); const_attack_ptr a_wep(a_wep_uindex < attacker.attacks().size() ? attacker.attacks()[a_wep_index].shared_from_this() : nullptr); const_attack_ptr d_wep(d_wep_uindex < defender.attacks().size() ? defender.attacks()[d_wep_index].shared_from_this() : nullptr); attacker_stats_.reset(new battle_context_unit_stats(attacker, a_loc, a_wep_index, true , defender, d_loc, d_wep, units)); defender_stats_.reset(new battle_context_unit_stats(defender, d_loc, d_wep_index, false, attacker, a_loc, a_wep, units)); } void battle_context::simulate(const combatant* prev_def) { assert((attacker_combatant_.get() != nullptr) == (defender_combatant_.get() != nullptr)); assert(attacker_stats_); assert(defender_stats_); if(!attacker_combatant_) { attacker_combatant_.reset(new combatant(*attacker_stats_)); defender_combatant_.reset(new combatant(*defender_stats_, prev_def)); attacker_combatant_->fight(*defender_combatant_); } } // more like a factory method than a constructor, always calls one of the other constructors. battle_context::battle_context(const unit_map& units, const map_location& attacker_loc, const map_location& defender_loc, int attacker_weapon, int defender_weapon, double aggression, const combatant* prev_def, const unit* attacker_ptr, const unit* defender_ptr) : attacker_stats_(nullptr) , defender_stats_(nullptr) , attacker_combatant_(nullptr) , defender_combatant_(nullptr) { //TODO: maybe check before dereferencing units.find(attacker_loc),units.find(defender_loc) ? const unit& attacker = attacker_ptr ? *attacker_ptr : *units.find(attacker_loc); const unit& defender = defender_ptr ? *defender_ptr : *units.find(defender_loc); const double harm_weight = 1.0 - aggression; if(attacker_weapon == -1) { *this = choose_attacker_weapon( attacker, defender, units, attacker_loc, defender_loc, harm_weight, prev_def ); } else if(defender_weapon == -1) { *this = choose_defender_weapon( attacker, defender, attacker_weapon, units, attacker_loc, defender_loc, prev_def ); } else { *this = battle_context(attacker, attacker_loc, attacker_weapon, defender, defender_loc, defender_weapon, units); } assert(attacker_stats_); assert(defender_stats_); } battle_context::battle_context(const battle_context_unit_stats& att, const battle_context_unit_stats& def) : attacker_stats_(new battle_context_unit_stats(att)) , defender_stats_(new battle_context_unit_stats(def)) , attacker_combatant_(nullptr) , defender_combatant_(nullptr) { } /** @todo FIXME: better to initialize combatant initially (move into battle_context_unit_stats?), just do fight() when required. */ const combatant& battle_context::get_attacker_combatant(const combatant* prev_def) { // We calculate this lazily, since AI doesn't always need it. simulate(prev_def); return *attacker_combatant_; } const combatant& battle_context::get_defender_combatant(const combatant* prev_def) { // We calculate this lazily, since AI doesn't always need it. simulate(prev_def); return *defender_combatant_; } // Given this harm_weight, are we better than that other context? bool battle_context::better_attack(class battle_context& that, double harm_weight) { return better_combat( get_attacker_combatant(), get_defender_combatant(), that.get_attacker_combatant(), that.get_defender_combatant(), harm_weight ); } // Given this harm_weight, are we better than that other context? bool battle_context::better_defense(class battle_context& that, double harm_weight) { return better_combat( get_defender_combatant(), get_attacker_combatant(), that.get_defender_combatant(), that.get_attacker_combatant(), harm_weight ); } // Does combat A give us a better result than combat B? bool battle_context::better_combat(const combatant& us_a, const combatant& them_a, const combatant& us_b, const combatant& them_b, double harm_weight) { double a, b; // Compare: P(we kill them) - P(they kill us). a = them_a.hp_dist[0] - us_a.hp_dist[0] * harm_weight; b = them_b.hp_dist[0] - us_b.hp_dist[0] * harm_weight; if(a - b < -0.01) { return false; } if(a - b > 0.01) { return true; } // Add poison to calculations double poison_a_us = (us_a.poisoned) * game_config::poison_amount; double poison_a_them = (them_a.poisoned) * game_config::poison_amount; double poison_b_us = (us_b.poisoned) * game_config::poison_amount; double poison_b_them = (them_b.poisoned) * game_config::poison_amount; // Compare: damage to them - damage to us (average_hp replaces -damage) a = (us_a.average_hp() - poison_a_us) * harm_weight - (them_a.average_hp() - poison_a_them); b = (us_b.average_hp() - poison_b_us) * harm_weight - (them_b.average_hp() - poison_b_them); if(a - b < -0.01) { return false; } if(a - b > 0.01) { return true; } // All else equal: go for most damage. return them_a.average_hp() < them_b.average_hp(); } battle_context battle_context::choose_attacker_weapon(const unit& attacker, const unit& defender, const unit_map& units, const map_location& attacker_loc, const map_location& defender_loc, double harm_weight, const combatant* prev_def) { log_scope2(log_attack, "choose_attacker_weapon"); std::vector<battle_context> choices; // What options does attacker have? for(size_t i = 0; i < attacker.attacks().size(); ++i) { const attack_type& att = attacker.attacks()[i]; if(att.attack_weight() <= 0) { continue; } battle_context bc = choose_defender_weapon(attacker, defender, i, units, attacker_loc, defender_loc, prev_def); //choose_defender_weapon will always choose the weapon that disabels the attackers weapon if possible. if(bc.attacker_stats_->disable) { continue; } choices.emplace_back(std::move(bc)); } if(choices.empty()) { return battle_context(attacker, attacker_loc, -1, defender, defender_loc, -1, units); } if(choices.size() == 1) { return std::move(choices[0]); } // Multiple options: simulate them, save best. battle_context* best_choice = nullptr; for(auto& choice : choices) { // If choose_defender_weapon didn't simulate, do so now. choice.simulate(prev_def); if(!best_choice || choice.better_attack(*best_choice, harm_weight)) { best_choice = &choice; } } if(best_choice) { return std::move(*best_choice); } else { return battle_context(attacker, attacker_loc, -1, defender, defender_loc, -1, units); } } /** @todo FIXME: Hand previous defender unit in here. */ battle_context battle_context::choose_defender_weapon(const unit& attacker, const unit& defender, unsigned attacker_weapon, const unit_map& units, const map_location& attacker_loc, const map_location& defender_loc, const combatant* prev_def) { log_scope2(log_attack, "choose_defender_weapon"); VALIDATE(attacker_weapon < attacker.attacks().size(), _("An invalid attacker weapon got selected.")); const attack_type& att = attacker.attacks()[attacker_weapon]; auto no_weapon = [&]() { return battle_context(attacker, attacker_loc, attacker_weapon, defender, defender_loc, -1, units); }; std::vector<battle_context> choices; // What options does defender have? for(size_t i = 0; i < defender.attacks().size(); ++i) { const attack_type& def = defender.attacks()[i]; if(def.range() != att.range() || def.defense_weight() <= 0) { //no need to calculate the battle_context here. continue; } battle_context bc(attacker, attacker_loc, attacker_weapon, defender, defender_loc, i, units); if(bc.defender_stats_->disable) { continue; } if(bc.attacker_stats_->disable) { //the defenders attack disables the attakers attack: always choose this one. return bc; } choices.emplace_back(std::move(bc)); } if(choices.empty()) { return no_weapon(); } if(choices.size() == 1) { //only one usable weapon, don't simulate return std::move(choices[0]); } // Multiple options: // First pass : get the best weight and the minimum simple rating for this weight. // simple rating = number of blows * damage per blows (resistance taken in account) * cth * weight // Eligible attacks for defense should have a simple rating greater or equal to this weight. int min_rating = 0; { double max_weight = 0.0; for(const auto& choice : choices) { const attack_type& def = defender.attacks()[choice.defender_stats_->attack_num]; if(def.defense_weight() >= max_weight) { const battle_context_unit_stats& def_stats = *choice.defender_stats_; max_weight = def.defense_weight(); int rating = static_cast<int>( def_stats.num_blows * def_stats.damage * def_stats.chance_to_hit * def.defense_weight()); if(def.defense_weight() > max_weight || rating < min_rating) { min_rating = rating; } } } } battle_context* best_choice = nullptr; // Multiple options: simulate them, save best. for(auto& choice : choices) { const attack_type& def = defender.attacks()[choice.defender_stats_->attack_num]; choice.simulate(prev_def); int simple_rating = static_cast<int>( choice.defender_stats_->num_blows * choice.defender_stats_->damage * choice.defender_stats_->chance_to_hit * def.defense_weight()); //FIXME: make sure there is no mostake in the better_combat call- if(simple_rating >= min_rating && (!best_choice || choice.better_defense(*best_choice, 1.0))) { best_choice = &choice; } } return best_choice ? std::move(*best_choice) : no_weapon(); } // ================================================================================== // HELPERS // ================================================================================== namespace { void refresh_weapon_index(int& weap_index, const std::string& weap_id, attack_itors attacks) { // No attacks to choose from. if(attacks.empty()) { weap_index = -1; return; } // The currently selected attack fits. if(weap_index >= 0 && weap_index < static_cast<int>(attacks.size()) && attacks[weap_index].id() == weap_id) { return; } // Look up the weapon by id. if(!weap_id.empty()) { for(int i = 0; i < static_cast<int>(attacks.size()); ++i) { if(attacks[i].id() == weap_id) { weap_index = i; return; } } } // Lookup has failed. weap_index = -1; return; } /** Helper class for performing an attack. */ class attack { public: attack(const map_location& attacker, const map_location& defender, int attack_with, int defend_with, bool update_display = true); void perform(); private: class attack_end_exception { }; bool perform_hit(bool, statistics::attack_context&); void fire_event(const std::string& n); void refresh_bc(); /** Structure holding unit info used in the attack action. */ struct unit_info { const map_location loc_; int weapon_; unit_map& units_; std::size_t id_; /**< unit.underlying_id() */ std::string weap_id_; int orig_attacks_; int n_attacks_; /**< Number of attacks left. */ int cth_; int damage_; int xp_; unit_info(const map_location& loc, int weapon, unit_map& units); unit& get_unit(); bool valid(); std::string dump(); }; /** * Used in perform_hit to confirm a replay is in sync. * Check OOS_error_ after this method, true if error detected. */ void check_replay_attack_result(bool&, int, int&, config, unit_info&); void unit_killed( unit_info&, unit_info&, const battle_context_unit_stats*&, const battle_context_unit_stats*&, bool); std::unique_ptr<battle_context> bc_; const battle_context_unit_stats* a_stats_; const battle_context_unit_stats* d_stats_; int abs_n_attack_, abs_n_defend_; // update_att_fog_ is not used, other than making some code simpler. bool update_att_fog_, update_def_fog_, update_minimap_; unit_info a_, d_; unit_map& units_; std::ostringstream errbuf_; bool update_display_; bool OOS_error_; bool use_prng_; std::vector<bool> prng_attacker_; std::vector<bool> prng_defender_; }; attack::unit_info::unit_info(const map_location& loc, int weapon, unit_map& units) : loc_(loc) , weapon_(weapon) , units_(units) , id_() , weap_id_() , orig_attacks_(0) , n_attacks_(0) , cth_(0) , damage_(0) , xp_(0) { unit_map::iterator i = units_.find(loc_); if(!i.valid()) { return; } id_ = i->underlying_id(); } unit& attack::unit_info::get_unit() { unit_map::iterator i = units_.find(loc_); assert(i.valid() && i->underlying_id() == id_); return *i; } bool attack::unit_info::valid() { unit_map::iterator i = units_.find(loc_); return i.valid() && i->underlying_id() == id_; } std::string attack::unit_info::dump() { std::stringstream s; s << get_unit().type_id() << " (" << loc_.wml_x() << ',' << loc_.wml_y() << ')'; return s.str(); } attack::attack(const map_location& attacker, const map_location& defender, int attack_with, int defend_with, bool update_display) : bc_(nullptr) , a_stats_(nullptr) , d_stats_(nullptr) , abs_n_attack_(0) , abs_n_defend_(0) , update_att_fog_(false) , update_def_fog_(false) , update_minimap_(false) , a_(attacker, attack_with, resources::gameboard->units()) , d_(defender, defend_with, resources::gameboard->units()) , units_(resources::gameboard->units()) , errbuf_() , update_display_(update_display) , OOS_error_(false) //new experimental prng mode. , use_prng_(preferences::get("use_prng") == "yes" && randomness::generator->is_networked() == false) { if(use_prng_) { std::cerr << "Using experimental PRNG for combat\n"; } } void attack::fire_event(const std::string& n) { LOG_NG << "attack: firing '" << n << "' event\n"; // prepare the event data for weapon filtering config ev_data; config& a_weapon_cfg = ev_data.add_child("first"); config& d_weapon_cfg = ev_data.add_child("second"); // Need these to ensure weapon filters work correctly boost::optional<attack_type::specials_context_t> a_ctx, d_ctx; if(a_stats_->weapon != nullptr && a_.valid()) { if(d_stats_->weapon != nullptr && d_.valid()) { a_ctx.emplace(a_stats_->weapon->specials_context(nullptr, nullptr, a_.loc_, d_.loc_, true, d_stats_->weapon)); } else { a_ctx.emplace(a_stats_->weapon->specials_context(nullptr, a_.loc_, true)); } a_stats_->weapon->write(a_weapon_cfg); } if(d_stats_->weapon != nullptr && d_.valid()) { if(a_stats_->weapon != nullptr && a_.valid()) { d_ctx.emplace(d_stats_->weapon->specials_context(nullptr, nullptr, d_.loc_, a_.loc_, false, a_stats_->weapon)); } else { d_ctx.emplace(d_stats_->weapon->specials_context(nullptr, d_.loc_, false)); } d_stats_->weapon->write(d_weapon_cfg); } if(a_weapon_cfg["name"].empty()) { a_weapon_cfg["name"] = "none"; } if(d_weapon_cfg["name"].empty()) { d_weapon_cfg["name"] = "none"; } if(n == "attack_end") { // We want to fire attack_end event in any case! Even if one of units was removed by WML. resources::game_events->pump().fire(n, a_.loc_, d_.loc_, ev_data); return; } // damage_inflicted is set in these two events. // TODO: should we set this value from unit_info::damage, or continue using the WML variable? if(n == "attacker_hits" || n == "defender_hits") { ev_data["damage_inflicted"] = resources::gamedata->get_variable("damage_inflicted"); } const int defender_side = d_.get_unit().side(); bool wml_aborted; std::tie(std::ignore, wml_aborted) = resources::game_events->pump().fire(n, game_events::entity_location(a_.loc_, a_.id_), game_events::entity_location(d_.loc_, d_.id_), ev_data); // The event could have killed either the attacker or // defender, so we have to make sure they still exist. refresh_bc(); if(wml_aborted || !a_.valid() || !d_.valid() || !resources::gameboard->get_team(a_.get_unit().side()).is_enemy(d_.get_unit().side()) ) { actions::recalculate_fog(defender_side); if(update_display_) { display::get_singleton()->redraw_minimap(); } fire_event("attack_end"); throw attack_end_exception(); } } void attack::refresh_bc() { // Fix index of weapons. if(a_.valid()) { refresh_weapon_index(a_.weapon_, a_.weap_id_, a_.get_unit().attacks()); } if(d_.valid()) { refresh_weapon_index(d_.weapon_, d_.weap_id_, d_.get_unit().attacks()); } if(!a_.valid() || !d_.valid()) { // Fix pointer to weapons. const_cast<battle_context_unit_stats*>(a_stats_)->weapon = a_.valid() && a_.weapon_ >= 0 ? a_.get_unit().attacks()[a_.weapon_].shared_from_this() : nullptr; const_cast<battle_context_unit_stats*>(d_stats_)->weapon = d_.valid() && d_.weapon_ >= 0 ? d_.get_unit().attacks()[d_.weapon_].shared_from_this() : nullptr; return; } bc_.reset(new battle_context(units_, a_.loc_, d_.loc_, a_.weapon_, d_.weapon_)); a_stats_ = &bc_->get_attacker_stats(); d_stats_ = &bc_->get_defender_stats(); a_.cth_ = a_stats_->chance_to_hit; d_.cth_ = d_stats_->chance_to_hit; a_.damage_ = a_stats_->damage; d_.damage_ = d_stats_->damage; } bool attack::perform_hit(bool attacker_turn, statistics::attack_context& stats) { unit_info& attacker = attacker_turn ? a_ : d_; unit_info& defender = attacker_turn ? d_ : a_; // NOTE: we need to use a reference-to-pointer here so a_stats_ and d_stats_ can be // modified without. Using a pointer directly would render them invalid when that happened. const battle_context_unit_stats*& attacker_stats = attacker_turn ? a_stats_ : d_stats_; const battle_context_unit_stats*& defender_stats = attacker_turn ? d_stats_ : a_stats_; int& abs_n = attacker_turn ? abs_n_attack_ : abs_n_defend_; bool& update_fog = attacker_turn ? update_def_fog_ : update_att_fog_; int ran_num; if(use_prng_) { std::vector<bool>& prng_seq = attacker_turn ? prng_attacker_ : prng_defender_; if(prng_seq.empty()) { const int ntotal = attacker.cth_*attacker.n_attacks_; int num_hits = ntotal/100; const int additional_hit_chance = ntotal%100; if(additional_hit_chance > 0 && randomness::generator->get_random_int(0, 99) < additional_hit_chance) { ++num_hits; } std::vector<int> indexes; for(int i = 0; i != attacker.n_attacks_; ++i) { prng_seq.push_back(false); indexes.push_back(i); } for(int i = 0; i != num_hits; ++i) { int n = randomness::generator->get_random_int(0, static_cast<int>(indexes.size())-1); prng_seq[indexes[n]] = true; indexes.erase(indexes.begin() + n); } } bool does_hit = prng_seq.back(); prng_seq.pop_back(); ran_num = does_hit ? 0 : 99; } else { ran_num = randomness::generator->get_random_int(0, 99); } bool hits = (ran_num < attacker.cth_); int damage = 0; if(hits) { damage = attacker.damage_; resources::gamedata->get_variable("damage_inflicted") = damage; } // Make sure that if we're serializing a game here, // we got the same results as the game did originally. const config local_results {"chance", attacker.cth_, "hits", hits, "damage", damage}; config replay_results; bool equals_replay = checkup_instance->local_checkup(local_results, replay_results); if(!equals_replay) { check_replay_attack_result(hits, ran_num, damage, replay_results, attacker); } // can do no more damage than the defender has hitpoints int damage_done = std::min<int>(defender.get_unit().hitpoints(), attacker.damage_); // expected damage = damage potential * chance to hit (as a percentage) double expected_damage = damage_done * attacker.cth_ * 0.01; if(attacker_turn) { stats.attack_expected_damage(expected_damage, 0); } else { stats.attack_expected_damage(0, expected_damage); } int drains_damage = 0; if(hits && attacker_stats->drains) { drains_damage = damage_done * attacker_stats->drain_percent / 100 + attacker_stats->drain_constant; // don't drain so much that the attacker gets more than his maximum hitpoints drains_damage = std::min<int>(drains_damage, attacker.get_unit().max_hitpoints() - attacker.get_unit().hitpoints()); // if drain is negative, don't allow drain to kill the attacker drains_damage = std::max<int>(drains_damage, 1 - attacker.get_unit().hitpoints()); } if(update_display_) { std::ostringstream float_text; std::vector<std::string> extra_hit_sounds; if(hits) { const unit& defender_unit = defender.get_unit(); if(attacker_stats->poisons && !defender_unit.get_state(unit::STATE_POISONED)) { float_text << (defender_unit.gender() == unit_race::FEMALE ? _("female^poisoned") : _("poisoned")) << '\n'; extra_hit_sounds.push_back(game_config::sounds::status::poisoned); } if(attacker_stats->slows && !defender_unit.get_state(unit::STATE_SLOWED)) { float_text << (defender_unit.gender() == unit_race::FEMALE ? _("female^slowed") : _("slowed")) << '\n'; extra_hit_sounds.push_back(game_config::sounds::status::slowed); } if(attacker_stats->petrifies) { float_text << (defender_unit.gender() == unit_race::FEMALE ? _("female^petrified") : _("petrified")) << '\n'; extra_hit_sounds.push_back(game_config::sounds::status::petrified); } } unit_display::unit_attack( game_display::get_singleton(), *resources::gameboard, attacker.loc_, defender.loc_, damage, *attacker_stats->weapon, defender_stats->weapon, abs_n, float_text.str(), drains_damage, "", &extra_hit_sounds ); } bool dies = defender.get_unit().take_hit(damage); LOG_NG << "defender took " << damage << (dies ? " and died\n" : "\n"); if(attacker_turn) { stats.attack_result(hits ? (dies ? statistics::attack_context::KILLS : statistics::attack_context::HITS) : statistics::attack_context::MISSES, attacker.cth_, damage_done, drains_damage ); } else { stats.defend_result(hits ? (dies ? statistics::attack_context::KILLS : statistics::attack_context::HITS) : statistics::attack_context::MISSES, attacker.cth_, damage_done, drains_damage ); } replay_results.clear(); // There was also a attribute cfg["unit_hit"] which was never used so i deleted. equals_replay = checkup_instance->local_checkup(config{"dies", dies}, replay_results); if(!equals_replay) { bool results_dies = replay_results["dies"].to_bool(); errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << ": the data source says the " << (attacker_turn ? "defender" : "attacker") << ' ' << (results_dies ? "perished" : "survived") << " while in-game calculations show it " << (dies ? "perished" : "survived") << " (over-riding game calculations with data source results)\n"; dies = results_dies; // Set hitpoints to 0 so later checks don't invalidate the death. if(results_dies) { defender.get_unit().set_hitpoints(0); } OOS_error_ = true; } if(hits) { try { fire_event(attacker_turn ? "attacker_hits" : "defender_hits"); } catch(const attack_end_exception&) { refresh_bc(); return false; } } else { try { fire_event(attacker_turn ? "attacker_misses" : "defender_misses"); } catch(const attack_end_exception&) { refresh_bc(); return false; } } refresh_bc(); bool attacker_dies = false; if(drains_damage > 0) { attacker.get_unit().heal(drains_damage); } else if(drains_damage < 0) { attacker_dies = attacker.get_unit().take_hit(-drains_damage); } if(dies) { unit_killed(attacker, defender, attacker_stats, defender_stats, false); update_fog = true; } if(attacker_dies) { unit_killed(defender, attacker, defender_stats, attacker_stats, true); (attacker_turn ? update_att_fog_ : update_def_fog_) = true; } if(dies) { update_minimap_ = true; return false; } if(hits) { unit& defender_unit = defender.get_unit(); if(attacker_stats->poisons && !defender_unit.get_state(unit::STATE_POISONED)) { defender_unit.set_state(unit::STATE_POISONED, true); LOG_NG << "defender poisoned\n"; } if(attacker_stats->slows && !defender_unit.get_state(unit::STATE_SLOWED)) { defender_unit.set_state(unit::STATE_SLOWED, true); update_fog = true; defender.damage_ = defender_stats->slow_damage; LOG_NG << "defender slowed\n"; } // If the defender is petrified, the fight stops immediately if(attacker_stats->petrifies) { defender_unit.set_state(unit::STATE_PETRIFIED, true); update_fog = true; attacker.n_attacks_ = 0; defender.n_attacks_ = -1; // Petrified. resources::game_events->pump().fire("petrified", defender.loc_, attacker.loc_); refresh_bc(); } } // Delay until here so that poison and slow go through if(attacker_dies) { update_minimap_ = true; return false; } --attacker.n_attacks_; return true; } void attack::unit_killed(unit_info& attacker, unit_info& defender, const battle_context_unit_stats*& attacker_stats, const battle_context_unit_stats*& defender_stats, bool drain_killed) { attacker.xp_ = game_config::kill_xp(defender.get_unit().level()); defender.xp_ = 0; display::get_singleton()->invalidate(attacker.loc_); game_events::entity_location death_loc(defender.loc_, defender.id_); game_events::entity_location attacker_loc(attacker.loc_, attacker.id_); std::string undead_variation = defender.get_unit().undead_variation(); fire_event("attack_end"); refresh_bc(); // Get weapon info for last_breath and die events. config dat; config a_weapon_cfg = attacker_stats->weapon && attacker.valid() ? attacker_stats->weapon->to_config() : config(); config d_weapon_cfg = defender_stats->weapon && defender.valid() ? defender_stats->weapon->to_config() : config(); if(a_weapon_cfg["name"].empty()) { a_weapon_cfg["name"] = "none"; } if(d_weapon_cfg["name"].empty()) { d_weapon_cfg["name"] = "none"; } dat.add_child("first", d_weapon_cfg); dat.add_child("second", a_weapon_cfg); resources::game_events->pump().fire("last_breath", death_loc, attacker_loc, dat); refresh_bc(); // WML has invalidated the dying unit, abort. if(!defender.valid() || defender.get_unit().hitpoints() > 0) { return; } if(!attacker.valid()) { unit_display::unit_die( defender.loc_, defender.get_unit(), nullptr, defender_stats->weapon ); } else { unit_display::unit_die( defender.loc_, defender.get_unit(), attacker_stats->weapon, defender_stats->weapon, attacker.loc_, &attacker.get_unit() ); } resources::game_events->pump().fire("die", death_loc, attacker_loc, dat); refresh_bc(); if(!defender.valid() || defender.get_unit().hitpoints() > 0) { // WML has invalidated the dying unit, abort return; } units_.erase(defender.loc_); resources::whiteboard->on_kill_unit(); // Plague units make new units on the target hex. if(attacker.valid() && attacker_stats->plagues && !drain_killed) { LOG_NG << "trying to reanimate " << attacker_stats->plague_type << '\n'; if(const unit_type* reanimator = unit_types.find(attacker_stats->plague_type)) { LOG_NG << "found unit type:" << reanimator->id() << '\n'; unit_ptr newunit = unit::create(*reanimator, attacker.get_unit().side(), true, unit_race::MALE); newunit->set_attacks(0); newunit->set_movement(0, true); newunit->set_facing(map_location::get_opposite_dir(attacker.get_unit().facing())); // Apply variation if(undead_variation != "null") { config mod; config& variation = mod.add_child("effect"); variation["apply_to"] = "variation"; variation["name"] = undead_variation; newunit->add_modification("variation", mod); newunit->heal_fully(); } newunit->set_location(death_loc); units_.insert(newunit); game_events::entity_location reanim_loc(defender.loc_, newunit->underlying_id()); resources::game_events->pump().fire("unit_placed", reanim_loc); preferences::encountered_units().insert(newunit->type_id()); if(update_display_) { display::get_singleton()->invalidate(death_loc); } } } else { LOG_NG << "unit not reanimated\n"; } } void attack::perform() { // Stop the user from issuing any commands while the units are fighting. const events::command_disabler disable_commands; if(!a_.valid() || !d_.valid()) { return; } // no attack weapon => stop here and don't attack if(a_.weapon_ < 0) { a_.get_unit().set_attacks(a_.get_unit().attacks_left() - 1); a_.get_unit().set_movement(-1, true); return; } if(a_.get_unit().attacks_left() <= 0) { LOG_NG << "attack::perform(): not enough ap.\n"; return; } a_.get_unit().set_facing(a_.loc_.get_relative_dir(d_.loc_)); d_.get_unit().set_facing(d_.loc_.get_relative_dir(a_.loc_)); a_.get_unit().set_attacks(a_.get_unit().attacks_left() - 1); VALIDATE(a_.weapon_ < static_cast<int>(a_.get_unit().attacks().size()), _("An invalid attacker weapon got selected.")); a_.get_unit().set_movement(a_.get_unit().movement_left() - a_.get_unit().attacks()[a_.weapon_].movement_used(), true); a_.get_unit().set_state(unit::STATE_NOT_MOVED, false); a_.get_unit().set_resting(false); d_.get_unit().set_resting(false); // If the attacker was invisible, she isn't anymore! a_.get_unit().set_state(unit::STATE_UNCOVERED, true); bc_.reset(new battle_context(units_, a_.loc_, d_.loc_, a_.weapon_, d_.weapon_)); a_stats_ = &bc_->get_attacker_stats(); d_stats_ = &bc_->get_defender_stats(); if(a_stats_->disable) { LOG_NG << "attack::perform(): tried to attack with a disabled attack.\n"; return; } if(a_stats_->weapon) { a_.weap_id_ = a_stats_->weapon->id(); } if(d_stats_->weapon) { d_.weap_id_ = d_stats_->weapon->id(); } try { fire_event("attack"); } catch(const attack_end_exception&) { return; } refresh_bc(); DBG_NG << "getting attack statistics\n"; statistics::attack_context attack_stats( a_.get_unit(), d_.get_unit(), a_stats_->chance_to_hit, d_stats_->chance_to_hit); a_.orig_attacks_ = a_stats_->num_blows; d_.orig_attacks_ = d_stats_->num_blows; a_.n_attacks_ = a_.orig_attacks_; d_.n_attacks_ = d_.orig_attacks_; a_.xp_ = game_config::combat_xp(d_.get_unit().level()); d_.xp_ = game_config::combat_xp(a_.get_unit().level()); bool defender_strikes_first = (d_stats_->firststrike && !a_stats_->firststrike); unsigned int rounds = std::max<unsigned int>(a_stats_->rounds, d_stats_->rounds) - 1; const int defender_side = d_.get_unit().side(); LOG_NG << "Fight: (" << a_.loc_ << ") vs (" << d_.loc_ << ") ATT: " << a_stats_->weapon->name() << " " << a_stats_->damage << "-" << a_stats_->num_blows << "(" << a_stats_->chance_to_hit << "%) vs DEF: " << (d_stats_->weapon ? d_stats_->weapon->name() : "none") << " " << d_stats_->damage << "-" << d_stats_->num_blows << "(" << d_stats_->chance_to_hit << "%)" << (defender_strikes_first ? " defender first-strike" : "") << "\n"; // Play the pre-fight animation unit_display::unit_draw_weapon(a_.loc_, a_.get_unit(), a_stats_->weapon, d_stats_->weapon, d_.loc_, &d_.get_unit()); for(;;) { DBG_NG << "start of attack loop...\n"; ++abs_n_attack_; if(a_.n_attacks_ > 0 && !defender_strikes_first) { if(!perform_hit(true, attack_stats)) { DBG_NG << "broke from attack loop on attacker turn\n"; break; } } // If the defender got to strike first, they use it up here. defender_strikes_first = false; ++abs_n_defend_; if(d_.n_attacks_ > 0) { if(!perform_hit(false, attack_stats)) { DBG_NG << "broke from attack loop on defender turn\n"; break; } } // Continue the fight to death; if one of the units got petrified, // either n_attacks or n_defends is -1 if(rounds > 0 && d_.n_attacks_ == 0 && a_.n_attacks_ == 0) { a_.n_attacks_ = a_.orig_attacks_; d_.n_attacks_ = d_.orig_attacks_; --rounds; defender_strikes_first = (d_stats_->firststrike && !a_stats_->firststrike); } if(a_.n_attacks_ <= 0 && d_.n_attacks_ <= 0) { fire_event("attack_end"); refresh_bc(); break; } } // Set by attacker_hits and defender_hits events. resources::gamedata->clear_variable("damage_inflicted"); if(update_def_fog_) { actions::recalculate_fog(defender_side); } // TODO: if we knew the viewing team, we could skip this display update if(update_minimap_ && update_display_) { display::get_singleton()->redraw_minimap(); } if(a_.valid()) { unit& u = a_.get_unit(); u.anim_comp().set_standing(); u.set_experience(u.experience() + a_.xp_); } if(d_.valid()) { unit& u = d_.get_unit(); u.anim_comp().set_standing(); u.set_experience(u.experience() + d_.xp_); } unit_display::unit_sheath_weapon(a_.loc_, a_.valid() ? &a_.get_unit() : nullptr, a_stats_->weapon, d_stats_->weapon, d_.loc_, d_.valid() ? &d_.get_unit() : nullptr); if(update_display_) { game_display::get_singleton()->invalidate_unit(); display::get_singleton()->invalidate(a_.loc_); display::get_singleton()->invalidate(d_.loc_); } if(OOS_error_) { replay::process_error(errbuf_.str()); } } void attack::check_replay_attack_result( bool& hits, int ran_num, int& damage, config replay_results, unit_info& attacker) { int results_chance = replay_results["chance"]; bool results_hits = replay_results["hits"].to_bool(); int results_damage = replay_results["damage"]; #if 0 errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << " replay data differs from local calculated data:" << " chance to hit in data source: " << results_chance << " chance to hit in calculated: " << attacker.cth_ << " chance to hit in data source: " << results_chance << " chance to hit in calculated: " << attacker.cth_ ; attacker.cth_ = results_chance; hits = results_hits; damage = results_damage; OOS_error_ = true; #endif if(results_chance != attacker.cth_) { errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << ": chance to hit is inconsistent. Data source: " << results_chance << "; Calculation: " << attacker.cth_ << " (over-riding game calculations with data source results)\n"; attacker.cth_ = results_chance; OOS_error_ = true; } if(results_hits != hits) { errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << ": the data source says the hit was " << (results_hits ? "successful" : "unsuccessful") << ", while in-game calculations say the hit was " << (hits ? "successful" : "unsuccessful") << " random number: " << ran_num << " = " << (ran_num % 100) << "/" << results_chance << " (over-riding game calculations with data source results)\n"; hits = results_hits; OOS_error_ = true; } if(results_damage != damage) { errbuf_ << "SYNC: In attack " << a_.dump() << " vs " << d_.dump() << ": the data source says the hit did " << results_damage << " damage, while in-game calculations show the hit doing " << damage << " damage (over-riding game calculations with data source results)\n"; damage = results_damage; OOS_error_ = true; } } } // end anonymous namespace // ================================================================================== // FREE-STANDING FUNCTIONS // ================================================================================== void attack_unit(const map_location& attacker, const map_location& defender, int attack_with, int defend_with, bool update_display) { attack dummy(attacker, defender, attack_with, defend_with, update_display); dummy.perform(); } void attack_unit_and_advance(const map_location& attacker, const map_location& defender, int attack_with, int defend_with, bool update_display, const ai::unit_advancements_aspect& ai_advancement) { attack_unit(attacker, defender, attack_with, defend_with, update_display); unit_map::const_iterator atku = resources::gameboard->units().find(attacker); if(atku != resources::gameboard->units().end()) { advance_unit_at(advance_unit_params(attacker).ai_advancements(ai_advancement)); } unit_map::const_iterator defu = resources::gameboard->units().find(defender); if(defu != resources::gameboard->units().end()) { advance_unit_at(advance_unit_params(defender).ai_advancements(ai_advancement)); } } int under_leadership(const unit &u, const map_location& loc, const_attack_ptr weapon, const_attack_ptr opp_weapon) { unit_ability_list abil = u.get_abilities("leadership", loc, weapon, opp_weapon); unit_abilities::effect leader_effect(abil, 0, false); return leader_effect.get_composite_value(); } //begin of weapon emulates function. bool unit::abilities_filter_matches(const config& cfg, bool attacker, int res) const { if(!(cfg["active_on"].empty() || (attacker && cfg["active_on"] == "offense") || (!attacker && cfg["active_on"] == "defense"))) { return false; } if(!unit_abilities::filter_base_matches(cfg, res)) { return false; } return true; } //functions for emulate weapon specials. //filter opponent and affect self/opponent/both option. bool unit::ability_filter_fighter(const std::string& ability, const std::string& filter_attacker , const config& cfg, const map_location& loc, const unit& u2) const { const config &filter = cfg.child(filter_attacker); if(!filter) { return true; } return unit_filter(vconfig(filter)).set_use_flat_tod(ability == "illuminates").matches(*this, loc, u2); } static bool ability_apply_filter(const unit_map::const_iterator un, const unit_map::const_iterator up, const std::string& ability, const config& cfg, const map_location& loc, const map_location& opp_loc, bool attacker ) { if(!up->ability_filter_fighter(ability, "filter_opponent", cfg, opp_loc, *un)){ return true; } if(!un->ability_filter_fighter(ability, "filter_student", cfg, loc, *up)){ return true; } if((attacker && !un->ability_filter_fighter(ability, "filter_attacker", cfg, loc, *up)) || (!attacker && !up->ability_filter_fighter(ability, "filter_attacker", cfg, opp_loc, *un))){ return true; } if((!attacker && !un->ability_filter_fighter(ability, "filter_defender", cfg, loc, *up)) || (attacker && !up->ability_filter_fighter(ability, "filter_defender", cfg, opp_loc, *un))){ return true; } return false; } bool leadership_affects_self(const std::string& ability,const unit_map& units, const map_location& loc, bool attacker, const_attack_ptr weapon,const_attack_ptr opp_weapon) { const unit_map::const_iterator un = units.find(loc); if(un == units.end()) { return false; } unit_ability_list abil = un->get_abilities(ability, weapon, opp_weapon); for(unit_ability_list::iterator i = abil.begin(); i != abil.end();) { const std::string& apply_to = (*i->first)["apply_to"]; if(apply_to.empty() || apply_to == "both" || apply_to == "self") { return true; } if(attacker && apply_to == "attacker") { return true; } if(!attacker && apply_to == "defender") { return true; } ++i; } return false; } bool leadership_affects_opponent(const std::string& ability,const unit_map& units, const map_location& loc, bool attacker, const_attack_ptr weapon,const_attack_ptr opp_weapon) { const unit_map::const_iterator un = units.find(loc); if(un == units.end()) { return false; } unit_ability_list abil = un->get_abilities(ability, weapon, opp_weapon); for(unit_ability_list::iterator i = abil.begin(); i != abil.end();) { const std::string& apply_to = (*i->first)["apply_to"]; if(apply_to == "both" || apply_to == "opponent") { return true; } if(attacker && apply_to == "defender") { return true; } if(!attacker && apply_to == "attacker") { return true; } ++i; } return false; } //sub function for emulate chance_to_hit,damage drains and attacks special. std::pair<int, bool> ability_leadership(const std::string& ability,const unit_map& units, const map_location& loc, const map_location& opp_loc, bool attacker, int abil_value, bool backstab_pos, const_attack_ptr weapon, const_attack_ptr opp_weapon) { const unit_map::const_iterator un = units.find(loc); const unit_map::const_iterator up = units.find(opp_loc); if(un == units.end()) { return {abil_value, false}; } unit_ability_list abil = un->get_abilities(ability, weapon, opp_weapon); for(unit_ability_list::iterator i = abil.begin(); i != abil.end();) { const config &filter = (*i->first).child("filter_opponent"); const config &filter_student = (*i->first).child("filter_student"); const config &filter_attacker = (*i->first).child("filter_attacker"); const config &filter_defender = (*i->first).child("filter_defender"); bool show_result = false; if(up == units.end() && !filter_student && !filter && !filter_attacker && !filter_defender) { show_result = un->abilities_filter_matches(*i->first, attacker, abil_value); } else if(up == units.end() && (filter_student || filter || filter_attacker || filter_defender)) { return {abil_value, false}; } else { show_result = !(!un->abilities_filter_matches(*i->first, attacker, abil_value) || ability_apply_filter(un, up, ability, *i->first, loc, opp_loc, attacker)); } if(!show_result) { i = abil.erase(i); } else { ++i; } } if(!abil.empty()) { unit_abilities::effect leader_effect(abil, abil_value, backstab_pos); return {leader_effect.get_composite_value(), true}; } return {abil_value, false}; } //sub function for wmulate boolean special(slow, poison...) bool bool_leadership(const std::string& ability,const unit_map& units, const map_location& loc, const map_location& opp_loc, bool attacker, const_attack_ptr weapon, const_attack_ptr opp_weapon) { const unit_map::const_iterator un = units.find(loc); const unit_map::const_iterator up = units.find(opp_loc); if(un == units.end() || up == units.end()) { return false; } unit_ability_list abil = un->get_abilities(ability, weapon, opp_weapon); for(unit_ability_list::iterator i = abil.begin(); i != abil.end();) { const std::string& active_on = (*i->first)["active_on"]; if(!(active_on.empty() || (attacker && active_on == "offense") || (!attacker && active_on == "defense")) || ability_apply_filter(un, up, ability, *i->first, loc, opp_loc, attacker)) { i = abil.erase(i); } else { ++i; } } if(!abil.empty()) { return true; } return false; } //emulate boolean special for self/adjacent and/or opponent. bool attack_type::bool_ability(const std::string& ability) const { bool abil_bool= get_special_bool(ability); const unit_map& units = display::get_singleton()->get_units(); if(leadership_affects_self(ability, units, self_loc_, is_attacker_, shared_from_this(), other_attack_)) { abil_bool = get_special_bool(ability) || bool_leadership(ability, units, self_loc_, other_loc_, is_attacker_, shared_from_this(), other_attack_); } if(leadership_affects_opponent(ability, units, other_loc_, !is_attacker_, other_attack_, shared_from_this())) { abil_bool = get_special_bool(ability) || bool_leadership(ability, units, other_loc_, self_loc_, !is_attacker_, other_attack_, shared_from_this()); } return abil_bool; } //emulate numerical special for self/adjacent and/or opponent. std::pair<int, bool> attack_type::combat_ability(const std::string& ability, int abil_value, bool backstab_pos) const { const unit_map& units = display::get_singleton()->get_units(); if(leadership_affects_self(ability, units, self_loc_, is_attacker_, shared_from_this(), other_attack_)) { return ability_leadership(ability, units, self_loc_, other_loc_, is_attacker_, abil_value, backstab_pos, shared_from_this(), other_attack_); } if(leadership_affects_opponent(ability, units, other_loc_, !is_attacker_, other_attack_, shared_from_this())) { return ability_leadership(ability, units, other_loc_,self_loc_, !is_attacker_, abil_value, backstab_pos, other_attack_, shared_from_this()); } return {abil_value, false}; } //end of emulate weapon special functions. int combat_modifier(const unit_map& units, const gamemap& map, const map_location& loc, unit_type::ALIGNMENT alignment, bool is_fearless) { const tod_manager& tod_m = *resources::tod_manager; const time_of_day& effective_tod = tod_m.get_illuminated_time_of_day(units, map, loc); return combat_modifier(effective_tod, alignment, is_fearless); } int combat_modifier(const time_of_day& effective_tod, unit_type::ALIGNMENT alignment, bool is_fearless) { const tod_manager& tod_m = *resources::tod_manager; const int lawful_bonus = effective_tod.lawful_bonus; return generic_combat_modifier(lawful_bonus, alignment, is_fearless, tod_m.get_max_liminal_bonus()); } int generic_combat_modifier(int lawful_bonus, unit_type::ALIGNMENT alignment, bool is_fearless, int max_liminal_bonus) { int bonus; switch(alignment.v) { case unit_type::ALIGNMENT::LAWFUL: bonus = lawful_bonus; break; case unit_type::ALIGNMENT::NEUTRAL: bonus = 0; break; case unit_type::ALIGNMENT::CHAOTIC: bonus = -lawful_bonus; break; case unit_type::ALIGNMENT::LIMINAL: bonus = std::max(0, max_liminal_bonus-std::abs(lawful_bonus)); break; default: bonus = 0; } if(is_fearless) { bonus = std::max<int>(bonus, 0); } return bonus; } bool backstab_check(const map_location& attacker_loc, const map_location& defender_loc, const unit_map& units, const std::vector<team>& teams) { const unit_map::const_iterator defender = units.find(defender_loc); if(defender == units.end()) { return false; // No defender } adjacent_loc_array_t adj; get_adjacent_tiles(defender_loc, adj.data()); unsigned i; for(i = 0; i < adj.size(); ++i) { if(adj[i] == attacker_loc) { break; } } if(i >= 6) { return false; // Attack not from adjacent location } const unit_map::const_iterator opp = units.find(adj[(i + 3) % 6]); // No opposite unit. if(opp == units.end()) { return false; } if(opp->incapacitated()) { return false; } // If sides aren't valid teams, then they are enemies. if(std::size_t(defender->side() - 1) >= teams.size() || std::size_t(opp->side() - 1) >= teams.size()) { return true; } // Defender and opposite are enemies. if(teams[defender->side() - 1].is_enemy(opp->side())) { return true; } // Defender and opposite are friends. return false; }
Java
#!/usr/bin/env python2 import copy import Queue import os import socket import struct import subprocess import sys import threading import time import unittest import dns import dns.message import libnacl import libnacl.utils class DNSDistTest(unittest.TestCase): """ Set up a dnsdist instance and responder threads. Queries sent to dnsdist are relayed to the responder threads, who reply with the response provided by the tests themselves on a queue. Responder threads also queue the queries received from dnsdist on a separate queue, allowing the tests to check that the queries sent from dnsdist were as expected. """ _dnsDistPort = 5340 _dnsDistListeningAddr = "127.0.0.1" _testServerPort = 5350 _toResponderQueue = Queue.Queue() _fromResponderQueue = Queue.Queue() _queueTimeout = 1 _dnsdistStartupDelay = 2.0 _dnsdist = None _responsesCounter = {} _shutUp = True _config_template = """ """ _config_params = ['_testServerPort'] _acl = ['127.0.0.1/32'] _consolePort = 5199 _consoleKey = None @classmethod def startResponders(cls): print("Launching responders..") cls._UDPResponder = threading.Thread(name='UDP Responder', target=cls.UDPResponder, args=[cls._testServerPort]) cls._UDPResponder.setDaemon(True) cls._UDPResponder.start() cls._TCPResponder = threading.Thread(name='TCP Responder', target=cls.TCPResponder, args=[cls._testServerPort]) cls._TCPResponder.setDaemon(True) cls._TCPResponder.start() @classmethod def startDNSDist(cls, shutUp=True): print("Launching dnsdist..") conffile = 'dnsdist_test.conf' params = tuple([getattr(cls, param) for param in cls._config_params]) print(params) with open(conffile, 'w') as conf: conf.write("-- Autogenerated by dnsdisttests.py\n") conf.write(cls._config_template % params) dnsdistcmd = [os.environ['DNSDISTBIN'], '-C', conffile, '-l', '%s:%d' % (cls._dnsDistListeningAddr, cls._dnsDistPort) ] for acl in cls._acl: dnsdistcmd.extend(['--acl', acl]) print(' '.join(dnsdistcmd)) if shutUp: with open(os.devnull, 'w') as fdDevNull: cls._dnsdist = subprocess.Popen(dnsdistcmd, close_fds=True, stdout=fdDevNull) else: cls._dnsdist = subprocess.Popen(dnsdistcmd, close_fds=True) if 'DNSDIST_FAST_TESTS' in os.environ: delay = 0.5 else: delay = cls._dnsdistStartupDelay time.sleep(delay) if cls._dnsdist.poll() is not None: cls._dnsdist.kill() sys.exit(cls._dnsdist.returncode) @classmethod def setUpSockets(cls): print("Setting up UDP socket..") cls._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) cls._sock.settimeout(2.0) cls._sock.connect(("127.0.0.1", cls._dnsDistPort)) @classmethod def setUpClass(cls): cls.startResponders() cls.startDNSDist(cls._shutUp) cls.setUpSockets() print("Launching tests..") @classmethod def tearDownClass(cls): if 'DNSDIST_FAST_TESTS' in os.environ: delay = 0.1 else: delay = 1.0 if cls._dnsdist: cls._dnsdist.terminate() if cls._dnsdist.poll() is None: time.sleep(delay) if cls._dnsdist.poll() is None: cls._dnsdist.kill() cls._dnsdist.wait() @classmethod def _ResponderIncrementCounter(cls): if threading.currentThread().name in cls._responsesCounter: cls._responsesCounter[threading.currentThread().name] += 1 else: cls._responsesCounter[threading.currentThread().name] = 1 @classmethod def _getResponse(cls, request): response = None if len(request.question) != 1: print("Skipping query with question count %d" % (len(request.question))) return None healthcheck = not str(request.question[0].name).endswith('tests.powerdns.com.') if not healthcheck: cls._ResponderIncrementCounter() if not cls._toResponderQueue.empty(): response = cls._toResponderQueue.get(True, cls._queueTimeout) if response: response = copy.copy(response) response.id = request.id cls._fromResponderQueue.put(request, True, cls._queueTimeout) if not response: # unexpected query, or health check response = dns.message.make_response(request) return response @classmethod def UDPResponder(cls, port, ignoreTrailing=False): sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) sock.bind(("127.0.0.1", port)) while True: data, addr = sock.recvfrom(4096) request = dns.message.from_wire(data, ignore_trailing=ignoreTrailing) response = cls._getResponse(request) if not response: continue sock.settimeout(2.0) sock.sendto(response.to_wire(), addr) sock.settimeout(None) sock.close() @classmethod def TCPResponder(cls, port, ignoreTrailing=False, multipleResponses=False): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) try: sock.bind(("127.0.0.1", port)) except socket.error as e: print("Error binding in the TCP responder: %s" % str(e)) sys.exit(1) sock.listen(100) while True: (conn, _) = sock.accept() conn.settimeout(2.0) data = conn.recv(2) (datalen,) = struct.unpack("!H", data) data = conn.recv(datalen) request = dns.message.from_wire(data, ignore_trailing=ignoreTrailing) response = cls._getResponse(request) if not response: conn.close() continue wire = response.to_wire() conn.send(struct.pack("!H", len(wire))) conn.send(wire) while multipleResponses: if cls._toResponderQueue.empty(): break response = cls._toResponderQueue.get(True, cls._queueTimeout) if not response: break response = copy.copy(response) response.id = request.id wire = response.to_wire() try: conn.send(struct.pack("!H", len(wire))) conn.send(wire) except socket.error as e: # some of the tests are going to close # the connection on us, just deal with it break conn.close() sock.close() @classmethod def sendUDPQuery(cls, query, response, useQueue=True, timeout=2.0, rawQuery=False): if useQueue: cls._toResponderQueue.put(response, True, timeout) if timeout: cls._sock.settimeout(timeout) try: if not rawQuery: query = query.to_wire() cls._sock.send(query) data = cls._sock.recv(4096) except socket.timeout: data = None finally: if timeout: cls._sock.settimeout(None) receivedQuery = None message = None if useQueue and not cls._fromResponderQueue.empty(): receivedQuery = cls._fromResponderQueue.get(True, timeout) if data: message = dns.message.from_wire(data) return (receivedQuery, message) @classmethod def openTCPConnection(cls, timeout=None): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if timeout: sock.settimeout(timeout) sock.connect(("127.0.0.1", cls._dnsDistPort)) return sock @classmethod def sendTCPQueryOverConnection(cls, sock, query, rawQuery=False): if not rawQuery: wire = query.to_wire() else: wire = query sock.send(struct.pack("!H", len(wire))) sock.send(wire) @classmethod def recvTCPResponseOverConnection(cls, sock): message = None data = sock.recv(2) if data: (datalen,) = struct.unpack("!H", data) data = sock.recv(datalen) if data: message = dns.message.from_wire(data) return message @classmethod def sendTCPQuery(cls, query, response, useQueue=True, timeout=2.0, rawQuery=False): message = None if useQueue: cls._toResponderQueue.put(response, True, timeout) sock = cls.openTCPConnection(timeout) try: cls.sendTCPQueryOverConnection(sock, query, rawQuery) message = cls.recvTCPResponseOverConnection(sock) except socket.timeout as e: print("Timeout: %s" % (str(e))) except socket.error as e: print("Network error: %s" % (str(e))) finally: sock.close() receivedQuery = None if useQueue and not cls._fromResponderQueue.empty(): receivedQuery = cls._fromResponderQueue.get(True, timeout) return (receivedQuery, message) @classmethod def sendTCPQueryWithMultipleResponses(cls, query, responses, useQueue=True, timeout=2.0, rawQuery=False): if useQueue: for response in responses: cls._toResponderQueue.put(response, True, timeout) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if timeout: sock.settimeout(timeout) sock.connect(("127.0.0.1", cls._dnsDistPort)) messages = [] try: if not rawQuery: wire = query.to_wire() else: wire = query sock.send(struct.pack("!H", len(wire))) sock.send(wire) while True: data = sock.recv(2) if not data: break (datalen,) = struct.unpack("!H", data) data = sock.recv(datalen) messages.append(dns.message.from_wire(data)) except socket.timeout as e: print("Timeout: %s" % (str(e))) except socket.error as e: print("Network error: %s" % (str(e))) finally: sock.close() receivedQuery = None if useQueue and not cls._fromResponderQueue.empty(): receivedQuery = cls._fromResponderQueue.get(True, timeout) return (receivedQuery, messages) def setUp(self): # This function is called before every tests # Clear the responses counters for key in self._responsesCounter: self._responsesCounter[key] = 0 # Make sure the queues are empty, in case # a previous test failed while not self._toResponderQueue.empty(): self._toResponderQueue.get(False) while not self._fromResponderQueue.empty(): self._fromResponderQueue.get(False) @classmethod def clearToResponderQueue(cls): while not cls._toResponderQueue.empty(): cls._toResponderQueue.get(False) @classmethod def clearFromResponderQueue(cls): while not cls._fromResponderQueue.empty(): cls._fromResponderQueue.get(False) @classmethod def clearResponderQueues(cls): cls.clearToResponderQueue() cls.clearFromResponderQueue() @staticmethod def generateConsoleKey(): return libnacl.utils.salsa_key() @classmethod def _encryptConsole(cls, command, nonce): if cls._consoleKey is None: return command return libnacl.crypto_secretbox(command, nonce, cls._consoleKey) @classmethod def _decryptConsole(cls, command, nonce): if cls._consoleKey is None: return command return libnacl.crypto_secretbox_open(command, nonce, cls._consoleKey) @classmethod def sendConsoleCommand(cls, command, timeout=1.0): ourNonce = libnacl.utils.rand_nonce() theirNonce = None sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if timeout: sock.settimeout(timeout) sock.connect(("127.0.0.1", cls._consolePort)) sock.send(ourNonce) theirNonce = sock.recv(len(ourNonce)) halfNonceSize = len(ourNonce) / 2 readingNonce = ourNonce[0:halfNonceSize] + theirNonce[halfNonceSize:] writingNonce = theirNonce[0:halfNonceSize] + ourNonce[halfNonceSize:] msg = cls._encryptConsole(command, writingNonce) sock.send(struct.pack("!I", len(msg))) sock.send(msg) data = sock.recv(4) (responseLen,) = struct.unpack("!I", data) data = sock.recv(responseLen) response = cls._decryptConsole(data, readingNonce) return response
Java
/* * Interface to libmp3lame for mp3 encoding * Copyright (c) 2002 Lennert Buytenhek <buytenh@gnu.org> * * This file is part of FFmpeg. * * FFmpeg 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. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file mp3lameaudio.c * Interface to libmp3lame for mp3 encoding. */ #include "avcodec.h" #include "mpegaudio.h" #include <lame/lame.h> #define BUFFER_SIZE (7200 + MPA_FRAME_SIZE + MPA_FRAME_SIZE/4) typedef struct Mp3AudioContext { lame_global_flags *gfp; int stereo; uint8_t buffer[BUFFER_SIZE]; int buffer_index; } Mp3AudioContext; static av_cold int MP3lame_encode_init(AVCodecContext *avctx) { Mp3AudioContext *s = avctx->priv_data; if (avctx->channels > 2) return -1; s->stereo = avctx->channels > 1 ? 1 : 0; if ((s->gfp = lame_init()) == NULL) goto err; lame_set_in_samplerate(s->gfp, avctx->sample_rate); lame_set_out_samplerate(s->gfp, avctx->sample_rate); lame_set_num_channels(s->gfp, avctx->channels); /* lame 3.91 dies on quality != 5 */ lame_set_quality(s->gfp, 5); /* lame 3.91 doesn't work in mono */ lame_set_mode(s->gfp, JOINT_STEREO); lame_set_brate(s->gfp, avctx->bit_rate/1000); if(avctx->flags & CODEC_FLAG_QSCALE) { lame_set_brate(s->gfp, 0); lame_set_VBR(s->gfp, vbr_default); lame_set_VBR_q(s->gfp, avctx->global_quality / (float)FF_QP2LAMBDA); } lame_set_bWriteVbrTag(s->gfp,0); lame_set_disable_reservoir(s->gfp, avctx->flags2 & CODEC_FLAG2_BIT_RESERVOIR ? 0 : 1); if (lame_init_params(s->gfp) < 0) goto err_close; avctx->frame_size = lame_get_framesize(s->gfp); avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; err_close: lame_close(s->gfp); err: return -1; } static const int sSampleRates[3] = { 44100, 48000, 32000 }; static const int sBitRates[2][3][15] = { { { 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448}, { 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384}, { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320} }, { { 0, 32, 48, 56, 64, 80, 96,112,128,144,160,176,192,224,256}, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160} }, }; static const int sSamplesPerFrame[2][3] = { { 384, 1152, 1152 }, { 384, 1152, 576 } }; static const int sBitsPerSlot[3] = { 32, 8, 8 }; static int mp3len(void *data, int *samplesPerFrame, int *sampleRate) { uint32_t header = AV_RB32(data); int layerID = 3 - ((header >> 17) & 0x03); int bitRateID = ((header >> 12) & 0x0f); int sampleRateID = ((header >> 10) & 0x03); int bitsPerSlot = sBitsPerSlot[layerID]; int isPadded = ((header >> 9) & 0x01); static int const mode_tab[4]= {2,3,1,0}; int mode= mode_tab[(header >> 19) & 0x03]; int mpeg_id= mode>0; int temp0, temp1, bitRate; if ( (( header >> 21 ) & 0x7ff) != 0x7ff || mode == 3 || layerID==3 || sampleRateID==3) { return -1; } if(!samplesPerFrame) samplesPerFrame= &temp0; if(!sampleRate ) sampleRate = &temp1; // *isMono = ((header >> 6) & 0x03) == 0x03; *sampleRate = sSampleRates[sampleRateID]>>mode; bitRate = sBitRates[mpeg_id][layerID][bitRateID] * 1000; *samplesPerFrame = sSamplesPerFrame[mpeg_id][layerID]; //av_log(NULL, AV_LOG_DEBUG, "sr:%d br:%d spf:%d l:%d m:%d\n", *sampleRate, bitRate, *samplesPerFrame, layerID, mode); return *samplesPerFrame * bitRate / (bitsPerSlot * *sampleRate) + isPadded; } static int MP3lame_encode_frame(AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) { Mp3AudioContext *s = avctx->priv_data; int len; int lame_result; /* lame 3.91 dies on '1-channel interleaved' data */ if(data){ if (s->stereo) { lame_result = lame_encode_buffer_interleaved( s->gfp, data, avctx->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } else { lame_result = lame_encode_buffer( s->gfp, data, data, avctx->frame_size, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } }else{ lame_result= lame_encode_flush( s->gfp, s->buffer + s->buffer_index, BUFFER_SIZE - s->buffer_index ); } if(lame_result==-1) { /* output buffer too small */ av_log(avctx, AV_LOG_ERROR, "lame: output buffer too small (buffer index: %d, free bytes: %d)\n", s->buffer_index, BUFFER_SIZE - s->buffer_index); return 0; } s->buffer_index += lame_result; if(s->buffer_index<4) return 0; len= mp3len(s->buffer, NULL, NULL); //av_log(avctx, AV_LOG_DEBUG, "in:%d packet-len:%d index:%d\n", avctx->frame_size, len, s->buffer_index); if(len <= s->buffer_index){ memcpy(frame, s->buffer, len); s->buffer_index -= len; memmove(s->buffer, s->buffer+len, s->buffer_index); //FIXME fix the audio codec API, so we do not need the memcpy() /*for(i=0; i<len; i++){ av_log(avctx, AV_LOG_DEBUG, "%2X ", frame[i]); }*/ return len; }else return 0; } static av_cold int MP3lame_encode_close(AVCodecContext *avctx) { Mp3AudioContext *s = avctx->priv_data; av_freep(&avctx->coded_frame); lame_close(s->gfp); return 0; } AVCodec libmp3lame_encoder = { "libmp3lame", CODEC_TYPE_AUDIO, CODEC_ID_MP3, sizeof(Mp3AudioContext), MP3lame_encode_init, MP3lame_encode_frame, MP3lame_encode_close, .capabilities= CODEC_CAP_DELAY, };
Java
/* * 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.harmony.unpack200.bytecode.forms; import org.apache.harmony.unpack200.SegmentConstantPool; import org.apache.harmony.unpack200.bytecode.ByteCode; import org.apache.harmony.unpack200.bytecode.CPInterfaceMethodRef; import org.apache.harmony.unpack200.bytecode.OperandManager; /** * This class implements the byte code form for those bytecodes which have * IMethod references (and only IMethod references). */ public class IMethodRefForm extends ReferenceForm { public IMethodRefForm(int opcode, String name, int[] rewrite) { super(opcode, name, rewrite); } protected int getOffset(OperandManager operandManager) { return operandManager.nextIMethodRef(); } protected int getPoolID() { return SegmentConstantPool.CP_IMETHOD; } /* * (non-Javadoc) * * @see org.apache.harmony.unpack200.bytecode.forms.ByteCodeForm#setByteCodeOperands(org.apache.harmony.unpack200.bytecode.ByteCode, * org.apache.harmony.unpack200.bytecode.OperandTable, * org.apache.harmony.unpack200.Segment) */ public void setByteCodeOperands(ByteCode byteCode, OperandManager operandManager, int codeLength) { super.setByteCodeOperands(byteCode, operandManager, codeLength); final int count = ((CPInterfaceMethodRef) byteCode .getNestedClassFileEntries()[0]).invokeInterfaceCount(); byteCode.getRewrite()[3] = count; } }
Java
/* * This is the source code of Telegram for Android v. 3.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2016. */ package org.pouyadr.ui; import android.animation.ObjectAnimator; import android.animation.StateListAnimator; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.Typeface; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.text.Html; import android.text.InputType; import android.text.Spannable; import android.text.TextUtils; import android.text.method.LinkMovementMethod; import android.util.Base64; import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; import android.view.ViewTreeObserver; import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import org.pouyadr.PhoneFormat.PhoneFormat; import org.pouyadr.Pouya.Helper.GhostPorotocol; import org.pouyadr.Pouya.Helper.ThemeChanger; import org.pouyadr.Pouya.Setting.Setting; import org.pouyadr.finalsoft.FontActivity; import org.pouyadr.finalsoft.Fonts; import org.pouyadr.messenger.AndroidUtilities; import org.pouyadr.messenger.AnimationCompat.AnimatorListenerAdapterProxy; import org.pouyadr.messenger.AnimationCompat.AnimatorSetProxy; import org.pouyadr.messenger.AnimationCompat.ObjectAnimatorProxy; import org.pouyadr.messenger.AnimationCompat.ViewProxy; import org.pouyadr.messenger.ApplicationLoader; import org.pouyadr.messenger.BuildVars; import org.pouyadr.messenger.FileLoader; import org.pouyadr.messenger.FileLog; import org.pouyadr.messenger.LocaleController; import org.pouyadr.messenger.MediaController; import org.pouyadr.messenger.MessageObject; import org.pouyadr.messenger.MessagesController; import org.pouyadr.messenger.MessagesStorage; import org.pouyadr.messenger.NotificationCenter; import org.pouyadr.messenger.R; import org.pouyadr.messenger.UserConfig; import org.pouyadr.messenger.UserObject; import org.pouyadr.messenger.browser.Browser; import org.pouyadr.tgnet.ConnectionsManager; import org.pouyadr.tgnet.RequestDelegate; import org.pouyadr.tgnet.SerializedData; import org.pouyadr.tgnet.TLObject; import org.pouyadr.tgnet.TLRPC; import org.pouyadr.ui.ActionBar.ActionBar; import org.pouyadr.ui.ActionBar.ActionBarMenu; import org.pouyadr.ui.ActionBar.ActionBarMenuItem; import org.pouyadr.ui.ActionBar.BaseFragment; import org.pouyadr.ui.ActionBar.BottomSheet; import org.pouyadr.ui.ActionBar.Theme; import org.pouyadr.ui.Adapters.BaseFragmentAdapter; import org.pouyadr.ui.Cells.CheckBoxCell; import org.pouyadr.ui.Cells.EmptyCell; import org.pouyadr.ui.Cells.HeaderCell; import org.pouyadr.ui.Cells.ShadowSectionCell; import org.pouyadr.ui.Cells.TextCheckCell; import org.pouyadr.ui.Cells.TextDetailSettingsCell; import org.pouyadr.ui.Cells.TextInfoCell; import org.pouyadr.ui.Cells.TextSettingsCell; import org.pouyadr.ui.Components.AvatarDrawable; import org.pouyadr.ui.Components.AvatarUpdater; import org.pouyadr.ui.Components.BackupImageView; import org.pouyadr.ui.Components.LayoutHelper; import org.pouyadr.ui.Components.NumberPicker; import java.io.File; import java.util.ArrayList; import java.util.Locale; public class SettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, PhotoViewer.PhotoViewerProvider { private ListView listView; private ListAdapter listAdapter; private BackupImageView avatarImage; private TextView nameTextView; private TextView onlineTextView; private ImageView writeButton; private AnimatorSetProxy writeButtonAnimation; private AvatarUpdater avatarUpdater = new AvatarUpdater(); private View extraHeightView; private View shadowView; private int extraHeight; private int overscrollRow; private int emptyRow; private int numberSectionRow; private int newgeramsectionrow; private int newgeramsectionrow2; private int ghostactivate; private int showdateshamsi; private int sendtyping; private int showtimeago; private int numberRow; private int usernameRow; private int settingsSectionRow; private int settingsSectionRow2; private int enableAnimationsRow; private int notificationRow; private int backgroundRow; private int languageRow; private int privacyRow; private int mediaDownloadSection; private int mediaDownloadSection2; private int mobileDownloadRow; private int wifiDownloadRow; private int roamingDownloadRow; private int saveToGalleryRow; private int messagesSectionRow; private int messagesSectionRow2; private int customTabsRow; private int directShareRow; private int textSizeRow; private int fontType; private int stickersRow; private int cacheRow; private int raiseToSpeakRow; private int sendByEnterRow; private int supportSectionRow; private int supportSectionRow2; private int askQuestionRow; private int telegramFaqRow; private int privacyPolicyRow; private int sendLogsRow; private int clearLogsRow; private int switchBackendButtonRow; private int versionRow; private int contactsSectionRow; private int contactsReimportRow; private int contactsSortRow; private int autoplayGifsRow; private int rowCount; private final static int edit_name = 1; private final static int logout = 2; private int answeringmachinerow2; private int answeringmachinerow; private int tabletforceoverride; private int anweringmachinactive; private int answermachinetext; private static class LinkMovementMethodMy extends LinkMovementMethod { @Override public boolean onTouchEvent(@NonNull TextView widget, @NonNull Spannable buffer, @NonNull MotionEvent event) { try { return super.onTouchEvent(widget, buffer, event); } catch (Exception e) { FileLog.e("tmessages", e); } return false; } } @Override public boolean onFragmentCreate() { super.onFragmentCreate(); avatarUpdater.parentFragment = this; avatarUpdater.delegate = new AvatarUpdater.AvatarUpdaterDelegate() { @Override public void didUploadedPhoto(TLRPC.InputFile file, TLRPC.PhotoSize small, TLRPC.PhotoSize big) { TLRPC.TL_photos_uploadProfilePhoto req = new TLRPC.TL_photos_uploadProfilePhoto(); req.caption = ""; req.crop = new TLRPC.TL_inputPhotoCropAuto(); req.file = file; req.geo_point = new TLRPC.TL_inputGeoPointEmpty(); ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { @Override public void run(TLObject response, TLRPC.TL_error error) { if (error == null) { TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user == null) { user = UserConfig.getCurrentUser(); if (user == null) { return; } MessagesController.getInstance().putUser(user, false); } else { UserConfig.setCurrentUser(user); } TLRPC.TL_photos_photo photo = (TLRPC.TL_photos_photo) response; ArrayList<TLRPC.PhotoSize> sizes = photo.photo.sizes; TLRPC.PhotoSize smallSize = FileLoader.getClosestPhotoSizeWithSize(sizes, 100); TLRPC.PhotoSize bigSize = FileLoader.getClosestPhotoSizeWithSize(sizes, 1000); user.photo = new TLRPC.TL_userProfilePhoto(); user.photo.photo_id = photo.photo.id; if (smallSize != null) { user.photo.photo_small = smallSize.location; } if (bigSize != null) { user.photo.photo_big = bigSize.location; } else if (smallSize != null) { user.photo.photo_small = smallSize.location; } MessagesStorage.getInstance().clearUserPhotos(user.id); ArrayList<TLRPC.User> users = new ArrayList<>(); users.add(user); MessagesStorage.getInstance().putUsersAndChats(users, null, false, true); AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_ALL); NotificationCenter.getInstance().postNotificationName(NotificationCenter.mainUserInfoChanged); UserConfig.saveConfig(true); } }); } } }); } }; NotificationCenter.getInstance().addObserver(this, NotificationCenter.updateInterfaces); rowCount = 0; overscrollRow = rowCount++; emptyRow = rowCount++; numberSectionRow = rowCount++; numberRow = rowCount++; usernameRow = rowCount++; newgeramsectionrow = rowCount++; newgeramsectionrow2 = rowCount++; ghostactivate = rowCount++; sendtyping = rowCount++; showtimeago = rowCount++; showdateshamsi = rowCount++; tabletforceoverride = rowCount++; answeringmachinerow = rowCount++; answeringmachinerow2 = rowCount++; anweringmachinactive = rowCount++; answermachinetext = rowCount++; settingsSectionRow = rowCount++; settingsSectionRow2 = rowCount++; notificationRow = rowCount++; privacyRow = rowCount++; backgroundRow = rowCount++; languageRow = rowCount++; enableAnimationsRow = rowCount++; mediaDownloadSection = rowCount++; mediaDownloadSection2 = rowCount++; mobileDownloadRow = rowCount++; wifiDownloadRow = rowCount++; roamingDownloadRow = rowCount++; if (Build.VERSION.SDK_INT >= 11) { autoplayGifsRow = rowCount++; } saveToGalleryRow = rowCount++; messagesSectionRow = rowCount++; messagesSectionRow2 = rowCount++; customTabsRow = rowCount++; if (Build.VERSION.SDK_INT >= 23) { directShareRow = rowCount++; } textSizeRow = rowCount++; fontType = rowCount++; stickersRow = rowCount++; cacheRow = rowCount++; raiseToSpeakRow = rowCount++; sendByEnterRow = rowCount++; supportSectionRow = rowCount++; supportSectionRow2 = rowCount++; askQuestionRow = rowCount++; telegramFaqRow = rowCount++; privacyPolicyRow = rowCount++; if (BuildVars.DEBUG_VERSION) { sendLogsRow = rowCount++; clearLogsRow = rowCount++; switchBackendButtonRow = rowCount++; } versionRow = rowCount++; //contactsSectionRow = rowCount++; //contactsReimportRow = rowCount++; //contactsSortRow = rowCount++; MessagesController.getInstance().loadFullUser(UserConfig.getCurrentUser(), classGuid, true); return true; } @Override public void onFragmentDestroy() { super.onFragmentDestroy(); if (avatarImage != null) { avatarImage.setImageDrawable(null); } MessagesController.getInstance().cancelLoadFullUser(UserConfig.getClientUserId()); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.updateInterfaces); avatarUpdater.clear(); } @Override public View createView(final Context context) { actionBar.setBackgroundColor(ThemeChanger.getcurrent().getActionbarcolor()); actionBar.setItemsBackgroundColor(ThemeChanger.getcurrent().getActionbarcolor()); actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAddToContainer(false); extraHeight = 88; if (AndroidUtilities.isTablet()) { actionBar.setOccupyStatusBar(false); } actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } else if (id == edit_name) { presentFragment(new ChangeNameActivity()); } else if (id == logout) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setMessage(LocaleController.getString("AreYouSureLogout", R.string.AreYouSureLogout)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { MessagesController.getInstance().performLogout(true); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } } }); ActionBarMenu menu = actionBar.createMenu(); ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other); item.addSubItem(edit_name, LocaleController.getString("EditName", R.string.EditName), 0); item.addSubItem(logout, LocaleController.getString("LogOut", R.string.LogOut), 0); listAdapter = new ListAdapter(context); fragmentView = new FrameLayout(context) { @Override protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) { if (child == listView) { boolean result = super.drawChild(canvas, child, drawingTime); if (parentLayout != null) { int actionBarHeight = 0; int childCount = getChildCount(); for (int a = 0; a < childCount; a++) { View view = getChildAt(a); if (view == child) { continue; } if (view instanceof ActionBar && view.getVisibility() == VISIBLE) { if (((ActionBar) view).getCastShadows()) { actionBarHeight = view.getMeasuredHeight(); } break; } } parentLayout.drawHeaderShadow(canvas, actionBarHeight); } return result; } else { return super.drawChild(canvas, child, drawingTime); } } }; FrameLayout frameLayout = (FrameLayout) fragmentView; listView = new ListView(context); listView.setDivider(null); listView.setDividerHeight(0); listView.setVerticalScrollBarEnabled(false); AndroidUtilities.setListViewEdgeEffectColor(listView, AvatarDrawable.getProfileBackColorForId(5)); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT)); listView.setAdapter(listAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) { if (i == textSizeRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("TextSize", R.string.TextSize)); final NumberPicker numberPicker = new NumberPicker(getParentActivity()); numberPicker.setMinValue(12); numberPicker.setMaxValue(30); numberPicker.setValue(MessagesController.getInstance().fontSize); builder.setView(numberPicker); builder.setNegativeButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putInt("fons_size", numberPicker.getValue()); MessagesController.getInstance().fontSize = numberPicker.getValue(); editor.commit(); if (listView != null) { listView.invalidateViews(); } } }); showDialog(builder.create()); } else if (i == fontType) { // Toast.makeText(context, "ssssssssssss", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(context, FontActivity.class); context.startActivity(intent); } else if (i == enableAnimationsRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); boolean animations = preferences.getBoolean("view_animations", true); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("view_animations", !animations); editor.commit(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!animations); } } else if (i == notificationRow) { presentFragment(new NotificationsSettingsActivity()); } else if (i == answermachinetext) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(LocaleController.getString("Answeringmachinetext", R.string.Answeringmachinetext)); final EditText input = new EditText(context); input.setText(Setting.getAnsweringmachineText()); input.setInputType(InputType.TYPE_CLASS_TEXT); builder.setView(input); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Setting.setAnsweringmachineText(input.getText().toString()); } }); builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); builder.show(); } else if (i == backgroundRow) { presentFragment(new WallpapersActivity()); } else if (i == askQuestionRow) { if (getParentActivity() == null) { return; } final TextView message = new TextView(getParentActivity()); message.setText(Html.fromHtml(LocaleController.getString("AskAQuestionInfo", R.string.AskAQuestionInfo))); message.setTextSize(18); message.setLinkTextColor(Theme.MSG_LINK_TEXT_COLOR); // message.setTypeface(AndroidUtilities.getTypeface(org.pouyadr.finalsoft.Fonts.CurrentFont())); message.setPadding(AndroidUtilities.dp(8), AndroidUtilities.dp(5), AndroidUtilities.dp(8), AndroidUtilities.dp(6)); message.setMovementMethod(new LinkMovementMethodMy()); AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setView(message); builder.setPositiveButton(LocaleController.getString("AskButton", R.string.AskButton), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { performAskAQuestion(); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } else if (i == sendLogsRow) { sendLogs(); } else if (i == clearLogsRow) { FileLog.cleanupLogs(); } else if (i == sendByEnterRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); boolean send = preferences.getBoolean("send_by_enter", false); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("send_by_enter", !send); editor.commit(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == ghostactivate) { boolean send = Setting.getGhostMode(); GhostPorotocol.toggleGhostPortocol(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == sendtyping) { boolean send = Setting.getSendTyping(); Setting.setSendTyping(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == anweringmachinactive) { boolean send = Setting.getAnsweringMachine(); Setting.setAnsweringMachine(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == showtimeago) { boolean send = Setting.getShowTimeAgo(); Setting.setShowTimeAgo(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == showdateshamsi) { boolean send = Setting.getDatePersian(); Setting.setDatePersian(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == tabletforceoverride) { boolean send = Setting.getTabletMode(); Setting.setTabletMode(!send); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(!send); } } else if (i == raiseToSpeakRow) { MediaController.getInstance().toogleRaiseToSpeak(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canRaiseToSpeak()); } } else if (i == autoplayGifsRow) { MediaController.getInstance().toggleAutoplayGifs(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canAutoplayGifs()); } } else if (i == saveToGalleryRow) { MediaController.getInstance().toggleSaveToGallery(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canSaveToGallery()); } } else if (i == customTabsRow) { MediaController.getInstance().toggleCustomTabs(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canCustomTabs()); } } else if (i == directShareRow) { MediaController.getInstance().toggleDirectShare(); if (view instanceof TextCheckCell) { ((TextCheckCell) view).setChecked(MediaController.getInstance().canDirectShare()); } } else if (i == privacyRow) { presentFragment(new PrivacySettingsActivity()); } else if (i == languageRow) { presentFragment(new LanguageSelectActivity()); } else if (i == switchBackendButtonRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure)); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { ConnectionsManager.getInstance().switchBackend(); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } else if (i == telegramFaqRow) { Browser.openUrl(getParentActivity(), LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl)); } else if (i == privacyPolicyRow) { Browser.openUrl(getParentActivity(), LocaleController.getString("PrivacyPolicyUrl", R.string.PrivacyPolicyUrl)); } else if (i == contactsReimportRow) { //not implemented } else if (i == contactsSortRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("SortBy", R.string.SortBy)); builder.setItems(new CharSequence[]{ LocaleController.getString("Default", R.string.Default), LocaleController.getString("SortFirstName", R.string.SortFirstName), LocaleController.getString("SortLastName", R.string.SortLastName) }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); SharedPreferences.Editor editor = preferences.edit(); editor.putInt("sortContactsBy", which); editor.commit(); if (listView != null) { listView.invalidateViews(); } } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } else if (i == wifiDownloadRow || i == mobileDownloadRow || i == roamingDownloadRow) { if (getParentActivity() == null) { return; } final boolean maskValues[] = new boolean[6]; BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity()); int mask = 0; if (i == mobileDownloadRow) { mask = MediaController.getInstance().mobileDataDownloadMask; } else if (i == wifiDownloadRow) { mask = MediaController.getInstance().wifiDownloadMask; } else if (i == roamingDownloadRow) { mask = MediaController.getInstance().roamingDownloadMask; } builder.setApplyTopPadding(false); builder.setApplyBottomPadding(false); LinearLayout linearLayout = new LinearLayout(getParentActivity()); linearLayout.setOrientation(LinearLayout.VERTICAL); for (int a = 0; a < 6; a++) { String name = null; if (a == 0) { maskValues[a] = (mask & MediaController.AUTODOWNLOAD_MASK_PHOTO) != 0; name = LocaleController.getString("AttachPhoto", R.string.AttachPhoto); } else if (a == 1) { maskValues[a] = (mask & MediaController.AUTODOWNLOAD_MASK_AUDIO) != 0; name = LocaleController.getString("AttachAudio", R.string.AttachAudio); } else if (a == 2) { maskValues[a] = (mask & MediaController.AUTODOWNLOAD_MASK_VIDEO) != 0; name = LocaleController.getString("AttachVideo", R.string.AttachVideo); } else if (a == 3) { maskValues[a] = (mask & MediaController.AUTODOWNLOAD_MASK_DOCUMENT) != 0; name = LocaleController.getString("AttachDocument", R.string.AttachDocument); } else if (a == 4) { maskValues[a] = (mask & MediaController.AUTODOWNLOAD_MASK_MUSIC) != 0; name = LocaleController.getString("AttachMusic", R.string.AttachMusic); } else if (a == 5) { if (Build.VERSION.SDK_INT >= 11) { maskValues[a] = (mask & MediaController.AUTODOWNLOAD_MASK_GIF) != 0; name = LocaleController.getString("AttachGif", R.string.AttachGif); } else { continue; } } CheckBoxCell checkBoxCell = new CheckBoxCell(getParentActivity()); checkBoxCell.setTag(a); checkBoxCell.setBackgroundResource(R.drawable.list_selector); linearLayout.addView(checkBoxCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); checkBoxCell.setText(name, "", maskValues[a], true); checkBoxCell.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { CheckBoxCell cell = (CheckBoxCell) v; int num = (Integer) cell.getTag(); maskValues[num] = !maskValues[num]; cell.setChecked(maskValues[num], true); } }); } BottomSheet.BottomSheetCell cell = new BottomSheet.BottomSheetCell(getParentActivity(), 1); cell.setBackgroundResource(R.drawable.list_selector); cell.setTextAndIcon(LocaleController.getString("Save", R.string.Save).toUpperCase(), 0); cell.setTextColor(Theme.AUTODOWNLOAD_SHEET_SAVE_TEXT_COLOR); cell.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { if (visibleDialog != null) { visibleDialog.dismiss(); } } catch (Exception e) { FileLog.e("tmessages", e); } int newMask = 0; for (int a = 0; a < 6; a++) { if (maskValues[a]) { if (a == 0) { newMask |= MediaController.AUTODOWNLOAD_MASK_PHOTO; } else if (a == 1) { newMask |= MediaController.AUTODOWNLOAD_MASK_AUDIO; } else if (a == 2) { newMask |= MediaController.AUTODOWNLOAD_MASK_VIDEO; } else if (a == 3) { newMask |= MediaController.AUTODOWNLOAD_MASK_DOCUMENT; } else if (a == 4) { newMask |= MediaController.AUTODOWNLOAD_MASK_MUSIC; } else if (a == 5) { newMask |= MediaController.AUTODOWNLOAD_MASK_GIF; } } } SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE).edit(); if (i == mobileDownloadRow) { editor.putInt("mobileDataDownloadMask", newMask); MediaController.getInstance().mobileDataDownloadMask = newMask; } else if (i == wifiDownloadRow) { editor.putInt("wifiDownloadMask", newMask); MediaController.getInstance().wifiDownloadMask = newMask; } else if (i == roamingDownloadRow) { editor.putInt("roamingDownloadMask", newMask); MediaController.getInstance().roamingDownloadMask = newMask; } editor.commit(); if (listView != null) { listView.invalidateViews(); } } }); linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); builder.setCustomView(linearLayout); showDialog(builder.create()); } else if (i == usernameRow) { presentFragment(new ChangeUsernameActivity()); } else if (i == numberRow) { presentFragment(new ChangePhoneHelpActivity()); } else if (i == stickersRow) { presentFragment(new StickersActivity()); } else if (i == cacheRow) { presentFragment(new CacheControlActivity()); } } }); frameLayout.addView(actionBar); extraHeightView = new View(context); ViewProxy.setPivotY(extraHeightView, 0); extraHeightView.setBackgroundColor(ThemeChanger.getcurrent().getActionbarcolor()); frameLayout.addView(extraHeightView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 88)); shadowView = new View(context); shadowView.setBackgroundResource(R.drawable.header_shadow); frameLayout.addView(shadowView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3)); avatarImage = new BackupImageView(context); avatarImage.setRoundRadius(AndroidUtilities.dp(21)); ViewProxy.setPivotX(avatarImage, 0); ViewProxy.setPivotY(avatarImage, 0); frameLayout.addView(avatarImage, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.LEFT, 64, 0, 0, 0)); avatarImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user != null && user.photo != null && user.photo.photo_big != null) { PhotoViewer.getInstance().setParentActivity(getParentActivity()); PhotoViewer.getInstance().openPhoto(user.photo.photo_big, SettingsActivity.this); } } }); nameTextView = new TextView(context); nameTextView.setTextColor(0xffffffff); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); nameTextView.setLines(1); nameTextView.setMaxLines(1); nameTextView.setSingleLine(true); nameTextView.setEllipsize(TextUtils.TruncateAt.END); nameTextView.setGravity(Gravity.LEFT); nameTextView.setTypeface(AndroidUtilities.getTypeface(org.pouyadr.finalsoft.Fonts.CurrentFont())); ViewProxy.setPivotX(nameTextView, 0); ViewProxy.setPivotY(nameTextView, 0); frameLayout.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 48, 0)); onlineTextView = new TextView(context); onlineTextView.setTextColor(AvatarDrawable.getProfileTextColorForId(5)); onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); onlineTextView.setLines(1); onlineTextView.setMaxLines(1); onlineTextView.setSingleLine(true); onlineTextView.setEllipsize(TextUtils.TruncateAt.END); onlineTextView.setGravity(Gravity.LEFT); frameLayout.addView(onlineTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 48, 0)); writeButton = new ImageView(context); writeButton.setBackgroundResource(R.drawable.floating_user_states); writeButton.setImageResource(R.drawable.floating_camera); writeButton.setScaleType(ImageView.ScaleType.CENTER); if (Build.VERSION.SDK_INT >= 21) { StateListAnimator animator = new StateListAnimator(); animator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(writeButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200)); animator.addState(new int[]{}, ObjectAnimator.ofFloat(writeButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200)); writeButton.setStateListAnimator(animator); writeButton.setOutlineProvider(new ViewOutlineProvider() { @SuppressLint("NewApi") @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56)); } }); } frameLayout.addView(writeButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.TOP, 0, 0, 16, 0)); writeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); CharSequence[] items; TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user == null) { user = UserConfig.getCurrentUser(); } if (user == null) { return; } boolean fullMenu = false; if (user.photo != null && user.photo.photo_big != null && !(user.photo instanceof TLRPC.TL_userProfilePhotoEmpty)) { items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)}; fullMenu = true; } else { items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley)}; } final boolean full = fullMenu; builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { avatarUpdater.openCamera(); } else if (i == 1) { avatarUpdater.openGallery(); } else if (i == 2) { MessagesController.getInstance().deleteUserPhoto(null); } } }); showDialog(builder.create()); } }); needLayout(); listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (totalItemCount == 0) { return; } int height = 0; View child = view.getChildAt(0); if (child != null) { if (firstVisibleItem == 0) { height = AndroidUtilities.dp(88) + (child.getTop() < 0 ? child.getTop() : 0); } if (extraHeight != height) { extraHeight = height; needLayout(); } } } }); return fragmentView; } @Override protected void onDialogDismiss(Dialog dialog) { MediaController.getInstance().checkAutodownloadSettings(); } @Override public void updatePhotoAtIndex(int index) { } @Override public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { if (fileLocation == null) { return null; } TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user != null && user.photo != null && user.photo.photo_big != null) { TLRPC.FileLocation photoBig = user.photo.photo_big; if (photoBig.local_id == fileLocation.local_id && photoBig.volume_id == fileLocation.volume_id && photoBig.dc_id == fileLocation.dc_id) { int coords[] = new int[2]; avatarImage.getLocationInWindow(coords); PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject(); object.viewX = coords[0]; object.viewY = coords[1] - AndroidUtilities.statusBarHeight; object.parentView = avatarImage; object.imageReceiver = avatarImage.getImageReceiver(); object.user_id = UserConfig.getClientUserId(); object.thumb = object.imageReceiver.getBitmap(); object.size = -1; object.radius = avatarImage.getImageReceiver().getRoundRadius(); object.scale = ViewProxy.getScaleX(avatarImage); return object; } } return null; } @Override public Bitmap getThumbForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { return null; } @Override public void willSwitchFromPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) { } @Override public void willHidePhotoViewer() { avatarImage.getImageReceiver().setVisible(true, true); } @Override public boolean isPhotoChecked(int index) { return false; } @Override public void setPhotoChecked(int index) { } @Override public boolean cancelButtonPressed() { return true; } @Override public void sendButtonPressed(int index) { } @Override public int getSelectedCount() { return 0; } public void performAskAQuestion() { final SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); int uid = preferences.getInt("support_id", 0); TLRPC.User supportUser = null; if (uid != 0) { supportUser = MessagesController.getInstance().getUser(uid); if (supportUser == null) { String userString = preferences.getString("support_user", null); if (userString != null) { try { byte[] datacentersBytes = Base64.decode(userString, Base64.DEFAULT); if (datacentersBytes != null) { SerializedData data = new SerializedData(datacentersBytes); supportUser = TLRPC.User.TLdeserialize(data, data.readInt32(false), false); if (supportUser != null && supportUser.id == 333000) { supportUser = null; } data.cleanup(); } } catch (Exception e) { FileLog.e("tmessages", e); supportUser = null; } } } } if (supportUser == null) { final ProgressDialog progressDialog = new ProgressDialog(getParentActivity()); progressDialog.setMessage(LocaleController.getString("Loading", R.string.Loading)); progressDialog.setCanceledOnTouchOutside(false); progressDialog.setCancelable(false); progressDialog.show(); TLRPC.TL_help_getSupport req = new TLRPC.TL_help_getSupport(); ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { @Override public void run(TLObject response, TLRPC.TL_error error) { if (error == null) { final TLRPC.TL_help_support res = (TLRPC.TL_help_support) response; AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { SharedPreferences.Editor editor = preferences.edit(); editor.putInt("support_id", res.user.id); SerializedData data = new SerializedData(); res.user.serializeToStream(data); editor.putString("support_user", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT)); editor.commit(); data.cleanup(); try { progressDialog.dismiss(); } catch (Exception e) { FileLog.e("tmessages", e); } ArrayList<TLRPC.User> users = new ArrayList<>(); users.add(res.user); MessagesStorage.getInstance().putUsersAndChats(users, null, true, true); MessagesController.getInstance().putUser(res.user, false); Bundle args = new Bundle(); args.putInt("user_id", res.user.id); presentFragment(new ChatActivity(args)); } }); } else { AndroidUtilities.runOnUIThread(new Runnable() { @Override public void run() { try { progressDialog.dismiss(); } catch (Exception e) { FileLog.e("tmessages", e); } } }); } } }); } else { MessagesController.getInstance().putUser(supportUser, true); Bundle args = new Bundle(); args.putInt("user_id", supportUser.id); presentFragment(new ChatActivity(args)); } } @Override public void onActivityResultFragment(int requestCode, int resultCode, Intent data) { avatarUpdater.onActivityResult(requestCode, resultCode, data); } @Override public void saveSelfArgs(Bundle args) { if (avatarUpdater != null && avatarUpdater.currentPicturePath != null) { args.putString("path", avatarUpdater.currentPicturePath); } } @Override public void restoreSelfArgs(Bundle args) { if (avatarUpdater != null) { avatarUpdater.currentPicturePath = args.getString("path"); } } @Override public void didReceivedNotification(int id, Object... args) { if (id == NotificationCenter.updateInterfaces) { int mask = (Integer) args[0]; if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0) { updateUserData(); } } } @Override public void onResume() { super.onResume(); if (listAdapter != null) { listAdapter.notifyDataSetChanged(); } updateUserData(); fixLayout(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); fixLayout(); } private void needLayout() { FrameLayout.LayoutParams layoutParams; int newTop = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight(); if (listView != null) { layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); if (layoutParams.topMargin != newTop) { layoutParams.topMargin = newTop; listView.setLayoutParams(layoutParams); ViewProxy.setTranslationY(extraHeightView, newTop); } } if (avatarImage != null) { float diff = extraHeight / (float) AndroidUtilities.dp(88); ViewProxy.setScaleY(extraHeightView, diff); ViewProxy.setTranslationY(shadowView, newTop + extraHeight); if (Build.VERSION.SDK_INT < 11) { layoutParams = (FrameLayout.LayoutParams) writeButton.getLayoutParams(); layoutParams.topMargin = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight() + extraHeight - AndroidUtilities.dp(29.5f); writeButton.setLayoutParams(layoutParams); } else { ViewProxy.setTranslationY(writeButton, (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight() + extraHeight - AndroidUtilities.dp(29.5f)); } final boolean setVisible = diff > 0.2f; boolean currentVisible = writeButton.getTag() == null; if (setVisible != currentVisible) { if (setVisible) { writeButton.setTag(null); writeButton.setVisibility(View.VISIBLE); } else { writeButton.setTag(0); } if (writeButtonAnimation != null) { AnimatorSetProxy old = writeButtonAnimation; writeButtonAnimation = null; old.cancel(); } writeButtonAnimation = new AnimatorSetProxy(); if (setVisible) { writeButtonAnimation.setInterpolator(new DecelerateInterpolator()); writeButtonAnimation.playTogether( ObjectAnimatorProxy.ofFloat(writeButton, "scaleX", 1.0f), ObjectAnimatorProxy.ofFloat(writeButton, "scaleY", 1.0f), ObjectAnimatorProxy.ofFloat(writeButton, "alpha", 1.0f) ); } else { writeButtonAnimation.setInterpolator(new AccelerateInterpolator()); writeButtonAnimation.playTogether( ObjectAnimatorProxy.ofFloat(writeButton, "scaleX", 0.2f), ObjectAnimatorProxy.ofFloat(writeButton, "scaleY", 0.2f), ObjectAnimatorProxy.ofFloat(writeButton, "alpha", 0.0f) ); } writeButtonAnimation.setDuration(150); writeButtonAnimation.addListener(new AnimatorListenerAdapterProxy() { @Override public void onAnimationEnd(Object animation) { if (writeButtonAnimation != null && writeButtonAnimation.equals(animation)) { writeButton.clearAnimation(); writeButton.setVisibility(setVisible ? View.VISIBLE : View.GONE); writeButtonAnimation = null; } } }); writeButtonAnimation.start(); } ViewProxy.setScaleX(avatarImage, (42 + 18 * diff) / 42.0f); ViewProxy.setScaleY(avatarImage, (42 + 18 * diff) / 42.0f); float avatarY = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight() / 2.0f * (1.0f + diff) - 21 * AndroidUtilities.density + 27 * AndroidUtilities.density * diff; ViewProxy.setTranslationX(avatarImage, -AndroidUtilities.dp(47) * diff); ViewProxy.setTranslationY(avatarImage, (float) Math.ceil(avatarY)); ViewProxy.setTranslationX(nameTextView, -21 * AndroidUtilities.density * diff); ViewProxy.setTranslationY(nameTextView, (float) Math.floor(avatarY) - (float) Math.ceil(AndroidUtilities.density) + (float) Math.floor(7 * AndroidUtilities.density * diff)); ViewProxy.setTranslationX(onlineTextView, -21 * AndroidUtilities.density * diff); ViewProxy.setTranslationY(onlineTextView, (float) Math.floor(avatarY) + AndroidUtilities.dp(22) + (float) Math.floor(11 * AndroidUtilities.density) * diff); ViewProxy.setScaleX(nameTextView, 1.0f + 0.12f * diff); ViewProxy.setScaleY(nameTextView, 1.0f + 0.12f * diff); } } private void fixLayout() { if (fragmentView == null) { return; } fragmentView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { if (fragmentView != null) { needLayout(); fragmentView.getViewTreeObserver().removeOnPreDrawListener(this); } return true; } }); } private void updateUserData() { TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); TLRPC.FileLocation photo = null; TLRPC.FileLocation photoBig = null; if (user.photo != null) { photo = user.photo.photo_small; photoBig = user.photo.photo_big; } AvatarDrawable avatarDrawable = new AvatarDrawable(user, true); avatarDrawable.setColor(Theme.ACTION_BAR_MAIN_AVATAR_COLOR); if (avatarImage != null) { avatarImage.setImage(photo, "50_50", avatarDrawable); avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false); nameTextView.setText(UserObject.getUserName(user)); onlineTextView.setText(LocaleController.getString("Online", R.string.Online)); avatarImage.getImageReceiver().setVisible(!PhotoViewer.getInstance().isShowingImage(photoBig), false); } } private void sendLogs() { try { ArrayList<Uri> uris = new ArrayList<>(); File sdCard = ApplicationLoader.applicationContext.getExternalFilesDir(null); File dir = new File(sdCard.getAbsolutePath() + "/logs"); File[] files = dir.listFiles(); for (File file : files) { uris.add(Uri.fromFile(file)); } if (uris.isEmpty()) { return; } Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE); i.setType("message/rfc822"); i.putExtra(Intent.EXTRA_EMAIL, new String[]{BuildVars.SEND_LOGS_EMAIL}); i.putExtra(Intent.EXTRA_SUBJECT, "last logs"); i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); getParentActivity().startActivityForResult(Intent.createChooser(i, "Select email application."), 500); } catch (Exception e) { e.printStackTrace(); } } private class ListAdapter extends BaseFragmentAdapter { private Context mContext; public ListAdapter(Context context) { mContext = context; } @Override public boolean areAllItemsEnabled() { return false; } @Override public boolean isEnabled(int i) { return i == textSizeRow || i == fontType || i == tabletforceoverride || i == anweringmachinactive || i == answermachinetext || i == sendtyping || i == showdateshamsi || i == showtimeago || i == ghostactivate || i == enableAnimationsRow || i == notificationRow || i == backgroundRow || i == numberRow || i == askQuestionRow || i == sendLogsRow || i == sendByEnterRow || i == autoplayGifsRow || i == privacyRow || i == wifiDownloadRow || i == mobileDownloadRow || i == clearLogsRow || i == roamingDownloadRow || i == languageRow || i == usernameRow || i == switchBackendButtonRow || i == telegramFaqRow || i == contactsSortRow || i == contactsReimportRow || i == saveToGalleryRow || i == stickersRow || i == cacheRow || i == raiseToSpeakRow || i == privacyPolicyRow || i == customTabsRow || i == directShareRow; } @Override public int getCount() { return rowCount; } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return i; } @Override public boolean hasStableIds() { return false; } @Override public View getView(int i, View view, ViewGroup viewGroup) { int type = getItemViewType(i); if (type == 0) { if (view == null) { view = new EmptyCell(mContext); } if (i == overscrollRow) { ((EmptyCell) view).setHeight(AndroidUtilities.dp(88)); } else { ((EmptyCell) view).setHeight(AndroidUtilities.dp(16)); } } else if (type == 1) { if (view == null) { view = new ShadowSectionCell(mContext); } } else if (type == 2) { if (view == null) { view = new TextSettingsCell(mContext); } TextSettingsCell textCell = (TextSettingsCell) view; if (i == textSizeRow) { SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); int size = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16); textCell.setTextAndValue(LocaleController.getString("TextSize", R.string.TextSize), String.format("%d", size), true); } else if (i == fontType) { textCell.setTextAndValue( "نوع خط نوشتاری", Fonts.CurrentFont().replace("fonts/","").replace(".ttf",""), true); } else if (i == languageRow) { textCell.setTextAndValue(LocaleController.getString("Language", R.string.Language), LocaleController.getCurrentLanguageName(), true); } else if (i == contactsSortRow) { String value; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); int sort = preferences.getInt("sortContactsBy", 0); if (sort == 0) { value = LocaleController.getString("Default", R.string.Default); } else if (sort == 1) { value = LocaleController.getString("FirstName", R.string.SortFirstName); } else { value = LocaleController.getString("LastName", R.string.SortLastName); } textCell.setTextAndValue(LocaleController.getString("SortBy", R.string.SortBy), value, true); } else if (i == notificationRow) { textCell.setText(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), true); } else if (i == backgroundRow) { textCell.setText(LocaleController.getString("ChatBackground", R.string.ChatBackground), true); } else if (i == answermachinetext) { textCell.setTextAndValue(LocaleController.getString("Answeringmachinetext", R.string.Answeringmachinetext), Setting.getAnsweringmachineText(), true); } else if (i == sendLogsRow) { textCell.setText("Send Logs", true); } else if (i == clearLogsRow) { textCell.setText("Clear Logs", true); } else if (i == askQuestionRow) { textCell.setText(LocaleController.getString("AskAQuestion", R.string.AskAQuestion), true); } else if (i == privacyRow) { textCell.setText(LocaleController.getString("PrivacySettings", R.string.PrivacySettings), true); } else if (i == switchBackendButtonRow) { textCell.setText("Switch Backend", true); } else if (i == telegramFaqRow) { textCell.setText(LocaleController.getString("TelegramFAQ", R.string.TelegramFaq), true); } else if (i == contactsReimportRow) { textCell.setText(LocaleController.getString("ImportContacts", R.string.ImportContacts), true); } else if (i == stickersRow) { textCell.setText(LocaleController.getString("Stickers", R.string.Stickers), true); } else if (i == cacheRow) { textCell.setText(LocaleController.getString("CacheSettings", R.string.CacheSettings), true); } else if (i == privacyPolicyRow) { textCell.setText(LocaleController.getString("PrivacyPolicy", R.string.PrivacyPolicy), true); } } else if (type == 3) { if (view == null) { view = new TextCheckCell(mContext); } TextCheckCell textCell = (TextCheckCell) view; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); if (i == enableAnimationsRow) { textCell.setTextAndCheck(LocaleController.getString("EnableAnimations", R.string.EnableAnimations), preferences.getBoolean("view_animations", true), false); } else if (i == sendByEnterRow) { textCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), false); } else if (i == ghostactivate) { textCell.setTextAndValueAndCheck(LocaleController.getString("GhostMode", R.string.GhostMode), LocaleController.getString("GhostModeInfo", R.string.GhostModeInfo), Setting.getGhostMode(), true, true); } else if (i == sendtyping) { textCell.setTextAndValueAndCheck(LocaleController.getString("HideTypingState", R.string.HideTypingState), LocaleController.getString("HideTypingStateinfo", R.string.HideTypingStateinfo), Setting.getSendTyping(), true, true); } else if (i == anweringmachinactive) { textCell.setTextAndValueAndCheck(LocaleController.getString("Answeringmachineenable", R.string.Answeringmachineenable), LocaleController.getString("Answeringmachineenableinfo", R.string.Answeringmachineenableinfo), Setting.getAnsweringMachine(), true, true); } else if (i == showtimeago) { textCell.setTextAndValueAndCheck(LocaleController.getString("showtimeago", R.string.showtimeago), LocaleController.getString("showtimeagoinfo", R.string.showtimeagoinfo), Setting.getShowTimeAgo(), true, true); } else if (i == showdateshamsi) { textCell.setTextAndValueAndCheck(LocaleController.getString("showshamsidate", R.string.Showshamsidate), LocaleController.getString("showshamsidateinfo", R.string.showshamsidateinfo), Setting.getDatePersian(), true, true); } else if (i == tabletforceoverride) { textCell.setTextAndValueAndCheck(LocaleController.getString("TabletMode", R.string.TabletMode), LocaleController.getString("tabletmodeinfo", R.string.tabletmodeinfo), Setting.getTabletMode(), true, true); } else if (i == saveToGalleryRow) { textCell.setTextAndCheck(LocaleController.getString("SaveToGallerySettings", R.string.SaveToGallerySettings), MediaController.getInstance().canSaveToGallery(), false); } else if (i == autoplayGifsRow) { textCell.setTextAndCheck(LocaleController.getString("AutoplayGifs", R.string.AutoplayGifs), MediaController.getInstance().canAutoplayGifs(), true); } else if (i == raiseToSpeakRow) { textCell.setTextAndCheck(LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), MediaController.getInstance().canRaiseToSpeak(), true); } else if (i == customTabsRow) { textCell.setTextAndValueAndCheck(LocaleController.getString("ChromeCustomTabs", R.string.ChromeCustomTabs), LocaleController.getString("ChromeCustomTabsInfo", R.string.ChromeCustomTabsInfo), MediaController.getInstance().canCustomTabs(), false, true); } else if (i == directShareRow) { textCell.setTextAndValueAndCheck(LocaleController.getString("DirectShare", R.string.DirectShare), LocaleController.getString("DirectShareInfo", R.string.DirectShareInfo), MediaController.getInstance().canDirectShare(), false, true); } } else if (type == 4) { if (view == null) { view = new HeaderCell(mContext); } if (i == answeringmachinerow2) { ((HeaderCell) view).setText(LocaleController.getString("AnsweringMachin", R.string.answeringmachine)); } else if (i == settingsSectionRow2) { ((HeaderCell) view).setText(LocaleController.getString("SETTINGS", R.string.SETTINGS)); } else if (i == supportSectionRow2) { ((HeaderCell) view).setText(LocaleController.getString("Support", R.string.Support)); } else if (i == messagesSectionRow2) { ((HeaderCell) view).setText(LocaleController.getString("MessagesSettings", R.string.MessagesSettings)); } else if (i == mediaDownloadSection2) { ((HeaderCell) view).setText(LocaleController.getString("AutomaticMediaDownload", R.string.AutomaticMediaDownload)); } else if (i == numberSectionRow) { ((HeaderCell) view).setText(LocaleController.getString("Info", R.string.Info)); } else if (i == newgeramsectionrow2) { ((HeaderCell) view).setText(LocaleController.getString("NewGramSettings", R.string.newgeramsettings)); } } else if (type == 5) { if (view == null) { view = new TextInfoCell(mContext); try { PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0); int code = pInfo.versionCode / 10; String abi = ""; switch (pInfo.versionCode % 10) { case 0: abi = "arm"; break; case 1: abi = "arm-v7a"; break; case 2: abi = "x86"; break; case 3: abi = "universal"; break; } ((TextInfoCell) view).setText(String.format(Locale.US, "AriaGram for Android v%s (%d) %s", pInfo.versionName, code, abi)); } catch (Exception e) { FileLog.e("tmessages", e); } } } else if (type == 6) { if (view == null) { view = new TextDetailSettingsCell(mContext); } TextDetailSettingsCell textCell = (TextDetailSettingsCell) view; if (i == mobileDownloadRow || i == wifiDownloadRow || i == roamingDownloadRow) { int mask; String value; SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE); if (i == mobileDownloadRow) { value = LocaleController.getString("WhenUsingMobileData", R.string.WhenUsingMobileData); mask = MediaController.getInstance().mobileDataDownloadMask; } else if (i == wifiDownloadRow) { value = LocaleController.getString("WhenConnectedOnWiFi", R.string.WhenConnectedOnWiFi); mask = MediaController.getInstance().wifiDownloadMask; } else { value = LocaleController.getString("WhenRoaming", R.string.WhenRoaming); mask = MediaController.getInstance().roamingDownloadMask; } String text = ""; if ((mask & MediaController.AUTODOWNLOAD_MASK_PHOTO) != 0) { text += LocaleController.getString("AttachPhoto", R.string.AttachPhoto); } if ((mask & MediaController.AUTODOWNLOAD_MASK_AUDIO) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachAudio", R.string.AttachAudio); } if ((mask & MediaController.AUTODOWNLOAD_MASK_VIDEO) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachVideo", R.string.AttachVideo); } if ((mask & MediaController.AUTODOWNLOAD_MASK_DOCUMENT) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachDocument", R.string.AttachDocument); } if ((mask & MediaController.AUTODOWNLOAD_MASK_MUSIC) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachMusic", R.string.AttachMusic); } if (Build.VERSION.SDK_INT >= 11) { if ((mask & MediaController.AUTODOWNLOAD_MASK_GIF) != 0) { if (text.length() != 0) { text += ", "; } text += LocaleController.getString("AttachGif", R.string.AttachGif); } } if (text.length() == 0) { text = LocaleController.getString("NoMediaAutoDownload", R.string.NoMediaAutoDownload); } textCell.setTextAndValue(value, text, true); } else if (i == numberRow) { TLRPC.User user = UserConfig.getCurrentUser(); String value; if (user != null && user.phone != null && user.phone.length() != 0) { value = PhoneFormat.getInstance().format("+" + user.phone); } else { value = LocaleController.getString("NumberUnknown", R.string.NumberUnknown); } textCell.setTextAndValue(value, LocaleController.getString("Phone", R.string.Phone), true); } else if (i == usernameRow) { TLRPC.User user = UserConfig.getCurrentUser(); String value; if (user != null && user.username != null && user.username.length() != 0) { value = "@" + user.username; } else { value = LocaleController.getString("UsernameEmpty", R.string.UsernameEmpty); } // Log.i("username",""+ user.username); textCell.setTextAndValue(value, LocaleController.getString("Username", R.string.Username), false); } } return view; } @Override public int getItemViewType(int i) { if (i == emptyRow || i == overscrollRow) { return 0; } if (i == answeringmachinerow || i == settingsSectionRow || i == newgeramsectionrow || i == supportSectionRow || i == messagesSectionRow || i == mediaDownloadSection || i == contactsSectionRow) { return 1; } else if (i == enableAnimationsRow || i == tabletforceoverride || i == showdateshamsi || i == showtimeago || i == anweringmachinactive || i == sendtyping || i == ghostactivate || i == sendByEnterRow || i == saveToGalleryRow || i == autoplayGifsRow || i == raiseToSpeakRow || i == customTabsRow || i == directShareRow) { return 3; } else if (i == notificationRow || i == answermachinetext || i == backgroundRow || i == askQuestionRow || i == sendLogsRow || i == privacyRow || i == clearLogsRow || i == switchBackendButtonRow || i == telegramFaqRow || i == contactsReimportRow || i == textSizeRow || i == fontType || i == languageRow || i == contactsSortRow || i == stickersRow || i == cacheRow || i == privacyPolicyRow) { return 2; } else if (i == versionRow) { return 5; } else if (i == wifiDownloadRow || i == mobileDownloadRow || i == roamingDownloadRow || i == numberRow || i == usernameRow) { return 6; } else if (i == settingsSectionRow2 || i == answeringmachinerow2 || i == newgeramsectionrow2 || i == messagesSectionRow2 || i == supportSectionRow2 || i == numberSectionRow || i == mediaDownloadSection2) { return 4; } else { return 2; } } @Override public int getViewTypeCount() { return 7; } @Override public boolean isEmpty() { return false; } } }
Java
/*************************************************************************** Copyright (C) 2014-2015 by Nick Thijssen <lamah83@gmail.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. 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/>. ***************************************************************************/ using test.Controls; namespace test { partial class TestTransform { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.bottomPanel = new System.Windows.Forms.FlowLayoutPanel(); this.cancelButton = new System.Windows.Forms.Button(); this.okButton = new System.Windows.Forms.Button(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.xNumeric = new System.Windows.Forms.NumericUpDown(); this.yNumeric = new System.Windows.Forms.NumericUpDown(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.wNumeric = new System.Windows.Forms.NumericUpDown(); this.hNumeric = new System.Windows.Forms.NumericUpDown(); this.positionLabel = new System.Windows.Forms.Label(); this.sizeLabel = new System.Windows.Forms.Label(); this.rotationLabel = new System.Windows.Forms.Label(); this.positionalalignmentLabel = new System.Windows.Forms.Label(); this.Alignment = new test.Controls.AlignmentBox(); this.Rotation = new test.Controls.RotationBox(); this.bottomPanel.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.xNumeric)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.yNumeric)).BeginInit(); this.flowLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.wNumeric)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hNumeric)).BeginInit(); this.SuspendLayout(); // // bottomPanel // this.bottomPanel.AutoSize = true; this.bottomPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.bottomPanel.Controls.Add(this.cancelButton); this.bottomPanel.Controls.Add(this.okButton); this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom; this.bottomPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; this.bottomPanel.Location = new System.Drawing.Point(0, 230); this.bottomPanel.Name = "bottomPanel"; this.bottomPanel.Size = new System.Drawing.Size(364, 29); this.bottomPanel.TabIndex = 0; // // cancelButton // this.cancelButton.Location = new System.Drawing.Point(286, 3); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 1; this.cancelButton.Text = "Cancel"; this.cancelButton.UseVisualStyleBackColor = true; // // okButton // this.okButton.Location = new System.Drawing.Point(205, 3); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 0; this.okButton.Text = "OK"; this.okButton.UseVisualStyleBackColor = true; // // tableLayoutPanel1 // this.tableLayoutPanel1.AutoSize = true; this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 1, 0); this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 1, 1); this.tableLayoutPanel1.Controls.Add(this.positionLabel, 0, 0); this.tableLayoutPanel1.Controls.Add(this.sizeLabel, 0, 1); this.tableLayoutPanel1.Controls.Add(this.rotationLabel, 0, 2); this.tableLayoutPanel1.Controls.Add(this.positionalalignmentLabel, 0, 3); this.tableLayoutPanel1.Controls.Add(this.Alignment, 1, 3); this.tableLayoutPanel1.Controls.Add(this.Rotation, 1, 2); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 5; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(364, 230); this.tableLayoutPanel1.TabIndex = 0; // // flowLayoutPanel2 // this.flowLayoutPanel2.AutoSize = true; this.flowLayoutPanel2.Controls.Add(this.xNumeric); this.flowLayoutPanel2.Controls.Add(this.yNumeric); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel2.Location = new System.Drawing.Point(107, 0); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Size = new System.Drawing.Size(257, 26); this.flowLayoutPanel2.TabIndex = 7; // // xNumeric // this.xNumeric.DecimalPlaces = 3; this.xNumeric.Location = new System.Drawing.Point(3, 3); this.xNumeric.Name = "xNumeric"; this.xNumeric.Size = new System.Drawing.Size(120, 20); this.xNumeric.TabIndex = 0; // // yNumeric // this.yNumeric.DecimalPlaces = 3; this.yNumeric.Location = new System.Drawing.Point(129, 3); this.yNumeric.Name = "yNumeric"; this.yNumeric.Size = new System.Drawing.Size(120, 20); this.yNumeric.TabIndex = 1; // // flowLayoutPanel1 // this.flowLayoutPanel1.AutoSize = true; this.flowLayoutPanel1.Controls.Add(this.wNumeric); this.flowLayoutPanel1.Controls.Add(this.hNumeric); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.Location = new System.Drawing.Point(107, 26); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(257, 26); this.flowLayoutPanel1.TabIndex = 1; // // wNumeric // this.wNumeric.DecimalPlaces = 3; this.wNumeric.Location = new System.Drawing.Point(3, 3); this.wNumeric.Name = "wNumeric"; this.wNumeric.Size = new System.Drawing.Size(120, 20); this.wNumeric.TabIndex = 1; // // hNumeric // this.hNumeric.DecimalPlaces = 3; this.hNumeric.Location = new System.Drawing.Point(129, 3); this.hNumeric.Name = "hNumeric"; this.hNumeric.Size = new System.Drawing.Size(120, 20); this.hNumeric.TabIndex = 0; // // positionLabel // this.positionLabel.AutoSize = true; this.positionLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.positionLabel.Location = new System.Drawing.Point(3, 0); this.positionLabel.Name = "positionLabel"; this.positionLabel.Size = new System.Drawing.Size(101, 26); this.positionLabel.TabIndex = 0; this.positionLabel.Text = "Position"; this.positionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // sizeLabel // this.sizeLabel.AutoSize = true; this.sizeLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.sizeLabel.Location = new System.Drawing.Point(3, 26); this.sizeLabel.Name = "sizeLabel"; this.sizeLabel.Size = new System.Drawing.Size(101, 26); this.sizeLabel.TabIndex = 6; this.sizeLabel.Text = "Size"; this.sizeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // rotationLabel // this.rotationLabel.AutoSize = true; this.rotationLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.rotationLabel.Location = new System.Drawing.Point(3, 52); this.rotationLabel.Name = "rotationLabel"; this.rotationLabel.Size = new System.Drawing.Size(101, 78); this.rotationLabel.TabIndex = 5; this.rotationLabel.Text = "Rotation"; this.rotationLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // positionalalignmentLabel // this.positionalalignmentLabel.AutoSize = true; this.positionalalignmentLabel.Dock = System.Windows.Forms.DockStyle.Fill; this.positionalalignmentLabel.Location = new System.Drawing.Point(3, 130); this.positionalalignmentLabel.Name = "positionalalignmentLabel"; this.positionalalignmentLabel.Size = new System.Drawing.Size(101, 78); this.positionalalignmentLabel.TabIndex = 4; this.positionalalignmentLabel.Text = "Positional Alignment"; this.positionalalignmentLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // Alignment // this.Alignment.Alignment = OBS.ObsAlignment.Center; this.Alignment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.Alignment.AutoSize = true; this.Alignment.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.Alignment.Location = new System.Drawing.Point(110, 133); this.Alignment.Name = "Alignment"; this.Alignment.Size = new System.Drawing.Size(72, 72); this.Alignment.TabIndex = 2; // // Rotation // this.Rotation.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.Rotation.Debug = false; this.Rotation.Location = new System.Drawing.Point(110, 55); this.Rotation.MaximumSize = new System.Drawing.Size(400, 400); this.Rotation.MinimumSize = new System.Drawing.Size(50, 50); this.Rotation.Name = "Rotation"; this.Rotation.Rotation = 0; this.Rotation.Size = new System.Drawing.Size(72, 72); this.Rotation.SnapAngle = 45; this.Rotation.SnapToAngle = true; this.Rotation.SnapTolerance = 10; this.Rotation.TabIndex = 3; // // TestTransform // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; this.ClientSize = new System.Drawing.Size(364, 259); this.ControlBox = false; this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.bottomPanel); this.Name = "TestTransform"; this.ShowIcon = false; this.ShowInTaskbar = false; this.Text = "Edit Transform"; this.bottomPanel.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.flowLayoutPanel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.xNumeric)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.yNumeric)).EndInit(); this.flowLayoutPanel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.wNumeric)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hNumeric)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.FlowLayoutPanel bottomPanel; private System.Windows.Forms.Button cancelButton; private System.Windows.Forms.Button okButton; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.NumericUpDown wNumeric; private System.Windows.Forms.NumericUpDown hNumeric; private System.Windows.Forms.Label positionLabel; private System.Windows.Forms.Label sizeLabel; private System.Windows.Forms.Label rotationLabel; private System.Windows.Forms.Label positionalalignmentLabel; private AlignmentBox Alignment; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; private System.Windows.Forms.NumericUpDown xNumeric; private System.Windows.Forms.NumericUpDown yNumeric; private RotationBox Rotation; } }
Java
/* * Copyright (C) 2005-2013 Junjiro R. Okajima * * This program, aufs 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, see <http://www.gnu.org/licenses/>. */ /* * all header files */ #ifndef __AUFS_H__ #define __AUFS_H__ #ifdef __KERNEL__ #define AuStub(type, name, body, ...) \ static inline type name(__VA_ARGS__) { body; } #define AuStubVoid(name, ...) \ AuStub(void, name, , __VA_ARGS__) #define AuStubInt0(name, ...) \ AuStub(int, name, return 0, __VA_ARGS__) #include "debug.h" #include "branch.h" #include "cpup.h" #include "dcsub.h" #include "dbgaufs.h" #include "dentry.h" #include "dir.h" #include "dynop.h" #include "file.h" #include "fstype.h" #include "inode.h" #include "loop.h" #include "module.h" #include "opts.h" #include "rwsem.h" #include "spl.h" #include "super.h" #include "sysaufs.h" #include "vfsub.h" #include "whout.h" #include "wkq.h" #endif /* __KERNEL__ */ #endif /* __AUFS_H__ */
Java
/* * RapidMiner * * Copyright (C) 2001-2008 by Rapid-I and the contributors * * Complete list of developers available at our web site: * * http://rapid-i.com * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see http://www.gnu.org/licenses/. */ package com.rapidminer.operator.similarity; import java.util.Iterator; import com.rapidminer.example.Attribute; import com.rapidminer.example.Attributes; import com.rapidminer.example.Example; import com.rapidminer.example.ExampleSet; import com.rapidminer.example.SimpleAttributes; import com.rapidminer.example.set.AbstractExampleReader; import com.rapidminer.example.set.AbstractExampleSet; import com.rapidminer.example.set.MappedExampleSet; import com.rapidminer.example.table.AttributeFactory; import com.rapidminer.example.table.DoubleArrayDataRow; import com.rapidminer.example.table.ExampleTable; import com.rapidminer.example.table.NominalMapping; import com.rapidminer.tools.Ontology; import com.rapidminer.tools.math.similarity.DistanceMeasure; /** * This similarity based example set is used for the operator * {@link ExampleSet2SimilarityExampleSet}. * * @author Ingo Mierswa * @version $Id: SimilarityExampleSet.java,v 1.1 2008/09/08 18:53:49 ingomierswa Exp $ */ public class SimilarityExampleSet extends AbstractExampleSet { private static final long serialVersionUID = 4757975818441794105L; private static class IndexExampleReader extends AbstractExampleReader { private int index = 0; private ExampleSet exampleSet; public IndexExampleReader(ExampleSet exampleSet) { this.exampleSet = exampleSet; } public boolean hasNext() { return index < exampleSet.size() - 1; } public Example next() { Example example = exampleSet.getExample(index); index++; return example; } } private ExampleSet parent; private Attribute parentIdAttribute; private Attributes attributes; private DistanceMeasure measure; public SimilarityExampleSet(ExampleSet parent, DistanceMeasure measure) { this.parent = parent; this.parentIdAttribute = parent.getAttributes().getId(); this.attributes = new SimpleAttributes(); Attribute firstIdAttribute = null; Attribute secondIdAttribute = null; if (parentIdAttribute.isNominal()) { firstIdAttribute = AttributeFactory.createAttribute("FIRST_ID", Ontology.NOMINAL); secondIdAttribute = AttributeFactory.createAttribute("SECOND_ID", Ontology.NOMINAL); } else { firstIdAttribute = AttributeFactory.createAttribute("FIRST_ID", Ontology.NUMERICAL); secondIdAttribute = AttributeFactory.createAttribute("SECOND_ID", Ontology.NUMERICAL); } this.attributes.addRegular(firstIdAttribute); this.attributes.addRegular(secondIdAttribute); firstIdAttribute.setTableIndex(0); secondIdAttribute.setTableIndex(1); // copying mapping of original id attribute if (parentIdAttribute.isNominal()) { NominalMapping mapping = parentIdAttribute.getMapping(); firstIdAttribute.setMapping(mapping); secondIdAttribute.setMapping(mapping); } String name = "SIMILARITY"; if (measure.isDistance()) { name = "DISTANCE"; } Attribute similarityAttribute = AttributeFactory.createAttribute(name, Ontology.REAL); this.attributes.addRegular(similarityAttribute); similarityAttribute.setTableIndex(2); this.measure = measure; } public boolean equals(Object o) { if (!super.equals(o)) return false; if (!(o instanceof MappedExampleSet)) return false; SimilarityExampleSet other = (SimilarityExampleSet)o; if (!this.measure.getClass().equals(other.measure.getClass())) return false; return true; } public int hashCode() { return super.hashCode() ^ this.measure.getClass().hashCode(); } public Attributes getAttributes() { return this.attributes; } public Example getExample(int index) { int firstIndex = index / this.parent.size(); int secondIndex = index % this.parent.size(); Example firstExample = this.parent.getExample(firstIndex); Example secondExample = this.parent.getExample(secondIndex); double[] data = new double[3]; data[0] = firstExample.getValue(parentIdAttribute); data[1] = secondExample.getValue(parentIdAttribute); if (measure.isDistance()) data[2] = measure.calculateDistance(firstExample, secondExample); else data[2] = measure.calculateSimilarity(firstExample, secondExample); return new Example(new DoubleArrayDataRow(data), this); } public Iterator<Example> iterator() { return new IndexExampleReader(this); } public ExampleTable getExampleTable() { return null;//this.parent.getExampleTable(); } public int size() { return this.parent.size() * this.parent.size(); } }
Java
<?php // // ZoneMinder web action file // Copyright (C) 2019 ZoneMinder LLC // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // // Event scope actions, view permissions only required if ( !canView('Events') ) { ZM\Warning('You do not have permission to view Events.'); return; } if ( isset($_REQUEST['object']) and ( $_REQUEST['object'] == 'filter' ) ) { if ( $action == 'addterm' ) { $_REQUEST['filter'] = addFilterTerm($_REQUEST['filter'], $_REQUEST['line']); } elseif ( $action == 'delterm' ) { $_REQUEST['filter'] = delFilterTerm($_REQUEST['filter'], $_REQUEST['line']); } else if ( canEdit('Events') ) { require_once('includes/Filter.php'); $filter = new ZM\Filter($_REQUEST['Id']); if ( $action == 'delete' ) { if ( !empty($_REQUEST['Id']) ) { if ( $filter->Background() ) { $filter->control('stop'); } $filter->delete(); } else { ZM\Error('No filter id passed when deleting'); } } else if ( ( $action == 'Save' ) or ( $action == 'SaveAs' ) or ( $action == 'execute' ) ) { $sql = ''; $_REQUEST['filter']['Query']['sort_field'] = validStr($_REQUEST['filter']['Query']['sort_field']); $_REQUEST['filter']['Query']['sort_asc'] = validStr($_REQUEST['filter']['Query']['sort_asc']); $_REQUEST['filter']['Query']['limit'] = validInt($_REQUEST['filter']['Query']['limit']); $_REQUEST['filter']['AutoCopy'] = empty($_REQUEST['filter']['AutoCopy']) ? 0 : 1; $_REQUEST['filter']['AutoMove'] = empty($_REQUEST['filter']['AutoMove']) ? 0 : 1; $_REQUEST['filter']['AutoArchive'] = empty($_REQUEST['filter']['AutoArchive']) ? 0 : 1; $_REQUEST['filter']['AutoVideo'] = empty($_REQUEST['filter']['AutoVideo']) ? 0 : 1; $_REQUEST['filter']['AutoUpload'] = empty($_REQUEST['filter']['AutoUpload']) ? 0 : 1; $_REQUEST['filter']['AutoEmail'] = empty($_REQUEST['filter']['AutoEmail']) ? 0 : 1; $_REQUEST['filter']['AutoMessage'] = empty($_REQUEST['filter']['AutoMessage']) ? 0 : 1; $_REQUEST['filter']['AutoExecute'] = empty($_REQUEST['filter']['AutoExecute']) ? 0 : 1; $_REQUEST['filter']['AutoDelete'] = empty($_REQUEST['filter']['AutoDelete']) ? 0 : 1; $_REQUEST['filter']['UpdateDiskSpace'] = empty($_REQUEST['filter']['UpdateDiskSpace']) ? 0 : 1; $_REQUEST['filter']['Background'] = empty($_REQUEST['filter']['Background']) ? 0 : 1; $_REQUEST['filter']['Concurrent'] = empty($_REQUEST['filter']['Concurrent']) ? 0 : 1; $changes = $filter->changes($_REQUEST['filter']); ZM\Logger::Debug('Changes: ' . print_r($changes,true)); if ( $_REQUEST['Id'] and ( $action == 'Save' ) ) { if ( $filter->Background() ) $filter->control('stop'); $filter->save($changes); } else { if ( $action == 'execute' ) { if ( count($changes) ) { $filter->Name('_TempFilter'.time()); $filter->Id(null); } } else if ( $action == 'SaveAs' ) { $filter->Id(null); } $filter->save($changes); // We update the request id so that the newly saved filter is auto-selected $_REQUEST['Id'] = $filter->Id(); } if ( $action == 'execute' ) { $filter->execute(); if ( count($changes) ) $filter->delete(); $view = 'events'; } else if ( $filter->Background() ) { $filter->control('start'); } $redirect = '?view=filter&Id='.$filter->Id(); } else if ( $action == 'control' ) { if ( $_REQUEST['command'] == 'start' or $_REQUEST['command'] == 'stop' or $_REQUEST['command'] == 'restart' ) { $filter->control($_REQUEST['command'], $_REQUEST['ServerId']); } else { ZM\Error('Invalid command for filter ('.$_REQUEST['command'].')'); } } // end if save or execute } // end if canEdit(Events) } // end if object == filter ?>
Java
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager system settings service * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Copyright (C) 2007 - 2011 Red Hat, Inc. * Copyright (C) 2008 Novell, Inc. */ #ifndef NM_SYSTEM_CONFIG_INTERFACE_H #define NM_SYSTEM_CONFIG_INTERFACE_H #include <glib.h> #include <glib-object.h> #include <nm-connection.h> #include <nm-settings-connection.h> G_BEGIN_DECLS #define PLUGIN_PRINT(pname, fmt, args...) \ { g_message (" " pname ": " fmt, ##args); } #define PLUGIN_WARN(pname, fmt, args...) \ { g_warning (" " pname ": " fmt, ##args); } /* Plugin's factory function that returns a GObject that implements * NMSystemConfigInterface. */ GObject * nm_system_config_factory (void); #define NM_TYPE_SYSTEM_CONFIG_INTERFACE (nm_system_config_interface_get_type ()) #define NM_SYSTEM_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE, NMSystemConfigInterface)) #define NM_IS_SYSTEM_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE)) #define NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE, NMSystemConfigInterface)) #define NM_SYSTEM_CONFIG_INTERFACE_NAME "name" #define NM_SYSTEM_CONFIG_INTERFACE_INFO "info" #define NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES "capabilities" #define NM_SYSTEM_CONFIG_INTERFACE_HOSTNAME "hostname" #define NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED "unmanaged-specs-changed" #define NM_SYSTEM_CONFIG_INTERFACE_UNRECOGNIZED_SPECS_CHANGED "unrecognized-specs-changed" #define NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED "connection-added" typedef enum { NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE = 0x00000000, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS = 0x00000001, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_HOSTNAME = 0x00000002 /* When adding more capabilities, be sure to update the "Capabilities" * property max value in nm-system-config-interface.c. */ } NMSystemConfigInterfaceCapabilities; typedef enum { NM_SYSTEM_CONFIG_INTERFACE_PROP_FIRST = 0x1000, NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME = NM_SYSTEM_CONFIG_INTERFACE_PROP_FIRST, NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO, NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES, NM_SYSTEM_CONFIG_INTERFACE_PROP_HOSTNAME, } NMSystemConfigInterfaceProp; typedef struct _NMSystemConfigInterface NMSystemConfigInterface; struct _NMSystemConfigInterface { GTypeInterface g_iface; /* Called when the plugin is loaded to initialize it */ void (*init) (NMSystemConfigInterface *config); /* Returns a GSList of NMSettingsConnection objects that represent * connections the plugin knows about. The returned list is freed by the * system settings service. */ GSList * (*get_connections) (NMSystemConfigInterface *config); /* Requests that the plugin load/reload a single connection, if it * recognizes the filename. Returns success or failure. */ gboolean (*load_connection) (NMSystemConfigInterface *config, const char *filename); /* Requests that the plugin reload all connection files from disk, * and emit signals reflecting new, changed, and removed connections. */ void (*reload_connections) (NMSystemConfigInterface *config); /* * Return a string list of specifications of devices which NetworkManager * should not manage. Returned list will be freed by the system settings * service, and each element must be allocated using g_malloc() or its * variants (g_strdup, g_strdup_printf, etc). * * Each string in the list must be in one of the formats recognized by * nm_device_spec_match_list(). */ GSList * (*get_unmanaged_specs) (NMSystemConfigInterface *config); /* * Return a string list of specifications of devices for which at least * one non-NetworkManager-based configuration is defined. Returned list * will be freed by the system settings service, and each element must be * allocated using g_malloc() or its variants (g_strdup, g_strdup_printf, * etc). * * Each string in the list must be in one of the formats recognized by * nm_device_spec_match_list(). */ GSList * (*get_unrecognized_specs) (NMSystemConfigInterface *config); /* * Initialize the plugin-specific connection and return a new * NMSettingsConnection subclass that contains the same settings as the * original connection. The connection should only be saved to backing * storage if @save_to_disk is TRUE. The returned object is owned by the * plugin and must be referenced by the owner if necessary. */ NMSettingsConnection * (*add_connection) (NMSystemConfigInterface *config, NMConnection *connection, gboolean save_to_disk, GError **error); /* Signals */ /* Emitted when a new connection has been found by the plugin */ void (*connection_added) (NMSystemConfigInterface *config, NMSettingsConnection *connection); /* Emitted when the list of unmanaged device specifications changes */ void (*unmanaged_specs_changed) (NMSystemConfigInterface *config); /* Emitted when the list of devices with unrecognized connections changes */ void (*unrecognized_specs_changed) (NMSystemConfigInterface *config); }; GType nm_system_config_interface_get_type (void); void nm_system_config_interface_init (NMSystemConfigInterface *config, gpointer unused); GSList *nm_system_config_interface_get_connections (NMSystemConfigInterface *config); gboolean nm_system_config_interface_load_connection (NMSystemConfigInterface *config, const char *filename); void nm_system_config_interface_reload_connections (NMSystemConfigInterface *config); GSList *nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config); GSList *nm_system_config_interface_get_unrecognized_specs (NMSystemConfigInterface *config); NMSettingsConnection *nm_system_config_interface_add_connection (NMSystemConfigInterface *config, NMConnection *connection, gboolean save_to_disk, GError **error); G_END_DECLS #endif /* NM_SYSTEM_CONFIG_INTERFACE_H */
Java
/* * 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. */ #ifndef __STACKMAP6_H__ #define __STACKMAP6_H__ #include <stdlib.h> #include <string.h> #include <assert.h> #include "../base/stackmap_x.h" //Constant for parsing StackMapTable attribute enum StackMapTableItems { ITEM_TOP = 0, ITEM_INTEGER = 1, ITEM_FLOAT = 2, ITEM_DOUBLE = 3, ITEM_LONG = 4, ITEM_NULL = 5, ITEM_UNINITIALIZEDTHIS = 6, ITEM_OBJECT = 7, ITEM_UNINITIALIZED = 8 }; //StackMapElement structure represens recorded verification types //it's read from class file StackMapTable attribute struct StackmapElement_6 { //list of IncomingType constraint _SmConstant const_val; }; //WorkMapElement structure represent an element of the workmap vector -- vector of the derived types //in Java6 verification type might be constant (or known) only struct WorkmapElement_6 { //the value _SmConstant const_val; //either a constant (known-type) //// Java5 anachonisms //// void setJsrModified() {}; int isJsrModified() { return 1;}; SmConstant getAnyPossibleValue() { return const_val; } SmConstant getConst() { return const_val; } }; //WorkmapElement type with some constructors struct _WorkmapElement_6 : WorkmapElement_6 { _WorkmapElement_6(WorkmapElement_6 other) { const_val = other.const_val; } _WorkmapElement_6(SmConstant c) { const_val = c; } }; //Store stackmap data for the given instruction // the list is used to organize storing Props as a HashTable struct PropsHead_6 : public PropsHeadBase { typedef MapHead<StackmapElement_6> StackmapHead; //possible properties StackmapHead stackmap; //get stackmap stored here StackmapHead *getStackmap() { return &stackmap; } }; #endif
Java
/* * Copyright (C) 2011-2012 Team XBMC * http://xbmc.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, 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 XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include "CoreAudioDevice.h" #include "CoreAudioAEHAL.h" #include "CoreAudioChannelLayout.h" #include "CoreAudioHardware.h" #include "utils/log.h" ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CCoreAudioDevice ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CCoreAudioDevice::CCoreAudioDevice() : m_Started (false ), m_pSource (NULL ), m_DeviceId (0 ), m_MixerRestore (-1 ), m_IoProc (NULL ), m_ObjectListenerProc (NULL ), m_SampleRateRestore (0.0f ), m_HogPid (-1 ), m_frameSize (0 ), m_OutputBufferIndex (0 ), m_BufferSizeRestore (0 ) { } CCoreAudioDevice::CCoreAudioDevice(AudioDeviceID deviceId) : m_Started (false ), m_pSource (NULL ), m_DeviceId (deviceId ), m_MixerRestore (-1 ), m_IoProc (NULL ), m_ObjectListenerProc (NULL ), m_SampleRateRestore (0.0f ), m_HogPid (-1 ), m_frameSize (0 ), m_OutputBufferIndex (0 ), m_BufferSizeRestore (0 ) { } CCoreAudioDevice::~CCoreAudioDevice() { Close(); } bool CCoreAudioDevice::Open(AudioDeviceID deviceId) { m_DeviceId = deviceId; m_BufferSizeRestore = GetBufferSize(); return true; } void CCoreAudioDevice::Close() { if (!m_DeviceId) return; // Stop the device if it was started Stop(); // Unregister the IOProc if we have one if (m_IoProc) SetInputSource(NULL, 0, 0); SetHogStatus(false); CCoreAudioHardware::SetAutoHogMode(false); if (m_MixerRestore > -1) // We changed the mixer status SetMixingSupport((m_MixerRestore ? true : false)); m_MixerRestore = -1; if (m_SampleRateRestore != 0.0f) SetNominalSampleRate(m_SampleRateRestore); if (m_BufferSizeRestore && m_BufferSizeRestore != GetBufferSize()) { SetBufferSize(m_BufferSizeRestore); m_BufferSizeRestore = 0; } m_IoProc = NULL; m_pSource = NULL; m_DeviceId = 0; m_ObjectListenerProc = NULL; } void CCoreAudioDevice::Start() { if (!m_DeviceId || m_Started) return; OSStatus ret = AudioDeviceStart(m_DeviceId, m_IoProc); if (ret) CLog::Log(LOGERROR, "CCoreAudioDevice::Start: " "Unable to start device. Error = %s", GetError(ret).c_str()); else m_Started = true; } void CCoreAudioDevice::Stop() { if (!m_DeviceId || !m_Started) return; OSStatus ret = AudioDeviceStop(m_DeviceId, m_IoProc); if (ret) CLog::Log(LOGERROR, "CCoreAudioDevice::Stop: " "Unable to stop device. Error = %s", GetError(ret).c_str()); m_Started = false; } void CCoreAudioDevice::RemoveObjectListenerProc(AudioObjectPropertyListenerProc callback, void* pClientData) { if (!m_DeviceId) return; AudioObjectPropertyAddress audioProperty; audioProperty.mSelector = kAudioObjectPropertySelectorWildcard; audioProperty.mScope = kAudioObjectPropertyScopeWildcard; audioProperty.mElement = kAudioObjectPropertyElementWildcard; OSStatus ret = AudioObjectRemovePropertyListener(m_DeviceId, &audioProperty, callback, pClientData); if (ret) { CLog::Log(LOGERROR, "CCoreAudioDevice::RemoveObjectListenerProc: " "Unable to set ObjectListener callback. Error = %s", GetError(ret).c_str()); } m_ObjectListenerProc = NULL; } bool CCoreAudioDevice::SetObjectListenerProc(AudioObjectPropertyListenerProc callback, void* pClientData) { // Allow only one ObjectListener at a time if (!m_DeviceId || m_ObjectListenerProc) return false; AudioObjectPropertyAddress audioProperty; audioProperty.mSelector = kAudioObjectPropertySelectorWildcard; audioProperty.mScope = kAudioObjectPropertyScopeWildcard; audioProperty.mElement = kAudioObjectPropertyElementWildcard; OSStatus ret = AudioObjectAddPropertyListener(m_DeviceId, &audioProperty, callback, pClientData); if (ret) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetObjectListenerProc: " "Unable to remove ObjectListener callback. Error = %s", GetError(ret).c_str()); return false; } m_ObjectListenerProc = callback; return true; } bool CCoreAudioDevice::SetInputSource(ICoreAudioSource* pSource, unsigned int frameSize, unsigned int outputBufferIndex) { m_pSource = pSource; m_frameSize = frameSize; m_OutputBufferIndex = outputBufferIndex; if (pSource) return AddIOProc(); else return RemoveIOProc(); } bool CCoreAudioDevice::AddIOProc() { // Allow only one IOProc at a time if (!m_DeviceId || m_IoProc) return false; OSStatus ret = AudioDeviceCreateIOProcID(m_DeviceId, DirectRenderCallback, this, &m_IoProc); if (ret) { CLog::Log(LOGERROR, "CCoreAudioDevice::AddIOProc: " "Unable to add IOProc. Error = %s", GetError(ret).c_str()); m_IoProc = NULL; return false; } Start(); return true; } bool CCoreAudioDevice::RemoveIOProc() { if (!m_DeviceId || !m_IoProc) return false; Stop(); OSStatus ret = AudioDeviceDestroyIOProcID(m_DeviceId, m_IoProc); if (ret) CLog::Log(LOGERROR, "CCoreAudioDevice::RemoveIOProc: " "Unable to remove IOProc. Error = %s", GetError(ret).c_str()); m_IoProc = NULL; // Clear the reference no matter what m_pSource = NULL; Sleep(100); return true; } std::string CCoreAudioDevice::GetName() { if (!m_DeviceId) return NULL; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyDeviceName; UInt32 propertySize; OSStatus ret = AudioObjectGetPropertyDataSize(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret != noErr) return NULL; std::string name = ""; char *buff = new char[propertySize + 1]; buff[propertySize] = 0x00; ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, buff); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::GetName: " "Unable to get device name - id: 0x%04x. Error = %s", (uint)m_DeviceId, GetError(ret).c_str()); } else { name = buff; } delete buff; return name; } UInt32 CCoreAudioDevice::GetTotalOutputChannels() { UInt32 channels = 0; if (!m_DeviceId) return channels; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyStreamConfiguration; UInt32 size = 0; OSStatus ret = AudioObjectGetPropertyDataSize(m_DeviceId, &propertyAddress, 0, NULL, &size); if (ret != noErr) return channels; AudioBufferList* pList = (AudioBufferList*)malloc(size); ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &size, pList); if (ret == noErr) { for(UInt32 buffer = 0; buffer < pList->mNumberBuffers; ++buffer) channels += pList->mBuffers[buffer].mNumberChannels; } else { CLog::Log(LOGERROR, "CCoreAudioDevice::GetTotalOutputChannels: " "Unable to get total device output channels - id: 0x%04x. Error = %s", (uint)m_DeviceId, GetError(ret).c_str()); } free(pList); return channels; } bool CCoreAudioDevice::GetStreams(AudioStreamIdList* pList) { if (!pList || !m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyStreams; UInt32 propertySize = 0; OSStatus ret = AudioObjectGetPropertyDataSize(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret != noErr) return false; UInt32 streamCount = propertySize / sizeof(AudioStreamID); AudioStreamID* pStreamList = new AudioStreamID[streamCount]; ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, pStreamList); if (ret == noErr) { for (UInt32 stream = 0; stream < streamCount; stream++) pList->push_back(pStreamList[stream]); } delete[] pStreamList; return ret == noErr; } bool CCoreAudioDevice::IsRunning() { AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyDeviceIsRunning; UInt32 isRunning = 0; UInt32 propertySize = sizeof(isRunning); OSStatus ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, &isRunning); if (ret != noErr) return false; return isRunning != 0; } bool CCoreAudioDevice::SetHogStatus(bool hog) { // According to Jeff Moore (Core Audio, Apple), Setting kAudioDevicePropertyHogMode // is a toggle and the only way to tell if you do get hog mode is to compare // the returned pid against getpid, if the match, you have hog mode, if not you don't. if (!m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyHogMode; if (hog) { // Not already set if (m_HogPid == -1) { OSStatus ret = AudioObjectSetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, sizeof(m_HogPid), &m_HogPid); // even if setting hogmode was successfull our PID might not get written // into m_HogPid (so it stays -1). Readback hogstatus for judging if we // had success on getting hog status m_HogPid = GetHogStatus(); if (ret || m_HogPid != getpid()) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetHogStatus: " "Unable to set 'hog' status. Error = %s", GetError(ret).c_str()); return false; } } } else { // Currently Set if (m_HogPid > -1) { pid_t hogPid = -1; OSStatus ret = AudioObjectSetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, sizeof(hogPid), &hogPid); if (ret || hogPid == getpid()) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetHogStatus: " "Unable to release 'hog' status. Error = %s", GetError(ret).c_str()); return false; } // Reset internal state m_HogPid = hogPid; } } return true; } pid_t CCoreAudioDevice::GetHogStatus() { if (!m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyHogMode; pid_t hogPid = -1; UInt32 size = sizeof(hogPid); AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &size, &hogPid); return hogPid; } bool CCoreAudioDevice::SetMixingSupport(UInt32 mix) { if (!m_DeviceId) return false; if (!GetMixingSupport()) return false; int restore = -1; if (m_MixerRestore == -1) { // This is our first change to this setting. Store the original setting for restore restore = (GetMixingSupport() ? 1 : 0); } AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertySupportsMixing; UInt32 mixEnable = mix ? 1 : 0; OSStatus ret = AudioObjectSetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, sizeof(mixEnable), &mixEnable); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetMixingSupport: " "Unable to set MixingSupport to %s. Error = %s", mix ? "'On'" : "'Off'", GetError(ret).c_str()); return false; } if (m_MixerRestore == -1) m_MixerRestore = restore; return true; } bool CCoreAudioDevice::GetMixingSupport() { if (!m_DeviceId) return false; UInt32 size; UInt32 mix = 0; Boolean writable = false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertySupportsMixing; if( AudioObjectHasProperty( m_DeviceId, &propertyAddress ) ) { OSStatus ret = AudioObjectIsPropertySettable(m_DeviceId, &propertyAddress, &writable); if (ret) { CLog::Log(LOGERROR, "CCoreAudioDevice::SupportsMixing: " "Unable to get propertyinfo mixing support. Error = %s", GetError(ret).c_str()); writable = false; } if (writable) { size = sizeof(mix); ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &size, &mix); if (ret != noErr) mix = 0; } } CLog::Log(LOGERROR, "CCoreAudioDevice::SupportsMixing: " "Device mixing support : %s.", mix ? "'Yes'" : "'No'"); return (mix > 0); } bool CCoreAudioDevice::SetCurrentVolume(Float32 vol) { if (!m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kHALOutputParam_Volume; OSStatus ret = AudioObjectSetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, sizeof(Float32), &vol); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetCurrentVolume: " "Unable to set AudioUnit volume. Error = %s", GetError(ret).c_str()); return false; } return true; } bool CCoreAudioDevice::GetPreferredChannelLayout(CCoreAudioChannelLayout& layout) { if (!m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyPreferredChannelLayout; UInt32 propertySize = 0; OSStatus ret = AudioObjectGetPropertyDataSize(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret) return false; void* pBuf = malloc(propertySize); ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, pBuf); if (ret != noErr) CLog::Log(LOGERROR, "CCoreAudioDevice::GetPreferredChannelLayout: " "Unable to retrieve preferred channel layout. Error = %s", GetError(ret).c_str()); else { // Copy the result into the caller's instance layout.CopyLayout(*((AudioChannelLayout*)pBuf)); } free(pBuf); return (ret == noErr); } bool CCoreAudioDevice::GetDataSources(CoreAudioDataSourceList* pList) { if (!pList || !m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyDataSources; UInt32 propertySize = 0; OSStatus ret = AudioObjectGetPropertyDataSize(m_DeviceId, &propertyAddress, 0, NULL, &propertySize); if (ret != noErr) return false; UInt32 sources = propertySize / sizeof(UInt32); UInt32* pSources = new UInt32[sources]; ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, pSources); if (ret == noErr) { for (UInt32 i = 0; i < sources; i++) pList->push_back(pSources[i]); } delete[] pSources; return (!ret); } Float64 CCoreAudioDevice::GetNominalSampleRate() { if (!m_DeviceId) return 0.0f; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyNominalSampleRate; Float64 sampleRate = 0.0f; UInt32 propertySize = sizeof(Float64); OSStatus ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, &sampleRate); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::GetNominalSampleRate: " "Unable to retrieve current device sample rate. Error = %s", GetError(ret).c_str()); return 0.0f; } return sampleRate; } bool CCoreAudioDevice::SetNominalSampleRate(Float64 sampleRate) { if (!m_DeviceId || sampleRate == 0.0f) return false; Float64 currentRate = GetNominalSampleRate(); if (currentRate == sampleRate) return true; //No need to change AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyNominalSampleRate; OSStatus ret = AudioObjectSetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, sizeof(Float64), &sampleRate); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetNominalSampleRate: " "Unable to set current device sample rate to %0.0f. Error = %s", (float)sampleRate, GetError(ret).c_str()); return false; } if (m_SampleRateRestore == 0.0f) m_SampleRateRestore = currentRate; return true; } UInt32 CCoreAudioDevice::GetNumLatencyFrames() { UInt32 num_latency_frames = 0; if (!m_DeviceId) return 0; // number of frames of latency in the AudioDevice AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyLatency; UInt32 i_param = 0; UInt32 i_param_size = sizeof(uint32_t); OSStatus ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &i_param_size, &i_param); if (ret == noErr) num_latency_frames += i_param; // number of frames in the IO buffers propertyAddress.mSelector = kAudioDevicePropertyBufferFrameSize; ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &i_param_size, &i_param); if (ret == noErr) num_latency_frames += i_param; // number for frames in ahead the current hardware position that is safe to do IO propertyAddress.mSelector = kAudioDevicePropertySafetyOffset; ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &i_param_size, &i_param); if (ret == noErr) num_latency_frames += i_param; return (num_latency_frames); } UInt32 CCoreAudioDevice::GetBufferSize() { if (!m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyBufferFrameSize; UInt32 size = 0; UInt32 propertySize = sizeof(size); OSStatus ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, &size); if (ret != noErr) CLog::Log(LOGERROR, "CCoreAudioDevice::GetBufferSize: " "Unable to retrieve buffer size. Error = %s", GetError(ret).c_str()); return size; } bool CCoreAudioDevice::SetBufferSize(UInt32 size) { if (!m_DeviceId) return false; AudioObjectPropertyAddress propertyAddress; propertyAddress.mScope = kAudioDevicePropertyScopeOutput; propertyAddress.mElement = 0; propertyAddress.mSelector = kAudioDevicePropertyBufferFrameSize; UInt32 propertySize = sizeof(size); OSStatus ret = AudioObjectSetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, propertySize, &size); if (ret != noErr) { CLog::Log(LOGERROR, "CCoreAudioDevice::SetBufferSize: " "Unable to set buffer size. Error = %s", GetError(ret).c_str()); } if (GetBufferSize() != size) CLog::Log(LOGERROR, "CCoreAudioDevice::SetBufferSize: Buffer size change not applied."); return (ret == noErr); } OSStatus CCoreAudioDevice::DirectRenderCallback(AudioDeviceID inDevice, const AudioTimeStamp *inNow, const AudioBufferList *inInputData, const AudioTimeStamp *inInputTime, AudioBufferList *outOutputData, const AudioTimeStamp *inOutputTime, void *inClientData) { OSStatus ret = noErr; CCoreAudioDevice *audioDevice = (CCoreAudioDevice*)inClientData; if (audioDevice->m_pSource && audioDevice->m_frameSize) { UInt32 frames = outOutputData->mBuffers[audioDevice->m_OutputBufferIndex].mDataByteSize / audioDevice->m_frameSize; ret = audioDevice->m_pSource->Render(NULL, inInputTime, 0, frames, outOutputData); } else { outOutputData->mBuffers[audioDevice->m_OutputBufferIndex].mDataByteSize = 0; } return ret; }
Java
<?php /** * Write users to file * @param string $filename * @param array $array_data * @return null */ // function insert($user,$config) function readUser($id, $config) { switch ($config['adapter']) { case 'txt': include_once('file/users.php'); $user=readUserFromFile($id, $config); return $users; break; case 'mysql': include_once('mysql/users.php'); $users = select($id,$config); return $users; break; case 'googledocs': include_once('googledocs/users.php'); $users = selectAll($config); return $users; break; } } function update($user, $id, $config) { switch ($config['adapter']) { case 'txt': include_once('file/users.php'); updateUserTofile($id, $user, $user['filename'], $config); return; break; case 'mysql': include_once('mysql/users.php'); $users = updateUser($id, $user, $config); return $users; break; case 'googledocs': include_once('googledocs/users.php'); $users = selectAll($config); return $users; break; } } // function select($id, $config) function readUsers($config) { switch ($config['adapter']) { case 'txt': include_once('file/users.php'); $users=readUsersFromFile($config); return $users; break; case 'mysql': include_once('mysql/users.php'); $users = selectAll($config); return $users; break; case 'googledocs': include_once('googledocs/users.php'); $users = selectAll($config); return $users; break; } } // function delete($id, $config)
Java
ace_comment { color: #a86; } ace_keyword { line-height: 1em; font-weight: bold; color: blue; } ace_string { color: #a22; } ace_builtin { line-height: 1em; font-weight: bold; color: #077; } ace_special { line-height: 1em; font-weight: bold; color: #0aa; } ace_variable { color: black; } ace_number, ace_atom { color: #3a3; } ace_meta { color: #555; } ace_link { color: #3a3; } ace_activeline-background { background: #e8f2ff; } ace_matchingbracket { outline:1px solid grey; color:black !important; }
Java
/** * yamsLog is a program for real time multi sensor logging and * supervision * Copyright (C) 2014 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import Database.Messages.ProjectMetaData; import Database.Sensors.Sensor; import Errors.BackendError; import FrontendConnection.Backend; import FrontendConnection.Listeners.ProjectCreationStatusListener; import protobuf.Protocol; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * Created with IntelliJ IDEA. * User: Aitesh * Date: 2014-04-10 * Time: 09:34 * To change this template use File | Settings | File Templates. */ public class NewDebugger implements ProjectCreationStatusListener { private boolean projectListChanged; public NewDebugger(){ try{ Backend.createInstance(null); //args[0],Integer.parseInt(args[1]), Backend.getInstance().addProjectCreationStatusListener(this); Backend.getInstance().connectToServer("130.236.63.46",2001); } catch (BackendError b){ b.printStackTrace(); } projectListChanged = false; } private synchronized boolean readWriteBoolean(Boolean b){ if(b!=null) projectListChanged=b; return projectListChanged; } public void runPlayback() { try{ Thread.sleep(1000); //Backend.getInstance().sendSettingsRequestMessageALlSensors(0); readWriteBoolean(false); Random r = new Random(); String[] strings = new String[]{"Name","Code","File","Today","Monday","Tuesday","Wednesday","Thursday","Friday","Gotta","Get","Out","It","S","Friday"}; String project = "projectName" +r.nextInt()%10000; String playbackProject = "realCollection"; Thread.sleep(1000); System.out.println("Setting active project to : " + playbackProject); Backend.getInstance().setActiveProject(playbackProject); ProjectMetaData d = new ProjectMetaData(); d.setTest_leader("ffu"); d.setDate(1l); List<String> s = new ArrayList<String>(); s.add("memer1"); d.setMember_names(s); d.setTags(s); d.setDescription("desc"); List l = d.getMember_names(); l.add(r.nextInt()+". name"); d.setMember_names(l); Backend.getInstance().sendProjectMetaData(d); System.out.println("starting data collection"); Thread.sleep(100); String experimentName = "smallrun"; //Backend.getInstance().setActiveProject(playbackProject); // projektnamn: Thread.sleep(3000); // Backend.getInstance().getSensorConfigurationForPlayback().getSensorId(); List<Protocol.SensorConfiguration> playbackConfig; playbackConfig = Backend.getInstance().getSensorConfigurationForPlayback(); List<Integer> listOfIds = new ArrayList<Integer>(); /* for (Protocol.SensorConfiguration aPlaybackConfig : playbackConfig) { listOfIds.add(aPlaybackConfig.getSensorId()); }*/ System.out.println("LIST OF IDS SENT TO SERVER-------------------------------------------"); System.out.println(listOfIds); System.out.println("LIST OF IDS END -----------------------------------------------------"); System.out.println("LIST OF IDS CURRENTLY IN DATABASE -----------------------------------"); System.out.println(Backend.getInstance().getSensors()); System.out.println("LIST IN DATABASE END ------------------------------------------------"); Backend.getInstance().sendExperimentPlaybackRequest(experimentName, listOfIds); //Thread.sleep(3000); //Backend.getInstance().stopConnection(); } catch (BackendError b){ b.printStackTrace(); } catch (InterruptedException ignore){ } } public void run(){ try{ Thread.sleep(1000); Backend.getInstance().sendSettingsRequestMessageALlSensors(0); readWriteBoolean(false); Random r = new Random(); String[] strings = new String[]{"Name","Code","File","Today","Monday","Tuesday","Wednesday","Thursday","Friday","Gotta","Get","Out","It","S","Friday"}; String project = "projectName" +r.nextInt()%10000; String playbackProject = "realCollection"; for(int i = 0; i < 1000; i++){ // project+=strings[r.nextInt(strings.length)]; } //System.out.println(project); //if(r.nextInt()>0) return; Thread.sleep(1000); Backend.getInstance().createNewProjectRequest(project);//"projectName"+ System.currentTimeMillis()); if(!readWriteBoolean(null)){ System.out.println("Waiting on projectListAgain"); while (!readWriteBoolean(null)); System.out.println("finished waiting"); } // = Backend.getInstance().getProjectFilesFromServer().get()); System.out.println("Setting active project to : " + project); Backend.getInstance().setActiveProject(project); ProjectMetaData d = new ProjectMetaData(); //d.setEmail("NotMyEmail@gmail.com"); d.setTest_leader("ffu"); d.setDate(1l); List<String> s = new ArrayList<String>(); s.add("memer1"); d.setMember_names(s); d.setTags(s); d.setDescription("desc"); List l = d.getMember_names(); l.add(r.nextInt() + ". name"); d.setMember_names(l); Backend.getInstance().sendProjectMetaData(d); /* while(!readWriteBoolean(null) && readWriteBoolean(null)){ Backend.getInstance().sendProjectMetaData(d); List<String> f =d.getTags(); f.add(String.valueOf(System.currentTimeMillis())); d.setTags(f); } **/ System.out.println("starting data collection"); Thread.sleep(100); String experimentName = "experimentNam5"+System.currentTimeMillis(); //String experimentName = "smallrun"; // projektnamn: Backend.getInstance().startDataCollection(experimentName); Thread.sleep(3000); Backend.getInstance().stopDataCollection(); Thread.sleep(1); } catch (BackendError b){ b.printStackTrace(); } catch (InterruptedException ignore){ } System.out.println("Exiting"); } public void runTest(){ // try{ // Thread.sleep(1000); Backend.getInstance().sendSettingsRequestMessageALlSensors(0); // Thread.sleep(1000); Backend.getInstance().createNewProjectRequest("projectName"+ System.currentTimeMillis()); // // //Backend.getInstance().startDataCollection("test1234"); // // //Thread.sleep(5000); Backend.getInstance().stopDataCollection(); // Backend localInstance = Backend.getInstance(); // // Sensor sensor = localInstance.getSensors().get(0); // for(int i = 0; i<sensor.getAttributeList(0).size();i++){ // System.out.print(String.format("%f", sensor.getAttributeList(0).get(i).floatValue()).replace(',', '.') + ","); // // System.out.print(sensor.getId() + ","); // for (int j = 1; j < sensor.getAttributesName().length;j++){ // // System.out.print(sensor.getAttributeList(j).get(i).floatValue() + " ,"); // } // System.out.println(); // } // // } catch (BackendError b){ // b.printStackTrace(); // } catch (InterruptedException ignore){} } @Override public void projectCreationStatusChanged(Protocol.CreateNewProjectResponseMsg.ResponseType responseType) { readWriteBoolean(true); } }
Java
using System; using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; namespace CaptainPav.Testing.UI.CodedUI.PageModeling.Wpf { /// <summary> /// Default implementation of a Wpf page model /// </summary> public abstract class WpfPageModelBase<T> : PageModelBase<T> where T : WpfControl { protected readonly WpfWindow parent; protected WpfPageModelBase(WpfWindow bw) { if (null == bw) { throw new ArgumentNullException(nameof(bw)); } this.parent = bw; } protected WpfWindow DocumentWindow => this.parent; } }
Java
/**************************************************************************** * * ViSP, open source Visual Servoing Platform software. * Copyright (C) 2005 - 2019 by Inria. All rights reserved. * * This software 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 the file LICENSE.txt at the root directory of this source * distribution for additional information about the GNU GPL. * * For using ViSP with software that can not be combined with the GNU * GPL, please contact Inria about acquiring a ViSP Professional * Edition License. * * See http://visp.inria.fr for more information. * * This software was developed at: * Inria Rennes - Bretagne Atlantique * Campus Universitaire de Beaulieu * 35042 Rennes Cedex * France * * If you have questions regarding the use of this file, please contact * Inria at visp@inria.fr * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * Description: * Test for Afma 6 dof robot. * * Authors: * Fabien Spindler * *****************************************************************************/ /*! \example testRobotAfma6.cpp Example of a real robot control, the Afma6 robot (cartesian robot, with 6 degrees of freedom). */ #include <visp3/core/vpCameraParameters.h> #include <visp3/core/vpDebug.h> #include <visp3/robot/vpRobotAfma6.h> #include <iostream> #ifdef VISP_HAVE_AFMA6 int main() { try { std::cout << "a test for vpRobotAfma6 class..." << std::endl; vpRobotAfma6 afma6; vpCameraParameters cam; std::cout << "-- Default settings for Afma6 ---" << std::endl; std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; std::cout << "-- Settings associated to the CCMOP tool without distortion ---" << std::endl; afma6.init(vpAfma6::TOOL_CCMOP); std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; std::cout << "-- Settings associated to CCMOP tool with distortion ------" << std::endl; afma6.init(vpAfma6::TOOL_CCMOP, vpCameraParameters::perspectiveProjWithDistortion); std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; std::cout << "-- Settings associated to the gripper tool without distortion ---" << std::endl; afma6.init(vpAfma6::TOOL_GRIPPER); std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; std::cout << "-- Settings associated to gripper tool with distortion ------" << std::endl; afma6.init(vpAfma6::TOOL_GRIPPER, vpCameraParameters::perspectiveProjWithDistortion); std::cout << afma6 << std::endl; afma6.getCameraParameters(cam, 640, 480); std::cout << cam << std::endl; } catch (const vpException &e) { std::cout << "Catch an exception: " << e << std::endl; } return 0; } #else int main() { std::cout << "The real Afma6 robot controller is not available." << std::endl; return 0; } #endif
Java