Add perfomrance check

This commit is contained in:
Miloslav Číž 2020-10-10 16:22:05 +02:00
parent 3f1344e596
commit b3decffc39
2703 changed files with 887878 additions and 0 deletions

View File

@ -1,5 +1,6 @@
general:
- High pitch noise in SDL music AGAIN!
- Refactor.
- Port to OpenDingux.
- Port to some fantasy console?

6
dingux/My_settings.h Normal file
View File

@ -0,0 +1,6 @@
// Pokitto config required by PokittoLib
//#define PROJ_SHOW_FPS_COUNTER
#define PROJ_SCREENMODE 13
#define PROJ_MODE13 1
#define PROJ_ENABLE_SOUND 1

579
dingux/constants.h Normal file
View File

@ -0,0 +1,579 @@
/**
@file constants.h
This file contains definitions of game constants that are not considered
part of game settings and whose change can ffect the game balance and
playability, e.g. physics constants.
by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is
be and remain completely in the public domain forever, available for any use
whatsoever.
*/
#ifndef _SFG_CONSTANTS_H
#define _SFG_CONSTANTS_H
/**
How quickly player moves, in squares per second.
*/
#define SFG_PLAYER_MOVE_SPEED 7
/**
Gravity acceleration in squares / (second^2).
*/
#define SFG_GRAVITY_ACCELERATION 30
/**
Initial upwards speed of player's jump, in squares per second.
*/
#define SFG_PLAYER_JUMP_SPEED 5
/**
Melee and close-up attack range, in RCL_Units.
*/
#define SFG_MELEE_RANGE 1600
/**
When a projectile is shot, it'll be offset by this distance (in RCL_Units)
from the shooter.
*/
#define SFG_PROJECTILE_SPAWN_OFFSET 256
/**
Player's melee hit range, in RCL_Units (RCL_UNITS_PER_SQUARE means full angle,
180 degrees to both sides).
*/
#define SFG_PLAYER_MELEE_ANGLE 512
/**
How quickly elevators and squeezers move, in RCL_Unit per second.
*/
#define SFG_MOVING_WALL_SPEED 1024
/**
How quickly doors open and close, in RCL_Unit per second.
*/
#define SFG_DOOR_OPEN_SPEED 2048
/**
Helper special state value.
*/
#define SFG_CANT_SAVE 255
/**
Says the distance in RCL_Units at which level elements (items, monsters etc.)
are active.
*/
#define SFG_LEVEL_ELEMENT_ACTIVE_DISTANCE (12 * 1024)
/**
Rate at which AI will be updated, which also affects how fast enemies will
appear.
*/
#define SFG_AI_FPS 4
/**
Says a probability (0 - 255) of the AI changing its state during one update
step.
*/
#define SFG_AI_RANDOM_CHANGE_PROBABILITY 40
/**
Distance at which level elements (sprites) collide, in RCL_Unit (1024 per
square).
*/
#define SFG_ELEMENT_COLLISION_RADIUS 1900
/**
Height, in RCL_Units, at which collisions happen with level elements
(sprites).
*/
#define SFG_ELEMENT_COLLISION_HEIGHT 1024
/**
Distance at which explosion does damage and throws away the player and
monsters, in RCL_Units.
*/
#define SFG_EXPLOSION_RADIUS 2048
/**
Distance in RCL_Units which the player is pushed away by an explosion.
*/
#define SFG_EXPLOSION_PUSH_AWAY_DISTANCE 1200
/**
How much damage triggers a barrel explosion.
*/
#define SFG_BARREL_EXPLOSION_DAMAGE_THRESHOLD 3
/**
Maximum player health.
*/
#define SFG_PLAYER_MAX_HEALTH 125
/**
Start health of player.
*/
#define SFG_PLAYER_START_HEALTH 100
/**
At which value health indicator shows a warning (red color).
*/
#define SFG_PLAYER_HEALTH_WARNING_LEVEL 20
/**
Amount of health that is increased by taking a health kit.
*/
#define SFG_HEALTH_KIT_VALUE 20
/**
How much randomness (positive and negative) will be added to damage
(e.g. by weapons, explosions, ...). This constant is is 0 to 255, 255 meaning
100% of the base value.
*/
#define SFG_DAMAGE_RANDOMNESS 64
/**
Height of monster collision BBox in RCL_Units.
*/
#define SFG_MONSTER_COLLISION_HEIGHT 1024
/**
Specifies key repeat delay, in ms.
*/
#define SFG_KEY_REPEAT_DELAY 500
/**
Specifies key repeat period, in ms.
*/
#define SFG_KEY_REPEAT_PERIOD 150
/**
Angle in which multiple projectiles are spread, RCL_Units.
*/
#define SFG_PROJECTILE_SPREAD_ANGLE 100
#define SFG_MAX_MONSTERS 64
#define SFG_MAX_PROJECTILES 12
#define SFG_MAX_DOORS 32
#define SFG_AMMO_BULLETS 0
#define SFG_AMMO_ROCKETS 1
#define SFG_AMMO_PLASMA 2
#define SFG_AMMO_TOTAL 3
#define SFG_AMMO_NONE SFG_AMMO_TOTAL
#define SFG_AMMO_INCREASE_BULLETS 10
#define SFG_AMMO_INCREASE_ROCKETS 5
#define SFG_AMMO_INCREASE_PLASMA 8
#define SFG_AMMO_MAX_BULLETS 200
#define SFG_AMMO_MAX_ROCKETS 100
#define SFG_AMMO_MAX_PLASMA 150
/**
Duration of story text (intro/outro) in ms.
*/
#define SFG_STORYTEXT_DURATION 15000
/**
Time in ms of the player death animation.
*/
#define SFG_LOSE_ANIMATION_DURATION 2000
/**
Time in ms of the level win animation.
*/
#define SFG_WIN_ANIMATION_DURATION 2500
/**
Time in ms of the level start stage.
*/
#define SFG_LEVEL_START_DURATION 1500
/**
Vertical sprite size, in RCL_Units.
*/
#define SFG_BASE_SPRITE_SIZE RCL_UNITS_PER_SQUARE
// ----------------------------
// derived constants
#define SFG_GAME_RESOLUTION_X \
(SFG_SCREEN_RESOLUTION_X / SFG_RESOLUTION_SCALEDOWN)
#define SFG_GAME_RESOLUTION_Y \
(SFG_SCREEN_RESOLUTION_Y / SFG_RESOLUTION_SCALEDOWN)
#define SFG_MS_PER_FRAME (1000 / SFG_FPS) // ms per frame with target FPS
#if SFG_MS_PER_FRAME == 0
#undef SFG_MS_PER_FRAME
#define SFG_MS_PER_FRAME 1
#endif
#define SFG_KEY_REPEAT_DELAY_FRAMES \
(SFG_KEY_REPEAT_DELAY / SFG_MS_PER_FRAME)
#if SFG_KEY_REPEAT_DELAY_FRAMES == 0
#undef SFG_KEY_REPEAT_DELAY_FRAMES
#define SFG_KEY_REPEAT_DELAY_FRAMES 1
#endif
#define SFG_KEY_REPEAT_PERIOD_FRAMES \
(SFG_KEY_REPEAT_PERIOD / SFG_MS_PER_FRAME)
#if SFG_KEY_REPEAT_PERIOD_FRAMES == 0
#undef SFG_KEY_REPEAT_PERIOD_FRAMES
#define SFG_KEY_REPEAT_PERIOD_FRAMES 1
#endif
#define SFG_WEAPON_IMAGE_SCALE \
(SFG_GAME_RESOLUTION_X / (SFG_TEXTURE_SIZE * 5))
#if SFG_WEAPON_IMAGE_SCALE == 0
#undef SFG_WEAPON_IMAGE_SCALE
#define SFG_WEAPON_IMAGE_SCALE 1
#endif
#define SFG_WEAPONBOB_OFFSET_PIXELS \
(SFG_WEAPONBOB_OFFSET * SFG_WEAPON_IMAGE_SCALE)
#define SFG_WEAPON_IMAGE_POSITION_X \
(SFG_GAME_RESOLUTION_X / 2 - (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE) / 2)
#if SFG_GAME_RESOLUTION_Y > 70
#define SFG_WEAPON_IMAGE_POSITION_Y \
(SFG_GAME_RESOLUTION_Y - (SFG_WEAPON_IMAGE_SCALE * SFG_TEXTURE_SIZE))
#elif SFG_GAME_RESOLUTION_Y > 50
#define SFG_WEAPON_IMAGE_POSITION_Y (SFG_GAME_RESOLUTION_Y \
- ((SFG_WEAPON_IMAGE_SCALE * 3 * SFG_TEXTURE_SIZE) / 4))
#else
#define SFG_WEAPON_IMAGE_POSITION_Y \
(SFG_GAME_RESOLUTION_Y - SFG_TEXTURE_SIZE / 2)
#endif
#define SFG_PLAYER_TURN_UNITS_PER_FRAME \
((SFG_PLAYER_TURN_SPEED * RCL_UNITS_PER_SQUARE) / (360 * SFG_FPS))
#if SFG_PLAYER_TURN_UNITS_PER_FRAME == 0
#undef SFG_PLAYER_TURN_UNITS_PER_FRAME
#define SFG_PLAYER_TURN_UNITS_PER_FRAME 1
#endif
#define SFG_PLAYER_MOVE_UNITS_PER_FRAME \
((SFG_PLAYER_MOVE_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS)
#if SFG_PLAYER_MOVE_UNITS_PER_FRAME == 0
#undef SFG_PLAYER_MOVE_UNITS_PER_FRAME
#define SFG_PLAYER_MOVE_UNITS_PER_FRAME 1
#endif
#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME \
((SFG_GRAVITY_ACCELERATION * RCL_UNITS_PER_SQUARE) / (SFG_FPS * SFG_FPS))
#if SFG_GRAVITY_SPEED_INCREASE_PER_FRAME == 0
#undef SFG_GRAVITY_SPEED_INCREASE_PER_FRAME
#define SFG_GRAVITY_SPEED_INCREASE_PER_FRAME 1
#endif
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME \
(((SFG_PLAYER_JUMP_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) \
- SFG_GRAVITY_SPEED_INCREASE_PER_FRAME / 2)
/* ^ This substraction corrects the initial veloc. so that the numeric curve
copies the analytical (smooth) curve. Without it the numeric curve goes
ABOVE and makes player jump higher with lower FPS. To make sense of this
try to solve the differential equation and plot it. */
#if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0
#undef SFG_PLAYER_JUMP_OFFSET_PER_FRAME
#define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1
#endif
#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME \
(SFG_HEADBOB_SPEED / SFG_FPS)
#if SFG_HEADBOB_FRAME_INCREASE_PER_FRAME == 0
#undef SFG_HEADBOB_FRAME_INCREASE_PER_FRAME
#define SFG_HEADBOB_FRAME_INCREASE_PER_FRAME 1
#endif
#define SFG_HEADBOB_ENABLED (SFG_HEADBOB_SPEED > 0 && SFG_HEADBOB_OFFSET > 0)
#define SFG_CAMERA_SHEAR_STEP_PER_FRAME \
((SFG_GAME_RESOLUTION_Y * SFG_CAMERA_SHEAR_SPEED) / SFG_FPS)
#if SFG_CAMERA_SHEAR_STEP_PER_FRAME == 0
#undef SFG_CAMERA_SHEAR_STEP_PER_FRAME
#define SFG_CAMERA_SHEAR_STEP_PER_FRAME 1
#endif
#define SFG_CAMERA_MAX_SHEAR_PIXELS \
((SFG_CAMERA_MAX_SHEAR * SFG_GAME_RESOLUTION_Y) / 1024)
#define SFG_FONT_SIZE_SMALL \
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 50))
#if SFG_FONT_SIZE_SMALL == 0
#undef SFG_FONT_SIZE_SMALL
#define SFG_FONT_SIZE_SMALL 1
#endif
#define SFG_FONT_SIZE_MEDIUM \
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 30))
#if SFG_FONT_SIZE_MEDIUM == 0
#undef SFG_FONT_SIZE_MEDIUM
#define SFG_FONT_SIZE_MEDIUM 1
#endif
#define SFG_FONT_SIZE_BIG \
(SFG_GAME_RESOLUTION_X / (SFG_FONT_CHARACTER_SIZE * 18))
#if SFG_FONT_SIZE_BIG == 0
#undef SFG_FONT_SIZE_BIG
#define SFG_FONT_SIZE_BIG 1
#endif
#define SFG_Z_BUFFER_SIZE SFG_GAME_RESOLUTION_X
/**
Step in which walls get higher, in raycastlib units.
*/
#define SFG_WALL_HEIGHT_STEP (RCL_UNITS_PER_SQUARE / 4)
#define SFG_CEILING_MAX_HEIGHT\
(16 * RCL_UNITS_PER_SQUARE - RCL_UNITS_PER_SQUARE / 2 )
#define SFG_DOOR_UP_DOWN_MASK 0x20
#define SFG_DOOR_LOCK(doorRecord) ((doorRecord) >> 6)
#define SFG_DOOR_VERTICAL_POSITION_MASK 0x1f
#define SFG_DOOR_HEIGHT_STEP (RCL_UNITS_PER_SQUARE / 0x1f)
#define SFG_DOOR_INCREMENT_PER_FRAME \
(SFG_DOOR_OPEN_SPEED / (SFG_DOOR_HEIGHT_STEP * SFG_FPS))
#if SFG_DOOR_INCREMENT_PER_FRAME == 0
#undef SFG_DOOR_INCREMENT_PER_FRAME
#define SFG_DOOR_INCREMENT_PER_FRAME 1
#endif
#define SFG_MAX_ITEMS SFG_MAX_LEVEL_ELEMENTS
#define SFG_MAX_SPRITE_SIZE SFG_GAME_RESOLUTION_X
#define SFG_MAP_PIXEL_SIZE (SFG_GAME_RESOLUTION_Y / SFG_MAP_SIZE)
#if SFG_MAP_PIXEL_SIZE == 0
#undef SFG_MAP_PIXEL_SIZE
#define SFG_MAP_PIXEL_SIZE 1
#endif
#define SFG_AI_UPDATE_FRAME_INTERVAL \
(SFG_FPS / SFG_AI_FPS)
#if SFG_AI_UPDATE_FRAME_INTERVAL == 0
#undef SFG_AI_UPDATE_FRAME_INTERVAL
#define SFG_AI_UPDATE_FRAME_INTERVAL 1
#endif
#define SFG_SPRITE_ANIMATION_FRAME_DURATION \
(SFG_FPS / SFG_SPRITE_ANIMATION_SPEED)
#if SFG_SPRITE_ANIMATION_FRAME_DURATION == 0
#undef SFG_SPRITE_ANIMATION_FRAME_DURATION
#define SFG_SPRITE_ANIMATION_FRAME_DURATION 1
#endif
#define SFG_HUD_MARGIN (SFG_GAME_RESOLUTION_X / 40)
#define SFG_HUD_BORDER_INDICATOR_WIDTH_PIXELS \
(SFG_GAME_RESOLUTION_Y / SFG_HUD_BORDER_INDICATOR_WIDTH)
#define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES \
(SFG_HUD_BORDER_INDICATOR_DURATION / SFG_MS_PER_FRAME)
#if SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES == 0
#define SFG_HUD_BORDER_INDICATOR_DURATION_FRAMES 1
#endif
#define SFG_BLINK_PERIOD_FRAMES (SFG_BLINK_PERIOD / SFG_MS_PER_FRAME)
#define SFG_HUD_BAR_HEIGHT \
(SFG_FONT_CHARACTER_SIZE * SFG_FONT_SIZE_MEDIUM + SFG_HUD_MARGIN * 2 + 1)
// ----------------------------
// monsters
#define SFG_MONSTER_ATTACK_MELEE 0
#define SFG_MONSTER_ATTACK_FIREBALL 1
#define SFG_MONSTER_ATTACK_BULLET 2
#define SFG_MONSTER_ATTACK_FIREBALL_BULLET 3
#define SFG_MONSTER_ATTACK_PLASMA 4
#define SFG_MONSTER_ATTACK_EXPLODE 5
#define SFG_MONSTER_ATTACK_FIREBALL_PLASMA 6
#define SFG_MONSTER_ATTRIBUTE(attackType,aggressivity0to255,health0to255,spriteSize0to3) \
((uint16_t) ( \
attackType | \
((aggressivity0to255 / 8) << 3) | \
(spriteSize0to3 << 8) | \
((health0to255 / 4) << 10)))
#define SFG_GET_MONSTER_ATTACK_TYPE(monsterNumber) \
(SFG_monsterAttributeTable[monsterNumber] & 0x0007)
#define SFG_GET_MONSTER_AGGRESSIVITY(monsterNumber) \
(((SFG_monsterAttributeTable[monsterNumber] >> 3) & 0x1F) * 8)
#define SFG_GET_MONSTER_SPRITE_SIZE(monsterNumber) \
((SFG_monsterAttributeTable[monsterNumber] >> 8) & 0x03)
#define SFG_GET_MONSTER_MAX_HEALTH(monsterNumber) \
(((SFG_monsterAttributeTable[monsterNumber] >> 10) & 0x3F) * 4)
/**
Table of monster attributes, each as a 16bit word in format:
MSB hhhhhhssaaaattt LSB
ttt: attack type
aaaaa: aggressivity (frequence of attacks), 0 to 31
ss: sprite size
hhhhhh: health, 0 to 63
*/
uint16_t SFG_monsterAttributeTable[SFG_MONSTERS_TOTAL] =
{
/* spider */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL,40,61,2),
/* destr. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL_BULLET,90,170,3),
/* warrior */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_MELEE,255,40,1),
/* plasma */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_PLASMA,56,92,1),
/* ender */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_FIREBALL_PLASMA,128,255,3),
/* turret */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_BULLET,32,23,0),
/* explod. */ SFG_MONSTER_ATTRIBUTE(SFG_MONSTER_ATTACK_EXPLODE,255,36,1)
};
// ----------------------------
// weapons and projectiles
#define SFG_WEAPON_KNIFE 0
#define SFG_WEAPON_SHOTGUN 1
#define SFG_WEAPON_MACHINE_GUN 2
#define SFG_WEAPON_ROCKET_LAUNCHER 3
#define SFG_WEAPON_PLASMAGUN 4
#define SFG_WEAPON_SOLUTION 5
#define SFG_WEAPONS_TOTAL 6
#define SFG_WEAPON_ATTRIBUTE(fireType,projectileCount,fireCooldownMs) \
((uint8_t) (fireType | ((projectileCount - 1) << 2) | ((fireCooldownMs / (SFG_MS_PER_FRAME * 16)) << 4)))
#define SFG_GET_WEAPON_FIRE_TYPE(weaponNumber) \
(SFG_weaponAttributeTable[weaponNumber] & 0x03)
#define SFG_GET_WEAPON_FIRE_COOLDOWN_FRAMES(weaponNumber) \
((SFG_weaponAttributeTable[weaponNumber] >> 4) * 16)
#define SFG_GET_WEAPON_PROJECTILE_COUNT(weaponNumber) \
(((SFG_weaponAttributeTable[weaponNumber] >> 2) & 0x03) + 1)
#define SFG_MIN_WEAPON_COOLDOWN_FRAMES 8
#define SFG_WEAPON_FIRE_TYPE_MELEE 0
#define SFG_WEAPON_FIRE_TYPE_BULLET 1
#define SFG_WEAPON_FIRE_TYPE_FIREBALL 2
#define SFG_WEAPON_FIRE_TYPE_PLASMA 3
#define SFG_WEAPON_FIRE_TYPES_TOTAL 4
/**
Table of weapon attributes, each as a byte in format:
MSB ccccnnff LSB
ff: fire type
nn: number of projectiles - 1
cccc: fire cooldown in frames, i.e. time after which the next shot can be
shot again, ccccc has to be multiplied by 16 to get the real value
*/
SFG_PROGRAM_MEMORY uint8_t SFG_weaponAttributeTable[SFG_WEAPONS_TOTAL] =
{
/* knife */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_MELEE,1,650), // DPS: 6.2
/* shotgun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,2,1250), // DPS: 12.8
/* m. gun */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_BULLET,1,700), // DPS: 11.4
/* r. laun. */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_FIREBALL,1,850), // DPS: 28.2
/* plasma */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,1,550), // DPS: 32.7
/* solution */ SFG_WEAPON_ATTRIBUTE(SFG_WEAPON_FIRE_TYPE_PLASMA,4,1050) // DPS: 85.7
};
SFG_PROGRAM_MEMORY uint8_t SFG_attackDamageTable[SFG_WEAPON_FIRE_TYPES_TOTAL] =
{
/* melee */ 4,
/* bullet */ 8,
/* explostion (fireball) */ 24,
/* plasma */ 18
};
#define SFG_PROJECTILE_EXPLOSION 0
#define SFG_PROJECTILE_FIREBALL 1
#define SFG_PROJECTILE_PLASMA 2
#define SFG_PROJECTILE_DUST 3
#define SFG_PROJECTILE_BULLET 4
#define SFG_PROJECTILE_NONE 255
#define SFG_PROJECTILES_TOTAL 5
#define SFG_PROJECTILE_ATTRIBUTE(speedSquaresPerSec,timeToLiveMs) \
((uint8_t) \
((((speedSquaresPerSec / 4 == 0) && (speedSquaresPerSec != 0)) ? 1 : speedSquaresPerSec / 4) | \
((timeToLiveMs / (8 * SFG_MS_PER_FRAME)) << 3)))
#define SFG_GET_PROJECTILE_SPEED_UPS(projectileNumber) \
(((SFG_projectileAttributeTable[projectileNumber] & 0x07) * 4 * RCL_UNITS_PER_SQUARE) / SFG_FPS)
#define SFG_GET_PROJECTILE_FRAMES_TO_LIVE(projectileNumber) \
((SFG_projectileAttributeTable[projectileNumber] >> 3) * 8)
/**
Table of projectile attributes, each as a byte in format:
MSB lllllsss LSB
fff: half speed in game squares per second
lllll: eigth of frames to live
*/
#define LOW_FPS (SFG_FPS < 20) ///< low FPS needs low speeds, because collisions
SFG_PROGRAM_MEMORY uint8_t SFG_projectileAttributeTable[SFG_PROJECTILES_TOTAL] =
{
/* explosion */ SFG_PROJECTILE_ATTRIBUTE(0,400),
/* fireball */ SFG_PROJECTILE_ATTRIBUTE(10,1000),
#if LOW_FPS
/* plasma */ SFG_PROJECTILE_ATTRIBUTE(17,500),
#else
/* plasma */ SFG_PROJECTILE_ATTRIBUTE(18,500),
#endif
/* dust */ SFG_PROJECTILE_ATTRIBUTE(0,450),
#if LOW_FPS
/* bullet */ SFG_PROJECTILE_ATTRIBUTE(17,1000)
#else
/* bullet */ SFG_PROJECTILE_ATTRIBUTE(28,1000)
#endif
};
#undef LOW_FPS
#endif // guard

4819
dingux/game.h Executable file

File diff suppressed because it is too large Load Diff

1395
dingux/images.h Normal file

File diff suppressed because it is too large Load Diff

225
dingux/levels.h Normal file
View File

@ -0,0 +1,225 @@
/**
@file levels.h
This file contains game levels and related code.
by Miloslav Ciz (drummyfish), 2019
Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
plus a waiver of all other intellectual property. The goal of this work is
be and remain completely in the public domain forever, available for any use
whatsoever.
*/
#ifndef _SFG_LEVELS_H
#define _SFG_LEVELS_H
#define SFG_MAP_SIZE 64
#define SFG_TILE_DICTIONARY_SIZE 64
typedef uint16_t SFG_TileDefinition;
/**<
Defines a single game map tile. The format is following:
MSB aaabbbbb cccddddd LSB
aaa: ceiling texture index (from texture available on the map), 111
means completely transparent texture
bbbbb: ceiling height (1111 meaning no ceiling) ABOVE the floor
ccc: floor texture index, 111 means completely transparent texture
ddddd: floor height
*/
#define SFG_TILE_CEILING_MAX_HEIGHT 31
#define SFG_TILE_TEXTURE_TRANSPARENT 7
typedef SFG_TileDefinition SFG_TileDictionary[SFG_TILE_DICTIONARY_SIZE];
/// helper macros for SFG_TileDefinition
#define SFG_TD(floorH, ceilH, floorT, ceilT)\
((floorH & 0x001f) |\
((floorT & 0x0007) << 5) |\
((ceilH & 0x001f) << 8) |\
((ceilT & 0x0007) << 13))
#define SFG_TILE_FLOOR_HEIGHT(tile) (tile & 0x1f)
#define SFG_TILE_FLOOR_TEXTURE(tile) ((tile & 0xe0) >> 5)
#define SFG_TILE_CEILING_HEIGHT(tile) ((tile & 0x1f00) >> 8)
#define SFG_TILE_CEILING_TEXTURE(tile) ((tile & 0xe000) >> 13)
#define SFG_OUTSIDE_TILE SFG_TD(63,0,7,7)
/**
Game map represented as a 2D array. Array item has this format:
MSB aabbbbbb LSB
aa: type of square, possible values:
00: normal
01: moving floor (elevator), moves from floor height to ceililing height
(there is no ceiling above)
10: moving ceiling, moves from ceiling height to floor height
11: door
bbbbbb: index into tile dictionary
*/
typedef uint8_t SFG_MapArray[SFG_MAP_SIZE * SFG_MAP_SIZE];
#define SFG_TILE_PROPERTY_MASK 0xc0
#define SFG_TILE_PROPERTY_NORMAL 0x00
#define SFG_TILE_PROPERTY_ELEVATOR 0x40
#define SFG_TILE_PROPERTY_SQUEEZER 0x80
#define SFG_TILE_PROPERTY_DOOR 0xc0
/**
Serves to place elements (items, enemies etc.) into the game level.
*/
typedef struct
{
uint8_t type;
uint8_t coords[2];
} SFG_LevelElement;
#define SFG_MAX_LEVEL_ELEMENTS 128
/*
Definitions of level element type. These values must leave the highest bit
unused because that will be used by the game engine, so the values must be
lower than 128.
*/
#define SFG_LEVEL_ELEMENT_NONE 0
#define SFG_LEVEL_ELEMENT_BARREL 0x01
#define SFG_LEVEL_ELEMENT_HEALTH 0x02
#define SFG_LEVEL_ELEMENT_BULLETS 0x03
#define SFG_LEVEL_ELEMENT_ROCKETS 0x04
#define SFG_LEVEL_ELEMENT_PLASMA 0x05
#define SFG_LEVEL_ELEMENT_TREE 0x06
#define SFG_LEVEL_ELEMENT_FINISH 0x07
#define SFG_LEVEL_ELEMENT_TELEPORT 0x08
#define SFG_LEVEL_ELEMENT_TERMINAL 0x09
#define SFG_LEVEL_ELEMENT_COLUMN 0x0a
#define SFG_LEVEL_ELEMENT_RUIN 0x0b
#define SFG_LEVEL_ELEMENT_LAMP 0x0c
#define SFG_LEVEL_ELEMENT_CARD0 0x0d ///< Access card, unlocks doors with lock.
#define SFG_LEVEL_ELEMENT_CARD1 0x0e
#define SFG_LEVEL_ELEMENT_CARD2 0x0f
#define SFG_LEVEL_ELEMENT_LOCK0 0x10 /**< Special level element that must be
placed on a tile with door. This door is
then unlocked by taking the corresponding
access card. */
#define SFG_LEVEL_ELEMENT_LOCK1 0x11
#define SFG_LEVEL_ELEMENT_LOCK2 0x12
#define SFG_LEVEL_ELEMENT_BLOCKER 0x13 ///< Invisible wall.
#define SFG_LEVEL_ELEMENT_MONSTER_SPIDER 0x20
#define SFG_LEVEL_ELEMENT_MONSTER_DESTROYER 0x21
#define SFG_LEVEL_ELEMENT_MONSTER_WARRIOR 0x22
#define SFG_LEVEL_ELEMENT_MONSTER_PLASMABOT 0x23
#define SFG_LEVEL_ELEMENT_MONSTER_ENDER 0x24
#define SFG_LEVEL_ELEMENT_MONSTER_TURRET 0x25
#define SFG_LEVEL_ELEMENT_MONSTER_EXPLODER 0x26
#define SFG_MONSTERS_TOTAL 7
#define SFG_MONSTER_TYPE_TO_INDEX(monsterType) \
((monsterType) - SFG_LEVEL_ELEMENT_MONSTER_SPIDER)
#define SFG_MONSTER_INDEX_TO_TYPE(monsterIndex) \
((monsterIndex) + SFG_LEVEL_ELEMENT_MONSTER_SPIDER)
#define SFG_LEVEL_ELEMENT_TYPE_IS_MOSTER(t) \
((t) >= SFG_LEVEL_ELEMENT_MONSTER_SPIDER)
typedef struct
{
SFG_MapArray mapArray;
SFG_TileDictionary tileDictionary;
uint8_t textureIndices[7]; /**< Says which textures are used on the map. There
can be at most 7 because of 3bit indexing (one
value is reserved for special transparent
texture). */
uint8_t doorTextureIndex; /**< Index (global, NOT from textureIndices) of a
texture used for door. */
uint8_t floorColor;
uint8_t ceilingColor;
uint8_t playerStart[3]; /**< Player starting location: square X, square Y,
direction (fourths of RCL_Unit). */
uint8_t backgroundImage; /** Index of level background image. */
SFG_LevelElement elements[SFG_MAX_LEVEL_ELEMENTS];
} SFG_Level;
static inline SFG_TileDefinition SFG_getMapTile
(
const SFG_Level *level,
int16_t x,
int16_t y,
uint8_t *properties
)
{
if (x < 0 || x >= SFG_MAP_SIZE || y < 0 || y >= SFG_MAP_SIZE)
{
*properties = SFG_TILE_PROPERTY_NORMAL;
return SFG_OUTSIDE_TILE;
}
uint8_t tile = level->mapArray[y * SFG_MAP_SIZE + x];
*properties = tile & 0xc0;
return level->tileDictionary[tile & 0x3f];
}
#define SFG_NUMBER_OF_LEVELS 10
/*
NOTE: Initially the levels were stored sequentially in one big array, but that
caused some issues with Arduino's PROGMEM, so now we store each level in a
separate variable and eventually create an array of pointers to these.
*/
SFG_PROGRAM_MEMORY SFG_Level SFG_level0 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level1 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level2 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level3 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level4 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level5 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level6 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level7 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level8 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
SFG_PROGRAM_MEMORY SFG_Level SFG_level9 =
#include "/home/tastyfish/git/anarch/assets/tmp.txt"
;
static const SFG_Level * SFG_levels[SFG_NUMBER_OF_LEVELS] =
{
&SFG_level0, &SFG_level1, &SFG_level2, &SFG_level3, &SFG_level4, &SFG_level5,
&SFG_level6, &SFG_level7, &SFG_level8, &SFG_level9
};
#endif // guard

25
dingux/mbed_config.h Normal file
View File

@ -0,0 +1,25 @@
/*
* mbed SDK
* Copyright (c) 2017 ARM Limited
*
* Licensed 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.
*/
// Automatically generated configuration file.
// DO NOT EDIT, content will be overwritten.
#ifndef __MBED_CONFIG_DATA__
#define __MBED_CONFIG_DATA__
#endif

View File

@ -0,0 +1,80 @@
/*
File: libacl.h
(C) 1999, 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
This program 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 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 __ACL_LIBACL_H
#define __ACL_LIBACL_H
#include <sys/acl.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Flags for acl_to_any_text() */
/* Print NO, SOME or ALL effective permissions comments. SOME prints
effective rights comments for entries which have different permissions
than effective permissions. */
#define TEXT_SOME_EFFECTIVE 0x01
#define TEXT_ALL_EFFECTIVE 0x02
/* Align effective permission comments to column 32 using tabs or
use a single tab. */
#define TEXT_SMART_INDENT 0x04
/* User and group IDs instead of names. */
#define TEXT_NUMERIC_IDS 0x08
/* Only output the first letter of entry types
("u::rwx" instead of "user::rwx"). */
#define TEXT_ABBREVIATE 0x10
/* acl_check error codes */
#define ACL_MULTI_ERROR (0x1000) /* multiple unique objects */
#define ACL_DUPLICATE_ERROR (0x2000) /* duplicate Id's in entries */
#define ACL_MISS_ERROR (0x3000) /* missing required entry */
#define ACL_ENTRY_ERROR (0x4000) /* wrong entry type */
extern char *acl_to_any_text(acl_t acl, const char *prefix,
char separator, int options);
extern int acl_cmp(acl_t acl1, acl_t acl2);
extern int acl_check(acl_t acl, int *last);
extern acl_t acl_from_mode(mode_t mode);
extern int acl_equiv_mode(acl_t acl, mode_t *mode_p);
extern int acl_extended_file(const char *path_p);
extern int acl_extended_file_nofollow(const char *path_p);
extern int acl_extended_fd(int fd);
extern int acl_entries(acl_t acl);
extern const char *acl_error(int code);
extern int acl_get_perm(acl_permset_t permset_d, acl_perm_t perm);
/* Copying permissions between files */
struct error_context;
extern int perm_copy_file (const char *, const char *,
struct error_context *);
extern int perm_copy_fd (const char *, int, const char *, int,
struct error_context *);
#ifdef __cplusplus
}
#endif
#endif /* __ACL_LIBACL_H */

View File

@ -0,0 +1,200 @@
/*
* Copyright (c) 2001-2002,2004 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program 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 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ATTRIBUTES_H__
#define __ATTRIBUTES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef ENOATTR
# define ENOATTR ENODATA
#endif
/*
* An almost-IRIX-compatible extended attributes API
* (the IRIX attribute "list" operation is missing, added ATTR_SECURE).
*/
/*
* The maximum size (into the kernel or returned from the kernel) of an
* attribute value or the buffer used for an attr_list() call. Larger
* sizes will result in an E2BIG return code.
*/
#define ATTR_MAX_VALUELEN (64*1024) /* max length of a value */
/*
* Flags that can be used with any of the simple attribute calls.
* All desired flags should be bit-wise OR'ed together.
*/
#define ATTR_DONTFOLLOW 0x0001 /* do not follow symlinks for a pathname */
#define ATTR_ROOT 0x0002 /* use root namespace attributes in op */
#define ATTR_TRUST 0x0004 /* tell server we can be trusted to properly
handle extended attributes */
#define ATTR_SECURE 0x0008 /* use security namespace attributes in op */
/*
* Additional flags that can be used with the set() attribute call.
* All desired flags (from both lists) should be bit-wise OR'ed together.
*/
#define ATTR_CREATE 0x0010 /* pure create: fail if attr already exists */
#define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */
/*
* Define how lists of attribute names are returned to the user from
* the attr_list() call. A large, 32bit aligned, buffer is passed in
* along with its size. We put an array of offsets at the top that each
* reference an attrlist_ent_t and pack the attrlist_ent_t's at the bottom.
*/
typedef struct attrlist {
int32_t al_count; /* number of entries in attrlist */
int32_t al_more; /* T/F: more attrs (do call again) */
int32_t al_offset[1]; /* byte offsets of attrs [var-sized] */
} attrlist_t;
/*
* Show the interesting info about one attribute. This is what the
* al_offset[i] entry points to.
*/
typedef struct attrlist_ent { /* data from attr_list() */
uint32_t a_valuelen; /* number bytes in value of attr */
char a_name[1]; /* attr name (NULL terminated) */
} attrlist_ent_t;
/*
* Given a pointer to the (char*) buffer containing the attr_list() result,
* and an index, return a pointer to the indicated attribute in the buffer.
*/
#define ATTR_ENTRY(buffer, index) \
((attrlist_ent_t *) \
&((char *)buffer)[ ((attrlist_t *)(buffer))->al_offset[index] ])
/*
* Implement a "cursor" for use in successive attr_list() calls.
* It provides a way to find the last attribute that was returned in the
* last attr_list() call so that we can get the next one without missing
* any. This should be bzero()ed before use and whenever it is desired to
* start over from the beginning of the attribute list. The only valid
* operation on a cursor is to bzero() it.
*/
typedef struct attrlist_cursor {
uint32_t opaque[4]; /* an opaque cookie */
} attrlist_cursor_t;
/*
* Multi-attribute operation vector.
*/
typedef struct attr_multiop {
int32_t am_opcode; /* operation to perform (ATTR_OP_GET, etc.) */
int32_t am_error; /* [out arg] result of this sub-op (an errno) */
char *am_attrname; /* attribute name to work with */
char *am_attrvalue; /* [in/out arg] attribute value (raw bytes) */
int32_t am_length; /* [in/out arg] length of value */
int32_t am_flags; /* flags (bit-wise OR of #defines above) */
} attr_multiop_t;
#define ATTR_MAX_MULTIOPS 128 /* max number ops in an oplist array */
/*
* Valid values of am_opcode.
*/
#define ATTR_OP_GET 1 /* return the indicated attr's value */
#define ATTR_OP_SET 2 /* set/create the indicated attr/value pair */
#define ATTR_OP_REMOVE 3 /* remove the indicated attr */
/*
* Get the value of an attribute.
* Valuelength must be set to the maximum size of the value buffer, it will
* be set to the actual number of bytes used in the value buffer upon return.
* The return value is -1 on error (w/errno set appropriately), 0 on success.
*/
extern int attr_get (const char *__path, const char *__attrname,
char *__attrvalue, int *__valuelength, int __flags)
__attribute__ ((deprecated));
extern int attr_getf (int __fd, const char *__attrname, char *__attrvalue,
int *__valuelength, int __flags)
__attribute__ ((deprecated));
/*
* Set the value of an attribute, creating the attribute if necessary.
* The return value is -1 on error (w/errno set appropriately), 0 on success.
*/
extern int attr_set (const char *__path, const char *__attrname,
const char *__attrvalue, const int __valuelength,
int __flags)
__attribute__ ((deprecated));
extern int attr_setf (int __fd, const char *__attrname,
const char *__attrvalue, const int __valuelength,
int __flags)
__attribute__ ((deprecated));
/*
* Remove an attribute.
* The return value is -1 on error (w/errno set appropriately), 0 on success.
*/
extern int attr_remove (const char *__path, const char *__attrname,
int __flags)
__attribute__ ((deprecated));
extern int attr_removef (int __fd, const char *__attrname, int __flags)
__attribute__ ((deprecated));
/*
* List the names and sizes of the values of all the attributes of an object.
* "Cursor" must be allocated and zeroed before the first call, it is used
* to maintain context between system calls if all the attribute names won't
* fit into the buffer on the first system call.
* The return value is -1 on error (w/errno set appropriately), 0 on success.
*/
extern int attr_list(const char *__path, char *__buffer, const int __buffersize,
int __flags, attrlist_cursor_t *__cursor)
__attribute__ ((deprecated));
extern int attr_listf(int __fd, char *__buffer, const int __buffersize,
int __flags, attrlist_cursor_t *__cursor)
__attribute__ ((deprecated));
/*
* Operate on multiple attributes of the same object simultaneously.
*
* This call will save on system call overhead when many attributes are
* going to be operated on.
*
* The return value is -1 on error (w/errno set appropriately), 0 on success.
* Note that this call will not return -1 as a result of failure of any
* of the sub-operations, their return value is stored in each element
* of the operation array. This call will return -1 for a failure of the
* call as a whole, eg: if the pathname doesn't exist, or the fd is bad.
*
* The semantics and allowable values for the fields in a attr_multiop_t
* are the same as the semantics and allowable values for the arguments to
* the corresponding "simple" attribute interface. For example: the args
* to a ATTR_OP_GET are the same as the args to an attr_get() call.
*/
extern int attr_multi (const char *__path, attr_multiop_t *__oplist,
int __count, int __flags)
__attribute__ ((deprecated));
extern int attr_multif (int __fd, attr_multiop_t *__oplist,
int __count, int __flags)
__attribute__ ((deprecated));
#ifdef __cplusplus
}
#endif
#endif /* __ATTRIBUTES_H__ */

View File

@ -0,0 +1,53 @@
/*
Copyright (C) 2009 Andreas Gruenbacher <agruen@suse.de>
This program 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 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ERROR_CONTEXT_T
#define __ERROR_CONTEXT_T
#ifdef __cplusplus
extern "C" {
#endif
struct error_context {
/* Process an error message */
void (*error) (struct error_context *, const char *, ...);
/* Quote a file name for including in an error message */
const char *(*quote) (struct error_context *, const char *);
/* Free a quoted name */
void (*quote_free) (struct error_context *, const char *);
};
#ifdef ERROR_CONTEXT_MACROS
# define error(ctx, args...) do { \
if ((ctx) && (ctx)->error) \
(ctx)->error((ctx), args); \
} while(0)
# define quote(ctx, name) \
( ((ctx) && (ctx)->quote) ? (ctx)->quote((ctx), (name)) : (name) )
# define quote_free(ctx, name) do { \
if ((ctx) && (ctx)->quote_free) \
(ctx)->quote_free((ctx), (name)); \
} while(0)
#endif
#ifdef __cplusplus
}
#endif
#endif /* __ERROR_CONTEXT_T */

View File

@ -0,0 +1,46 @@
/*
Copyright (C) 2009 Andreas Gruenbacher <agruen@suse.de>
This program 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 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LIBATTR_H
#define __LIBATTR_H
#ifdef __cplusplus
extern "C" {
#endif
struct error_context;
extern int attr_copy_file (const char *, const char *,
int (*) (const char *, struct error_context *),
struct error_context *);
extern int attr_copy_fd (const char *, int, const char *, int,
int (*) (const char *, struct error_context *),
struct error_context *);
/* Keep this function for backwards compatibility. */
extern int attr_copy_check_permissions(const char *, struct error_context *);
#define ATTR_ACTION_SKIP 1
#define ATTR_ACTION_PERMISSIONS 2
extern int attr_copy_action(const char *, struct error_context *);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,461 @@
/*
* blkid.h - Interface for libblkid, a library to identify block devices
*
* Copyright (C) 2001 Andreas Dilger
* Copyright (C) 2003 Theodore Ts'o
* Copyright (C) 2008 Karel Zak <kzak@redhat.com>
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BLKID_BLKID_H
#define _BLKID_BLKID_H
#include <stdint.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define BLKID_VERSION "2.31.1"
#define BLKID_DATE "19-Dec-2017"
/**
* blkid_dev:
*
* The device object keeps information about one device
*/
typedef struct blkid_struct_dev *blkid_dev;
/**
* blkid_cache:
*
* information about all system devices
*/
typedef struct blkid_struct_cache *blkid_cache;
/**
* blkid_probe:
*
* low-level probing setting
*/
typedef struct blkid_struct_probe *blkid_probe;
/**
* blkid_topology:
*
* device topology information
*/
typedef struct blkid_struct_topology *blkid_topology;
/**
* blkid_partlist
*
* list of all detected partitions and partitions tables
*/
typedef struct blkid_struct_partlist *blkid_partlist;
/**
* blkid_partition:
*
* information about a partition
*/
typedef struct blkid_struct_partition *blkid_partition;
/**
* blkid_parttable:
*
* information about a partition table
*/
typedef struct blkid_struct_parttable *blkid_parttable;
/**
* blkid_loff_t:
*
* 64-bit signed number for offsets and sizes
*/
typedef int64_t blkid_loff_t;
/**
* blkid_tag_iterate:
*
* tags iterator for high-level (blkid_cache) API
*/
typedef struct blkid_struct_tag_iterate *blkid_tag_iterate;
/**
* blkid_dev_iterate:
*
* devices iterator for high-level (blkid_cache) API
*/
typedef struct blkid_struct_dev_iterate *blkid_dev_iterate;
/*
* Flags for blkid_get_dev
*
* BLKID_DEV_CREATE Create an empty device structure if not found
* in the cache.
* BLKID_DEV_VERIFY Make sure the device structure corresponds
* with reality.
* BLKID_DEV_FIND Just look up a device entry, and return NULL
* if it is not found.
* BLKID_DEV_NORMAL Get a valid device structure, either from the
* cache or by probing the device.
*/
#define BLKID_DEV_FIND 0x0000
#define BLKID_DEV_CREATE 0x0001
#define BLKID_DEV_VERIFY 0x0002
#define BLKID_DEV_NORMAL (BLKID_DEV_CREATE | BLKID_DEV_VERIFY)
#ifndef __GNUC_PREREQ
# if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
# else
# define __GNUC_PREREQ(maj, min) 0
# endif
#endif
#ifndef __ul_attribute__
# if __GNUC_PREREQ (3, 4)
# define __ul_attribute__(_a_) __attribute__(_a_)
# else
# define __ul_attribute__(_a_)
# endif
#endif
/* cache.c */
extern void blkid_init_debug(int mask);
extern void blkid_put_cache(blkid_cache cache);
extern int blkid_get_cache(blkid_cache *cache, const char *filename);
extern void blkid_gc_cache(blkid_cache cache);
/* dev.c */
extern const char *blkid_dev_devname(blkid_dev dev)
__ul_attribute__((warn_unused_result));
extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache);
extern int blkid_dev_set_search(blkid_dev_iterate iter,
char *search_type, char *search_value);
extern int blkid_dev_next(blkid_dev_iterate iterate, blkid_dev *dev);
extern void blkid_dev_iterate_end(blkid_dev_iterate iterate);
/* devno.c */
extern char *blkid_devno_to_devname(dev_t devno)
__ul_attribute__((warn_unused_result));
extern int blkid_devno_to_wholedisk(dev_t dev, char *diskname,
size_t len, dev_t *diskdevno)
__ul_attribute__((warn_unused_result));
/* devname.c */
extern int blkid_probe_all(blkid_cache cache);
extern int blkid_probe_all_new(blkid_cache cache);
extern int blkid_probe_all_removable(blkid_cache cache);
extern blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags);
/* getsize.c */
extern blkid_loff_t blkid_get_dev_size(int fd);
/* verify.c */
extern blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev);
/* read.c */
/* resolve.c */
extern char *blkid_get_tag_value(blkid_cache cache, const char *tagname,
const char *devname)
__ul_attribute__((warn_unused_result));
extern char *blkid_get_devname(blkid_cache cache, const char *token,
const char *value)
__ul_attribute__((warn_unused_result));
/* tag.c */
extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev);
extern int blkid_tag_next(blkid_tag_iterate iterate,
const char **type, const char **value);
extern void blkid_tag_iterate_end(blkid_tag_iterate iterate);
extern int blkid_dev_has_tag(blkid_dev dev, const char *type, const char *value);
extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
const char *type,
const char *value);
extern int blkid_parse_tag_string(const char *token, char **ret_type, char **ret_val);
/* version.c */
extern int blkid_parse_version_string(const char *ver_string)
__ul_attribute__((nonnull));
extern int blkid_get_library_version(const char **ver_string,
const char **date_string);
/* encode.c */
extern int blkid_encode_string(const char *str, char *str_enc, size_t len);
extern int blkid_safe_string(const char *str, char *str_safe, size_t len);
/* evaluate.c */
extern int blkid_send_uevent(const char *devname, const char *action);
extern char *blkid_evaluate_tag(const char *token, const char *value,
blkid_cache *cache)
__ul_attribute__((warn_unused_result));
extern char *blkid_evaluate_spec(const char *spec, blkid_cache *cache)
__ul_attribute__((warn_unused_result));
/* probe.c */
extern blkid_probe blkid_new_probe(void)
__ul_attribute__((warn_unused_result));
extern blkid_probe blkid_new_probe_from_filename(const char *filename)
__ul_attribute__((warn_unused_result))
__ul_attribute__((nonnull));
extern void blkid_free_probe(blkid_probe pr);
extern void blkid_reset_probe(blkid_probe pr);
extern int blkid_probe_reset_buffers(blkid_probe pr);
extern int blkid_probe_hide_range(blkid_probe pr, uint64_t off, uint64_t len);
extern int blkid_probe_set_device(blkid_probe pr, int fd,
blkid_loff_t off, blkid_loff_t size)
__ul_attribute__((nonnull));
extern dev_t blkid_probe_get_devno(blkid_probe pr)
__ul_attribute__((nonnull));
extern dev_t blkid_probe_get_wholedisk_devno(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_probe_is_wholedisk(blkid_probe pr)
__ul_attribute__((nonnull));
extern blkid_loff_t blkid_probe_get_size(blkid_probe pr)
__ul_attribute__((nonnull));
extern blkid_loff_t blkid_probe_get_offset(blkid_probe pr)
__ul_attribute__((nonnull));
extern unsigned int blkid_probe_get_sectorsize(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_probe_set_sectorsize(blkid_probe pr, unsigned int sz)
__ul_attribute__((nonnull));
extern blkid_loff_t blkid_probe_get_sectors(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_probe_get_fd(blkid_probe pr)
__ul_attribute__((nonnull));
/*
* superblocks probing
*/
extern int blkid_known_fstype(const char *fstype)
__ul_attribute__((nonnull));
extern int blkid_superblocks_get_name(size_t idx, const char **name, int *usage);
extern int blkid_probe_enable_superblocks(blkid_probe pr, int enable)
__ul_attribute__((nonnull));
#define BLKID_SUBLKS_LABEL (1 << 1) /* read LABEL from superblock */
#define BLKID_SUBLKS_LABELRAW (1 << 2) /* read and define LABEL_RAW result value*/
#define BLKID_SUBLKS_UUID (1 << 3) /* read UUID from superblock */
#define BLKID_SUBLKS_UUIDRAW (1 << 4) /* read and define UUID_RAW result value */
#define BLKID_SUBLKS_TYPE (1 << 5) /* define TYPE result value */
#define BLKID_SUBLKS_SECTYPE (1 << 6) /* define compatible fs type (second type) */
#define BLKID_SUBLKS_USAGE (1 << 7) /* define USAGE result value */
#define BLKID_SUBLKS_VERSION (1 << 8) /* read FS type from superblock */
#define BLKID_SUBLKS_MAGIC (1 << 9) /* define SBMAGIC and SBMAGIC_OFFSET */
#define BLKID_SUBLKS_BADCSUM (1 << 10) /* allow a bad checksum */
#define BLKID_SUBLKS_DEFAULT (BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | \
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE)
extern int blkid_probe_set_superblocks_flags(blkid_probe pr, int flags)
__ul_attribute__((nonnull));
extern int blkid_probe_reset_superblocks_filter(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_probe_invert_superblocks_filter(blkid_probe pr)
__ul_attribute__((nonnull));
/**
* BLKID_FLTR_NOTIN
*/
#define BLKID_FLTR_NOTIN 1
/**
* BLKID_FLTR_ONLYIN
*/
#define BLKID_FLTR_ONLYIN 2
extern int blkid_probe_filter_superblocks_type(blkid_probe pr, int flag, char *names[])
__ul_attribute__((nonnull));
#define BLKID_USAGE_FILESYSTEM (1 << 1)
#define BLKID_USAGE_RAID (1 << 2)
#define BLKID_USAGE_CRYPTO (1 << 3)
#define BLKID_USAGE_OTHER (1 << 4)
extern int blkid_probe_filter_superblocks_usage(blkid_probe pr, int flag, int usage)
__ul_attribute__((nonnull));
/*
* topology probing
*/
extern int blkid_probe_enable_topology(blkid_probe pr, int enable)
__ul_attribute__((nonnull));
/* binary interface */
extern blkid_topology blkid_probe_get_topology(blkid_probe pr)
__ul_attribute__((nonnull));
extern unsigned long blkid_topology_get_alignment_offset(blkid_topology tp)
__ul_attribute__((nonnull));
extern unsigned long blkid_topology_get_minimum_io_size(blkid_topology tp)
__ul_attribute__((nonnull));
extern unsigned long blkid_topology_get_optimal_io_size(blkid_topology tp)
__ul_attribute__((nonnull));
extern unsigned long blkid_topology_get_logical_sector_size(blkid_topology tp)
__ul_attribute__((nonnull));
extern unsigned long blkid_topology_get_physical_sector_size(blkid_topology tp)
__ul_attribute__((nonnull));
/*
* partitions probing
*/
extern int blkid_known_pttype(const char *pttype);
extern int blkid_partitions_get_name(const size_t idx, const char **name);
extern int blkid_probe_enable_partitions(blkid_probe pr, int enable)
__ul_attribute__((nonnull));
extern int blkid_probe_reset_partitions_filter(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_probe_invert_partitions_filter(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_probe_filter_partitions_type(blkid_probe pr, int flag, char *names[])
__ul_attribute__((nonnull));
/* partitions probing flags */
#define BLKID_PARTS_FORCE_GPT (1 << 1)
#define BLKID_PARTS_ENTRY_DETAILS (1 << 2)
#define BLKID_PARTS_MAGIC (1 << 3)
extern int blkid_probe_set_partitions_flags(blkid_probe pr, int flags)
__ul_attribute__((nonnull));
/* binary interface */
extern blkid_partlist blkid_probe_get_partitions(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_partlist_numof_partitions(blkid_partlist ls)
__ul_attribute__((nonnull));
extern blkid_parttable blkid_partlist_get_table(blkid_partlist ls)
__ul_attribute__((nonnull));
extern blkid_partition blkid_partlist_get_partition(blkid_partlist ls, int n)
__ul_attribute__((nonnull));
extern blkid_partition blkid_partlist_get_partition_by_partno(blkid_partlist ls, int n)
__ul_attribute__((nonnull));
extern blkid_partition blkid_partlist_devno_to_partition(blkid_partlist ls, dev_t devno)
__ul_attribute__((nonnull));
extern blkid_parttable blkid_partition_get_table(blkid_partition par)
__ul_attribute__((nonnull));
extern const char *blkid_partition_get_name(blkid_partition par)
__ul_attribute__((nonnull));
extern const char *blkid_partition_get_uuid(blkid_partition par)
__ul_attribute__((nonnull));
extern int blkid_partition_get_partno(blkid_partition par)
__ul_attribute__((nonnull));
extern blkid_loff_t blkid_partition_get_start(blkid_partition par)
__ul_attribute__((nonnull));
extern blkid_loff_t blkid_partition_get_size(blkid_partition par)
__ul_attribute__((nonnull));
extern int blkid_partition_get_type(blkid_partition par)
__ul_attribute__((nonnull));
extern const char *blkid_partition_get_type_string(blkid_partition par)
__ul_attribute__((nonnull));
extern unsigned long long blkid_partition_get_flags(blkid_partition par)
__ul_attribute__((nonnull));
extern int blkid_partition_is_logical(blkid_partition par)
__ul_attribute__((nonnull));
extern int blkid_partition_is_extended(blkid_partition par)
__ul_attribute__((nonnull));
extern int blkid_partition_is_primary(blkid_partition par)
__ul_attribute__((nonnull));
extern const char *blkid_parttable_get_type(blkid_parttable tab)
__ul_attribute__((nonnull));
extern const char *blkid_parttable_get_id(blkid_parttable tab)
__ul_attribute__((nonnull));
extern blkid_loff_t blkid_parttable_get_offset(blkid_parttable tab)
__ul_attribute__((nonnull));
extern blkid_partition blkid_parttable_get_parent(blkid_parttable tab)
__ul_attribute__((nonnull));
/*
* NAME=value low-level interface
*/
extern int blkid_do_probe(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_do_safeprobe(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_do_fullprobe(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_probe_numof_values(blkid_probe pr)
__ul_attribute__((nonnull));
extern int blkid_probe_get_value(blkid_probe pr, int num, const char **name,
const char **data, size_t *len)
__ul_attribute__((nonnull(1)));
extern int blkid_probe_lookup_value(blkid_probe pr, const char *name,
const char **data, size_t *len)
__ul_attribute__((nonnull(1, 2)));
extern int blkid_probe_has_value(blkid_probe pr, const char *name)
__ul_attribute__((nonnull));
extern int blkid_do_wipe(blkid_probe pr, int dryrun)
__ul_attribute__((nonnull));
extern int blkid_probe_step_back(blkid_probe pr)
__ul_attribute__((nonnull));
/*
* Deprecated functions/macros
*/
#ifndef BLKID_DISABLE_DEPRECATED
#define BLKID_PROBREQ_LABEL BLKID_SUBLKS_LABEL
#define BLKID_PROBREQ_LABELRAW BLKID_SUBLKS_LABELRAW
#define BLKID_PROBREQ_UUID BLKID_SUBLKS_UUID
#define BLKID_PROBREQ_UUIDRAW BLKID_SUBLKS_UUIDRAW
#define BLKID_PROBREQ_TYPE BLKID_SUBLKS_TYPE
#define BLKID_PROBREQ_SECTYPE BLKID_SUBLKS_SECTYPE
#define BLKID_PROBREQ_USAGE BLKID_SUBLKS_USAGE
#define BLKID_PROBREQ_VERSION BLKID_SUBLKS_VERSION
extern int blkid_probe_set_request(blkid_probe pr, int flags)
__ul_attribute__((deprecated));
extern int blkid_probe_filter_usage(blkid_probe pr, int flag, int usage)
__ul_attribute__((deprecated));
extern int blkid_probe_filter_types(blkid_probe pr, int flag, char *names[])
__ul_attribute__((deprecated));
extern int blkid_probe_invert_filter(blkid_probe pr)
__ul_attribute__((deprecated));
extern int blkid_probe_reset_filter(blkid_probe pr)
__ul_attribute__((deprecated));
#endif /* BLKID_DISABLE_DEPRECATED */
#ifdef __cplusplus
}
#endif
#endif /* _BLKID_BLKID_H */

View File

@ -0,0 +1 @@
et/com_err.h

View File

@ -0,0 +1,79 @@
/*
* e2p.h --- header file for the e2p library
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/
#include <sys/types.h> /* Needed by dirent.h on netbsd */
#include <stdio.h>
#include <dirent.h>
#include <ext2fs/ext2_fs.h>
#define E2P_FEATURE_COMPAT 0
#define E2P_FEATURE_INCOMPAT 1
#define E2P_FEATURE_RO_INCOMPAT 2
#define E2P_FEATURE_TYPE_MASK 0x03
#define E2P_FEATURE_NEGATE_FLAG 0x80
#define E2P_FS_FEATURE 0
#define E2P_JOURNAL_FEATURE 1
/* `options' for print_flags() */
#define PFOPT_LONG 1 /* Must be 1 for compatibility with `int long_format'. */
int fgetflags (const char * name, unsigned long * flags);
int fgetversion (const char * name, unsigned long * version);
int fsetflags (const char * name, unsigned long flags);
int fsetversion (const char * name, unsigned long version);
int fgetproject(const char *name, unsigned long *project);
int fsetproject(const char *name, unsigned long project);
int getflags (int fd, unsigned long * flags);
int getversion (int fd, unsigned long * version);
int iterate_on_dir (const char * dir_name,
int (*func) (const char *, struct dirent *, void *),
void * private_arg);
void list_super(struct ext2_super_block * s);
void list_super2(struct ext2_super_block * s, FILE *f);
void print_fs_errors (FILE * f, unsigned short errors);
void print_flags (FILE * f, unsigned long flags, unsigned options);
void print_fs_state (FILE * f, unsigned short state);
int setflags (int fd, unsigned long flags);
int setversion (int fd, unsigned long version);
void e2p_list_journal_super(FILE *f, char *journal_sb_buf,
int exp_block_size, int flags);
const char *e2p_feature2string(int compat, unsigned int mask);
const char *e2p_jrnl_feature2string(int compat, unsigned int mask);
int e2p_string2feature(char *string, int *compat, unsigned int *mask);
int e2p_jrnl_string2feature(char *string, int *compat_type, unsigned int *mask);
int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array);
int e2p_edit_feature2(const char *str, __u32 *compat_array, __u32 *ok_array,
__u32 *clear_ok_array, int *type_err,
unsigned int *mask_err);
int e2p_is_null_uuid(void *uu);
void e2p_uuid_to_str(void *uu, char *out);
const char *e2p_uuid2str(void *uu);
const char *e2p_hash2string(int num);
int e2p_string2hash(char *string);
const char *e2p_mntopt2string(unsigned int mask);
int e2p_string2mntopt(char *string, unsigned int *mask);
int e2p_edit_mntopts(const char *str, __u32 *mntopts, __u32 ok);
unsigned long parse_num_blocks(const char *arg, int log_block_size);
unsigned long long parse_num_blocks2(const char *arg, int log_block_size);
char *e2p_os2string(int os_type);
int e2p_string2os(char *str);
unsigned int e2p_percent(int percent, unsigned int base);

View File

@ -0,0 +1,68 @@
/*
* Header file for common error description library.
*
* Copyright 1988, Student Information Processing Board of the
* Massachusetts Institute of Technology.
*
* For copyright and distribution info, see the documentation supplied
* with this package.
*/
#if !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)
#ifdef __GNUC__
#define COM_ERR_ATTR(x) __attribute__(x)
#else
#define COM_ERR_ATTR(x)
#endif
#include <stddef.h>
#include <stdarg.h>
typedef long errcode_t;
struct error_table {
char const * const * msgs;
long base;
int n_msgs;
};
struct et_list;
extern void com_err (const char *, long, const char *, ...)
COM_ERR_ATTR((format(printf, 3, 4)));
extern void com_err_va (const char *whoami, errcode_t code, const char *fmt,
va_list args)
COM_ERR_ATTR((format(printf, 3, 0)));
extern char const *error_message (long);
extern void (*com_err_hook) (const char *, long, const char *, va_list);
extern void (*set_com_err_hook (void (*) (const char *, long,
const char *, va_list)))
(const char *, long, const char *, va_list);
extern void (*reset_com_err_hook (void)) (const char *, long,
const char *, va_list);
extern int init_error_table(const char * const *msgs, long base, int count);
extern char *(*set_com_err_gettext (char *(*) (const char *)))
(const char *);
extern errcode_t add_error_table(const struct error_table * et);
extern errcode_t remove_error_table(const struct error_table * et);
extern void add_to_error_table(struct et_list *new_table);
/* Provided for Heimdall compatibility */
extern const char *com_right(struct et_list *list, long code);
extern const char *com_right_r(struct et_list *list, long code, char *str, size_t len);
extern void initialize_error_table_r(struct et_list **list,
const char **messages,
int num_errors,
long base);
extern void free_error_table(struct et_list *et);
/* Provided for compatibility with other com_err libraries */
extern int et_list_lock(void);
extern int et_list_unlock(void);
#define __COM_ERR_H
#define __COM_ERR_H__
#endif /* !defined(__COM_ERR_H) && !defined(__COM_ERR_H__)*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
/* expat_config.h. Generated from expat_config.h.in by configure. */
/* expat_config.h.in. Generated from configure.ac by autoheader. */
/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */
#define BYTEORDER 1234
/* Define to 1 if you have the `arc4random' function. */
/* #undef HAVE_ARC4RANDOM */
/* Define to 1 if you have the `arc4random_buf' function. */
/* #undef HAVE_ARC4RANDOM_BUF */
/* Define to 1 if you have the `bcopy' function. */
#define HAVE_BCOPY 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `getpagesize' function. */
#define HAVE_GETPAGESIZE 1
/* Define to 1 if you have the `getrandom' function. */
#define HAVE_GETRANDOM 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the `bsd' library (-lbsd). */
/* #undef HAVE_LIBBSD */
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have a working `mmap' system call. */
#define HAVE_MMAP 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have `syscall' and `SYS_getrandom'. */
/* #undef HAVE_SYSCALL_GETRANDOM */
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "expat"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "expat-bugs@libexpat.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "expat"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "expat 2.2.5"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "expat"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.2.5"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "2.2.5"
/* whether byteorder is bigendian */
/* #undef WORDS_BIGENDIAN */
/* Define to specify how much context to retain around the current parse
point. */
#define XML_CONTEXT_BYTES 1024
/* Define to include code reading entropy from `/dev/urandom'. */
#define XML_DEV_URANDOM 1
/* Define to make parameter entity parsing functionality available. */
#define XML_DTD 1
/* Define to make XML Namespaces functionality available. */
#define XML_NS 1
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */

View File

@ -0,0 +1,162 @@
/*
__ __ _
___\ \/ /_ __ __ _| |_
/ _ \\ /| '_ \ / _` | __|
| __// \| |_) | (_| | |_
\___/_/\_\ .__/ \__,_|\__|
|_| XML parser
Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
Copyright (c) 2000-2017 Expat development team
Licensed under the MIT license:
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 Expat_External_INCLUDED
#define Expat_External_INCLUDED 1
/* External API definitions */
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
# define XML_USE_MSC_EXTENSIONS 1
#endif
/* Expat tries very hard to make the API boundary very specifically
defined. There are two macros defined to control this boundary;
each of these can be defined before including this header to
achieve some different behavior, but doing so it not recommended or
tested frequently.
XMLCALL - The calling convention to use for all calls across the
"library boundary." This will default to cdecl, and
try really hard to tell the compiler that's what we
want.
XMLIMPORT - Whatever magic is needed to note that a function is
to be imported from a dynamically loaded library
(.dll, .so, or .sl, depending on your platform).
The XMLCALL macro was added in Expat 1.95.7. The only one which is
expected to be directly useful in client code is XMLCALL.
Note that on at least some Unix versions, the Expat library must be
compiled with the cdecl calling convention as the default since
system headers may assume the cdecl convention.
*/
#ifndef XMLCALL
# if defined(_MSC_VER)
# define XMLCALL __cdecl
# elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
# define XMLCALL __attribute__((cdecl))
# else
/* For any platform which uses this definition and supports more than
one calling convention, we need to extend this definition to
declare the convention used on that platform, if it's possible to
do so.
If this is the case for your platform, please file a bug report
with information on how to identify your platform via the C
pre-processor and how to specify the same calling convention as the
platform's malloc() implementation.
*/
# define XMLCALL
# endif
#endif /* not defined XMLCALL */
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
# ifndef XML_BUILDING_EXPAT
/* using Expat from an application */
# ifdef XML_USE_MSC_EXTENSIONS
# define XMLIMPORT __declspec(dllimport)
# endif
# endif
#endif /* not defined XML_STATIC */
#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
# define XMLIMPORT __attribute__ ((visibility ("default")))
#endif
/* If we didn't define it above, define it away: */
#ifndef XMLIMPORT
# define XMLIMPORT
#endif
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
# define XML_ATTR_MALLOC __attribute__((__malloc__))
#else
# define XML_ATTR_MALLOC
#endif
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
#else
# define XML_ATTR_ALLOC_SIZE(x)
#endif
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
#ifdef __cplusplus
extern "C" {
#endif
#ifdef XML_UNICODE_WCHAR_T
# ifndef XML_UNICODE
# define XML_UNICODE
# endif
# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
# endif
#endif
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
# ifdef XML_UNICODE_WCHAR_T
typedef wchar_t XML_Char;
typedef wchar_t XML_LChar;
# else
typedef unsigned short XML_Char;
typedef char XML_LChar;
# endif /* XML_UNICODE_WCHAR_T */
#else /* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
#endif /* XML_UNICODE */
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
typedef __int64 XML_Index;
typedef unsigned __int64 XML_Size;
# else
typedef long long XML_Index;
typedef unsigned long long XML_Size;
# endif
#else
typedef long XML_Index;
typedef unsigned long XML_Size;
#endif /* XML_LARGE_SIZE */
#ifdef __cplusplus
}
#endif
#endif /* not Expat_External_INCLUDED */

View File

@ -0,0 +1,703 @@
/*
* bitops.h --- Bitmap frobbing code. The byte swapping routines are
* also included here.
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/
#ifdef WORDS_BIGENDIAN
#define ext2fs_cpu_to_le64(x) ((__force __le64)ext2fs_swab64((__u64)(x)))
#define ext2fs_le64_to_cpu(x) ext2fs_swab64((__force __u64)(__le64)(x))
#define ext2fs_cpu_to_le32(x) ((__force __le32)ext2fs_swab32((__u32)(x)))
#define ext2fs_le32_to_cpu(x) ext2fs_swab32((__force __u32)(__le32)(x))
#define ext2fs_cpu_to_le16(x) ((__force __le16)ext2fs_swab16((__u16)(x)))
#define ext2fs_le16_to_cpu(x) ext2fs_swab16((__force __u16)(__le16)(x))
#define ext2fs_cpu_to_be64(x) ((__force __be64)(__u64)(x))
#define ext2fs_be64_to_cpu(x) ((__force __u64)(__be64)(x))
#define ext2fs_cpu_to_be32(x) ((__force __be32)(__u32)(x))
#define ext2fs_be32_to_cpu(x) ((__force __u32)(__be32)(x))
#define ext2fs_cpu_to_be16(x) ((__force __be16)(__u16)(x))
#define ext2fs_be16_to_cpu(x) ((__force __u16)(__be16)(x))
#else
#define ext2fs_cpu_to_le64(x) ((__force __le64)(__u64)(x))
#define ext2fs_le64_to_cpu(x) ((__force __u64)(__le64)(x))
#define ext2fs_cpu_to_le32(x) ((__force __le32)(__u32)(x))
#define ext2fs_le32_to_cpu(x) ((__force __u32)(__le32)(x))
#define ext2fs_cpu_to_le16(x) ((__force __le16)(__u16)(x))
#define ext2fs_le16_to_cpu(x) ((__force __u16)(__le16)(x))
#define ext2fs_cpu_to_be64(x) ((__force __be64)ext2fs_swab64((__u64)(x)))
#define ext2fs_be64_to_cpu(x) ext2fs_swab64((__force __u64)(__be64)(x))
#define ext2fs_cpu_to_be32(x) ((__force __be32)ext2fs_swab32((__u32)(x)))
#define ext2fs_be32_to_cpu(x) ext2fs_swab32((__force __u32)(__be32)(x))
#define ext2fs_cpu_to_be16(x) ((__force __be16)ext2fs_swab16((__u16)(x)))
#define ext2fs_be16_to_cpu(x) ext2fs_swab16((__force __u16)(__be16)(x))
#endif
/*
* EXT2FS bitmap manipulation routines.
*/
/* Support for sending warning messages from the inline subroutines */
extern const char *ext2fs_block_string;
extern const char *ext2fs_inode_string;
extern const char *ext2fs_mark_string;
extern const char *ext2fs_unmark_string;
extern const char *ext2fs_test_string;
extern void ext2fs_warn_bitmap(errcode_t errcode, unsigned long arg,
const char *description);
extern void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
int code, unsigned long arg);
#ifdef NO_INLINE_FUNCS
extern void ext2fs_fast_set_bit(unsigned int nr,void * addr);
extern void ext2fs_fast_clear_bit(unsigned int nr, void * addr);
extern void ext2fs_fast_set_bit64(__u64 nr,void * addr);
extern void ext2fs_fast_clear_bit64(__u64 nr, void * addr);
extern __u16 ext2fs_swab16(__u16 val);
extern __u32 ext2fs_swab32(__u32 val);
extern __u64 ext2fs_swab64(__u64 val);
extern int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
extern void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block);
extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
extern void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
#endif
/* These functions routines moved to gen_bitmap.c */
extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap,
ino_t inode, int num);
extern int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
__u32 bitno);
extern int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
blk_t bitno);
extern int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
blk_t bitno);
extern int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num);
extern void ext2fs_set_bitmap_padding(ext2fs_generic_bitmap map);
extern __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap);
extern __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap);
/* 64-bit versions */
#ifdef NO_INLINE_FUNCS
extern int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block);
extern void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode);
extern errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t start,
blk64_t end,
blk64_t *out);
extern errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t start,
ext2_ino_t end,
ext2_ino_t *out);
extern errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t start,
blk64_t end,
blk64_t *out);
extern errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t start,
ext2_ino_t end,
ext2_ino_t *out);
extern blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap);
extern blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap);
extern ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap);
extern int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num);
extern void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num);
extern void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num);
#endif
/* These routines moved to gen_bitmap64.c */
extern void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap);
extern errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
ext2fs_generic_bitmap bm1,
ext2fs_generic_bitmap bm2);
extern void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap);
extern int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
blk64_t bitno);
extern int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
blk64_t bitno);
extern int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
blk64_t bitno);
extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block, unsigned int num);
extern __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap);
extern __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap);
extern int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block, unsigned int num);
extern void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block, unsigned int num);
extern void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block, unsigned int num);
extern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap,
__u64 start, __u64 end,
__u64 *out);
extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap,
__u64 start, __u64 end,
__u64 *out);
/*
* The inline routines themselves...
*
* If NO_INLINE_FUNCS is defined, then we won't try to do inline
* functions at all; they will be included as normal functions in
* inline.c
*/
#ifdef NO_INLINE_FUNCS
#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
defined(__i586__)))
/* This prevents bitops.c from trying to include the C */
/* function version of these functions */
#define _EXT2_HAVE_ASM_BITOPS_
#endif
#endif /* NO_INLINE_FUNCS */
#if (defined(INCLUDE_INLINE_FUNCS) || !defined(NO_INLINE_FUNCS))
#ifdef INCLUDE_INLINE_FUNCS
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ extern inline
#else
#define _INLINE_ inline
#endif
#else /* !INCLUDE_INLINE FUNCS */
#if (__STDC_VERSION__ >= 199901L)
#define _INLINE_ inline
#else /* not C99 */
#ifdef __GNUC__
#define _INLINE_ extern __inline__
#else /* For Watcom C */
#define _INLINE_ extern inline
#endif /* __GNUC__ */
#endif /* __STDC_VERSION__ >= 199901L */
#endif /* INCLUDE_INLINE_FUNCS */
/*
* Fast bit set/clear functions that doesn't need to return the
* previous bit value.
*/
_INLINE_ void ext2fs_fast_set_bit(unsigned int nr,void * addr)
{
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
*ADDR |= (unsigned char) (1 << (nr & 0x07));
}
_INLINE_ void ext2fs_fast_clear_bit(unsigned int nr, void * addr)
{
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
}
_INLINE_ void ext2fs_fast_set_bit64(__u64 nr, void * addr)
{
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
*ADDR |= (unsigned char) (1 << (nr & 0x07));
}
_INLINE_ void ext2fs_fast_clear_bit64(__u64 nr, void * addr)
{
unsigned char *ADDR = (unsigned char *) addr;
ADDR += nr >> 3;
*ADDR &= (unsigned char) ~(1 << (nr & 0x07));
}
#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
(defined(__i386__) || defined(__i486__) || defined(__i586__)))
#define _EXT2_HAVE_ASM_BITOPS_
#define _EXT2_HAVE_ASM_SWAB_
/*
* These are done by inline assembly for speed reasons.....
*
* All bitoperations return 0 if the bit was cleared before the
* operation and != 0 if it was not. Bit 0 is the LSB of addr; bit 32
* is the LSB of (addr+1).
*/
/*
* Some hacks to defeat gcc over-optimizations..
*/
struct __dummy_h { unsigned long a[100]; };
#define EXT2FS_ADDR (*(struct __dummy_h *) addr)
#define EXT2FS_CONST_ADDR (*(const struct __dummy_h *) addr)
_INLINE_ int ext2fs_set_bit(unsigned int nr, void * addr)
{
int oldbit;
addr = (void *) (((unsigned char *) addr) + (nr >> 3));
__asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"+m" (EXT2FS_ADDR)
:"r" (nr & 7));
return oldbit;
}
_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
{
int oldbit;
addr = (void *) (((unsigned char *) addr) + (nr >> 3));
__asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit),"+m" (EXT2FS_ADDR)
:"r" (nr & 7));
return oldbit;
}
_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
{
int oldbit;
addr = (const void *) (((const unsigned char *) addr) + (nr >> 3));
__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
:"=r" (oldbit)
:"m" (EXT2FS_CONST_ADDR),"r" (nr & 7));
return oldbit;
}
_INLINE_ __u32 ext2fs_swab32(__u32 val)
{
#ifdef EXT2FS_REQUIRE_486
__asm__("bswap %0" : "=r" (val) : "0" (val));
#else
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
"rorl $16,%0\n\t" /* swap words */
"xchgb %b0,%h0" /* swap higher bytes */
:"=q" (val)
: "0" (val));
#endif
return val;
}
_INLINE_ __u16 ext2fs_swab16(__u16 val)
{
__asm__("xchgb %b0,%h0" /* swap bytes */ \
: "=q" (val) \
: "0" (val)); \
return val;
}
#undef EXT2FS_ADDR
#endif /* i386 */
#if !defined(_EXT2_HAVE_ASM_SWAB_)
_INLINE_ __u16 ext2fs_swab16(__u16 val)
{
return (val >> 8) | (__u16) (val << 8);
}
_INLINE_ __u32 ext2fs_swab32(__u32 val)
{
return ((val>>24) | ((val>>8)&0xFF00) |
((val<<8)&0xFF0000) | (val<<24));
}
#endif /* !_EXT2_HAVE_ASM_SWAB */
_INLINE_ __u64 ext2fs_swab64(__u64 val)
{
return (ext2fs_swab32((__u32) (val >> 32)) |
(((__u64)ext2fs_swab32(val & 0xFFFFFFFFUL)) << 32));
}
_INLINE_ int ext2fs_mark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ void ext2fs_fast_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
blk_t block)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
}
_INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, inode);
}
_INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
{
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
{
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
{
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
{
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ int ext2fs_fast_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
return ext2fs_test_block_bitmap_range(bitmap, block, num);
}
_INLINE_ void ext2fs_fast_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
ext2fs_mark_block_bitmap_range(bitmap, block, num);
}
_INLINE_ void ext2fs_fast_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
blk_t block, int num)
{
ext2fs_unmark_block_bitmap_range(bitmap, block, num);
}
/* 64-bit versions */
_INLINE_ int ext2fs_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ int ext2fs_test_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ int ext2fs_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ void ext2fs_fast_mark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ void ext2fs_fast_unmark_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, block);
}
_INLINE_ int ext2fs_fast_test_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t block)
{
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
block);
}
_INLINE_ void ext2fs_fast_mark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
ext2fs_mark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
}
_INLINE_ void ext2fs_fast_unmark_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
ext2fs_unmark_generic_bmap((ext2fs_generic_bitmap) bitmap, inode);
}
_INLINE_ int ext2fs_fast_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode)
{
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap) bitmap,
inode);
}
_INLINE_ errcode_t ext2fs_find_first_zero_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t start,
blk64_t end,
blk64_t *out)
{
__u64 o;
errcode_t rv;
rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
*out = o;
return rv;
}
_INLINE_ errcode_t ext2fs_find_first_zero_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t start,
ext2_ino_t end,
ext2_ino_t *out)
{
__u64 o;
errcode_t rv;
rv = ext2fs_find_first_zero_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
*out = (ext2_ino_t) o;
return rv;
}
_INLINE_ errcode_t ext2fs_find_first_set_block_bitmap2(ext2fs_block_bitmap bitmap,
blk64_t start,
blk64_t end,
blk64_t *out)
{
__u64 o;
errcode_t rv;
rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
*out = o;
return rv;
}
_INLINE_ errcode_t ext2fs_find_first_set_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t start,
ext2_ino_t end,
ext2_ino_t *out)
{
__u64 o;
errcode_t rv;
rv = ext2fs_find_first_set_generic_bmap((ext2fs_generic_bitmap) bitmap,
start, end, &o);
if (!rv)
*out = (ext2_ino_t) o;
return rv;
}
_INLINE_ blk64_t ext2fs_get_block_bitmap_start2(ext2fs_block_bitmap bitmap)
{
return ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start2(ext2fs_inode_bitmap bitmap)
{
return (ext2_ino_t) ext2fs_get_generic_bmap_start((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ blk64_t ext2fs_get_block_bitmap_end2(ext2fs_block_bitmap bitmap)
{
return ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end2(ext2fs_inode_bitmap bitmap)
{
return (ext2_ino_t) ext2fs_get_generic_bmap_end((ext2fs_generic_bitmap) bitmap);
}
_INLINE_ int ext2fs_fast_test_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num)
{
return ext2fs_test_block_bitmap_range2(bitmap, block, num);
}
_INLINE_ void ext2fs_fast_mark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num)
{
ext2fs_mark_block_bitmap_range2(bitmap, block, num);
}
_INLINE_ void ext2fs_fast_unmark_block_bitmap_range2(ext2fs_block_bitmap bitmap,
blk64_t block,
unsigned int num)
{
ext2fs_unmark_block_bitmap_range2(bitmap, block, num);
}
#undef _INLINE_
#endif
#ifndef _EXT2_HAVE_ASM_BITOPS_
extern int ext2fs_set_bit(unsigned int nr,void * addr);
extern int ext2fs_clear_bit(unsigned int nr, void * addr);
extern int ext2fs_test_bit(unsigned int nr, const void * addr);
#endif
extern int ext2fs_set_bit64(__u64 nr,void * addr);
extern int ext2fs_clear_bit64(__u64 nr, void * addr);
extern int ext2fs_test_bit64(__u64 nr, const void * addr);
extern unsigned int ext2fs_bitcount(const void *addr, unsigned int nbytes);

View File

@ -0,0 +1,196 @@
/*
* ext2_err.h:
* This file is automatically generated; please do not edit it.
*/
#include <et/com_err.h>
#define EXT2_ET_BASE (2133571328L)
#define EXT2_ET_MAGIC_EXT2FS_FILSYS (2133571329L)
#define EXT2_ET_MAGIC_BADBLOCKS_LIST (2133571330L)
#define EXT2_ET_MAGIC_BADBLOCKS_ITERATE (2133571331L)
#define EXT2_ET_MAGIC_INODE_SCAN (2133571332L)
#define EXT2_ET_MAGIC_IO_CHANNEL (2133571333L)
#define EXT2_ET_MAGIC_UNIX_IO_CHANNEL (2133571334L)
#define EXT2_ET_MAGIC_IO_MANAGER (2133571335L)
#define EXT2_ET_MAGIC_BLOCK_BITMAP (2133571336L)
#define EXT2_ET_MAGIC_INODE_BITMAP (2133571337L)
#define EXT2_ET_MAGIC_GENERIC_BITMAP (2133571338L)
#define EXT2_ET_MAGIC_TEST_IO_CHANNEL (2133571339L)
#define EXT2_ET_MAGIC_DBLIST (2133571340L)
#define EXT2_ET_MAGIC_ICOUNT (2133571341L)
#define EXT2_ET_MAGIC_PQ_IO_CHANNEL (2133571342L)
#define EXT2_ET_MAGIC_EXT2_FILE (2133571343L)
#define EXT2_ET_MAGIC_E2IMAGE (2133571344L)
#define EXT2_ET_MAGIC_INODE_IO_CHANNEL (2133571345L)
#define EXT2_ET_MAGIC_EXTENT_HANDLE (2133571346L)
#define EXT2_ET_BAD_MAGIC (2133571347L)
#define EXT2_ET_REV_TOO_HIGH (2133571348L)
#define EXT2_ET_RO_FILSYS (2133571349L)
#define EXT2_ET_GDESC_READ (2133571350L)
#define EXT2_ET_GDESC_WRITE (2133571351L)
#define EXT2_ET_GDESC_BAD_BLOCK_MAP (2133571352L)
#define EXT2_ET_GDESC_BAD_INODE_MAP (2133571353L)
#define EXT2_ET_GDESC_BAD_INODE_TABLE (2133571354L)
#define EXT2_ET_INODE_BITMAP_WRITE (2133571355L)
#define EXT2_ET_INODE_BITMAP_READ (2133571356L)
#define EXT2_ET_BLOCK_BITMAP_WRITE (2133571357L)
#define EXT2_ET_BLOCK_BITMAP_READ (2133571358L)
#define EXT2_ET_INODE_TABLE_WRITE (2133571359L)
#define EXT2_ET_INODE_TABLE_READ (2133571360L)
#define EXT2_ET_NEXT_INODE_READ (2133571361L)
#define EXT2_ET_UNEXPECTED_BLOCK_SIZE (2133571362L)
#define EXT2_ET_DIR_CORRUPTED (2133571363L)
#define EXT2_ET_SHORT_READ (2133571364L)
#define EXT2_ET_SHORT_WRITE (2133571365L)
#define EXT2_ET_DIR_NO_SPACE (2133571366L)
#define EXT2_ET_NO_INODE_BITMAP (2133571367L)
#define EXT2_ET_NO_BLOCK_BITMAP (2133571368L)
#define EXT2_ET_BAD_INODE_NUM (2133571369L)
#define EXT2_ET_BAD_BLOCK_NUM (2133571370L)
#define EXT2_ET_EXPAND_DIR_ERR (2133571371L)
#define EXT2_ET_TOOSMALL (2133571372L)
#define EXT2_ET_BAD_BLOCK_MARK (2133571373L)
#define EXT2_ET_BAD_BLOCK_UNMARK (2133571374L)
#define EXT2_ET_BAD_BLOCK_TEST (2133571375L)
#define EXT2_ET_BAD_INODE_MARK (2133571376L)
#define EXT2_ET_BAD_INODE_UNMARK (2133571377L)
#define EXT2_ET_BAD_INODE_TEST (2133571378L)
#define EXT2_ET_FUDGE_BLOCK_BITMAP_END (2133571379L)
#define EXT2_ET_FUDGE_INODE_BITMAP_END (2133571380L)
#define EXT2_ET_BAD_IND_BLOCK (2133571381L)
#define EXT2_ET_BAD_DIND_BLOCK (2133571382L)
#define EXT2_ET_BAD_TIND_BLOCK (2133571383L)
#define EXT2_ET_NEQ_BLOCK_BITMAP (2133571384L)
#define EXT2_ET_NEQ_INODE_BITMAP (2133571385L)
#define EXT2_ET_BAD_DEVICE_NAME (2133571386L)
#define EXT2_ET_MISSING_INODE_TABLE (2133571387L)
#define EXT2_ET_CORRUPT_SUPERBLOCK (2133571388L)
#define EXT2_ET_BAD_GENERIC_MARK (2133571389L)
#define EXT2_ET_BAD_GENERIC_UNMARK (2133571390L)
#define EXT2_ET_BAD_GENERIC_TEST (2133571391L)
#define EXT2_ET_SYMLINK_LOOP (2133571392L)
#define EXT2_ET_CALLBACK_NOTHANDLED (2133571393L)
#define EXT2_ET_BAD_BLOCK_IN_INODE_TABLE (2133571394L)
#define EXT2_ET_UNSUPP_FEATURE (2133571395L)
#define EXT2_ET_RO_UNSUPP_FEATURE (2133571396L)
#define EXT2_ET_LLSEEK_FAILED (2133571397L)
#define EXT2_ET_NO_MEMORY (2133571398L)
#define EXT2_ET_INVALID_ARGUMENT (2133571399L)
#define EXT2_ET_BLOCK_ALLOC_FAIL (2133571400L)
#define EXT2_ET_INODE_ALLOC_FAIL (2133571401L)
#define EXT2_ET_NO_DIRECTORY (2133571402L)
#define EXT2_ET_TOO_MANY_REFS (2133571403L)
#define EXT2_ET_FILE_NOT_FOUND (2133571404L)
#define EXT2_ET_FILE_RO (2133571405L)
#define EXT2_ET_DB_NOT_FOUND (2133571406L)
#define EXT2_ET_DIR_EXISTS (2133571407L)
#define EXT2_ET_UNIMPLEMENTED (2133571408L)
#define EXT2_ET_CANCEL_REQUESTED (2133571409L)
#define EXT2_ET_FILE_TOO_BIG (2133571410L)
#define EXT2_ET_JOURNAL_NOT_BLOCK (2133571411L)
#define EXT2_ET_NO_JOURNAL_SB (2133571412L)
#define EXT2_ET_JOURNAL_TOO_SMALL (2133571413L)
#define EXT2_ET_JOURNAL_UNSUPP_VERSION (2133571414L)
#define EXT2_ET_LOAD_EXT_JOURNAL (2133571415L)
#define EXT2_ET_NO_JOURNAL (2133571416L)
#define EXT2_ET_DIRHASH_UNSUPP (2133571417L)
#define EXT2_ET_BAD_EA_BLOCK_NUM (2133571418L)
#define EXT2_ET_TOO_MANY_INODES (2133571419L)
#define EXT2_ET_NOT_IMAGE_FILE (2133571420L)
#define EXT2_ET_RES_GDT_BLOCKS (2133571421L)
#define EXT2_ET_RESIZE_INODE_CORRUPT (2133571422L)
#define EXT2_ET_SET_BMAP_NO_IND (2133571423L)
#define EXT2_ET_TDB_SUCCESS (2133571424L)
#define EXT2_ET_TDB_ERR_CORRUPT (2133571425L)
#define EXT2_ET_TDB_ERR_IO (2133571426L)
#define EXT2_ET_TDB_ERR_LOCK (2133571427L)
#define EXT2_ET_TDB_ERR_OOM (2133571428L)
#define EXT2_ET_TDB_ERR_EXISTS (2133571429L)
#define EXT2_ET_TDB_ERR_NOLOCK (2133571430L)
#define EXT2_ET_TDB_ERR_EINVAL (2133571431L)
#define EXT2_ET_TDB_ERR_NOEXIST (2133571432L)
#define EXT2_ET_TDB_ERR_RDONLY (2133571433L)
#define EXT2_ET_DBLIST_EMPTY (2133571434L)
#define EXT2_ET_RO_BLOCK_ITERATE (2133571435L)
#define EXT2_ET_MAGIC_EXTENT_PATH (2133571436L)
#define EXT2_ET_MAGIC_GENERIC_BITMAP64 (2133571437L)
#define EXT2_ET_MAGIC_BLOCK_BITMAP64 (2133571438L)
#define EXT2_ET_MAGIC_INODE_BITMAP64 (2133571439L)
#define EXT2_ET_MAGIC_RESERVED_13 (2133571440L)
#define EXT2_ET_MAGIC_RESERVED_14 (2133571441L)
#define EXT2_ET_MAGIC_RESERVED_15 (2133571442L)
#define EXT2_ET_MAGIC_RESERVED_16 (2133571443L)
#define EXT2_ET_MAGIC_RESERVED_17 (2133571444L)
#define EXT2_ET_MAGIC_RESERVED_18 (2133571445L)
#define EXT2_ET_MAGIC_RESERVED_19 (2133571446L)
#define EXT2_ET_EXTENT_HEADER_BAD (2133571447L)
#define EXT2_ET_EXTENT_INDEX_BAD (2133571448L)
#define EXT2_ET_EXTENT_LEAF_BAD (2133571449L)
#define EXT2_ET_EXTENT_NO_SPACE (2133571450L)
#define EXT2_ET_INODE_NOT_EXTENT (2133571451L)
#define EXT2_ET_EXTENT_NO_NEXT (2133571452L)
#define EXT2_ET_EXTENT_NO_PREV (2133571453L)
#define EXT2_ET_EXTENT_NO_UP (2133571454L)
#define EXT2_ET_EXTENT_NO_DOWN (2133571455L)
#define EXT2_ET_NO_CURRENT_NODE (2133571456L)
#define EXT2_ET_OP_NOT_SUPPORTED (2133571457L)
#define EXT2_ET_CANT_INSERT_EXTENT (2133571458L)
#define EXT2_ET_CANT_SPLIT_EXTENT (2133571459L)
#define EXT2_ET_EXTENT_NOT_FOUND (2133571460L)
#define EXT2_ET_EXTENT_NOT_SUPPORTED (2133571461L)
#define EXT2_ET_EXTENT_INVALID_LENGTH (2133571462L)
#define EXT2_ET_IO_CHANNEL_NO_SUPPORT_64 (2133571463L)
#define EXT2_ET_NO_MTAB_FILE (2133571464L)
#define EXT2_ET_CANT_USE_LEGACY_BITMAPS (2133571465L)
#define EXT2_ET_MMP_MAGIC_INVALID (2133571466L)
#define EXT2_ET_MMP_FAILED (2133571467L)
#define EXT2_ET_MMP_FSCK_ON (2133571468L)
#define EXT2_ET_MMP_BAD_BLOCK (2133571469L)
#define EXT2_ET_MMP_UNKNOWN_SEQ (2133571470L)
#define EXT2_ET_MMP_CHANGE_ABORT (2133571471L)
#define EXT2_ET_MMP_OPEN_DIRECT (2133571472L)
#define EXT2_ET_BAD_DESC_SIZE (2133571473L)
#define EXT2_ET_INODE_CSUM_INVALID (2133571474L)
#define EXT2_ET_INODE_BITMAP_CSUM_INVALID (2133571475L)
#define EXT2_ET_EXTENT_CSUM_INVALID (2133571476L)
#define EXT2_ET_DIR_NO_SPACE_FOR_CSUM (2133571477L)
#define EXT2_ET_DIR_CSUM_INVALID (2133571478L)
#define EXT2_ET_EXT_ATTR_CSUM_INVALID (2133571479L)
#define EXT2_ET_SB_CSUM_INVALID (2133571480L)
#define EXT2_ET_UNKNOWN_CSUM (2133571481L)
#define EXT2_ET_MMP_CSUM_INVALID (2133571482L)
#define EXT2_ET_FILE_EXISTS (2133571483L)
#define EXT2_ET_BLOCK_BITMAP_CSUM_INVALID (2133571484L)
#define EXT2_ET_INLINE_DATA_CANT_ITERATE (2133571485L)
#define EXT2_ET_EA_BAD_NAME_LEN (2133571486L)
#define EXT2_ET_EA_BAD_VALUE_SIZE (2133571487L)
#define EXT2_ET_BAD_EA_HASH (2133571488L)
#define EXT2_ET_BAD_EA_HEADER (2133571489L)
#define EXT2_ET_EA_KEY_NOT_FOUND (2133571490L)
#define EXT2_ET_EA_NO_SPACE (2133571491L)
#define EXT2_ET_MISSING_EA_FEATURE (2133571492L)
#define EXT2_ET_NO_INLINE_DATA (2133571493L)
#define EXT2_ET_INLINE_DATA_NO_BLOCK (2133571494L)
#define EXT2_ET_INLINE_DATA_NO_SPACE (2133571495L)
#define EXT2_ET_MAGIC_EA_HANDLE (2133571496L)
#define EXT2_ET_INODE_IS_GARBAGE (2133571497L)
#define EXT2_ET_EA_BAD_VALUE_OFFSET (2133571498L)
#define EXT2_ET_JOURNAL_FLAGS_WRONG (2133571499L)
#define EXT2_ET_UNDO_FILE_CORRUPT (2133571500L)
#define EXT2_ET_UNDO_FILE_WRONG (2133571501L)
#define EXT2_ET_FILESYSTEM_CORRUPTED (2133571502L)
#define EXT2_ET_BAD_CRC (2133571503L)
#define EXT2_ET_CORRUPT_JOURNAL_SB (2133571504L)
#define EXT2_ET_INODE_CORRUPTED (2133571505L)
extern const struct error_table et_ext2_error_table;
extern void initialize_ext2_error_table(void);
/* For compatibility with Heimdal */
extern void initialize_ext2_error_table_r(struct et_list **list);
#define ERROR_TABLE_BASE_ext2 (2133571328L)
/* for compatibility with older versions... */
#define init_ext2_err_tbl initialize_ext2_error_table
#define ext2_err_base ERROR_TABLE_BASE_ext2

View File

@ -0,0 +1,73 @@
/*
File: linux/ext2_ext_attr.h
On-disk format of extended attributes for the ext2 filesystem.
(C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
*/
#ifndef _EXT2_EXT_ATTR_H
#define _EXT2_EXT_ATTR_H
/* Magic value in attribute blocks */
#define EXT2_EXT_ATTR_MAGIC_v1 0xEA010000
#define EXT2_EXT_ATTR_MAGIC 0xEA020000
/* Maximum number of references to one attribute block */
#define EXT2_EXT_ATTR_REFCOUNT_MAX 1024
struct ext2_ext_attr_header {
__u32 h_magic; /* magic number for identification */
__u32 h_refcount; /* reference count */
__u32 h_blocks; /* number of disk blocks used */
__u32 h_hash; /* hash value of all attributes */
__u32 h_checksum; /* crc32c(uuid+id+xattrs) */
/* id = inum if refcount = 1, else blknum */
__u32 h_reserved[3]; /* zero right now */
};
struct ext2_ext_attr_entry {
__u8 e_name_len; /* length of name */
__u8 e_name_index; /* attribute name index */
__u16 e_value_offs; /* offset in disk block of value */
__u32 e_value_block; /* disk block attribute is stored on (n/i) */
__u32 e_value_size; /* size of attribute value */
__u32 e_hash; /* hash value of name and value */
#if 0
char e_name[0]; /* attribute name */
#endif
};
#define EXT2_EXT_ATTR_PAD_BITS 2
#define EXT2_EXT_ATTR_PAD ((unsigned) 1<<EXT2_EXT_ATTR_PAD_BITS)
#define EXT2_EXT_ATTR_ROUND (EXT2_EXT_ATTR_PAD-1)
#define EXT2_EXT_ATTR_LEN(name_len) \
(((name_len) + EXT2_EXT_ATTR_ROUND + \
sizeof(struct ext2_ext_attr_entry)) & ~EXT2_EXT_ATTR_ROUND)
#define EXT2_EXT_ATTR_NEXT(entry) \
( (struct ext2_ext_attr_entry *)( \
(char *)(entry) + EXT2_EXT_ATTR_LEN((entry)->e_name_len)) )
#define EXT2_EXT_ATTR_SIZE(size) \
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
#define EXT2_EXT_IS_LAST_ENTRY(entry) (*((__u32 *)(entry)) == 0UL)
#define EXT2_EXT_ATTR_NAME(entry) \
(((char *) (entry)) + sizeof(struct ext2_ext_attr_entry))
#define EXT2_XATTR_LEN(name_len) \
(((name_len) + EXT2_EXT_ATTR_ROUND + \
sizeof(struct ext2_xattr_entry)) & ~EXT2_EXT_ATTR_ROUND)
#define EXT2_XATTR_SIZE(size) \
(((size) + EXT2_EXT_ATTR_ROUND) & ~EXT2_EXT_ATTR_ROUND)
#ifdef __KERNEL__
# ifdef CONFIG_EXT2_FS_EXT_ATTR
extern int ext2_get_ext_attr(struct inode *, const char *, char *, size_t, int);
extern int ext2_set_ext_attr(struct inode *, const char *, char *, size_t, int);
extern void ext2_ext_attr_free_inode(struct inode *inode);
extern void ext2_ext_attr_put_super(struct super_block *sb);
extern int ext2_ext_attr_init(void);
extern void ext2_ext_attr_done(void);
# else
# define ext2_get_ext_attr NULL
# define ext2_set_ext_attr NULL
# endif
#endif /* __KERNEL__ */
#endif /* _EXT2_EXT_ATTR_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
/*
* io.h --- the I/O manager abstraction
*
* Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/
#ifndef _EXT2FS_EXT2_IO_H
#define _EXT2FS_EXT2_IO_H
/*
* ext2_loff_t is defined here since unix_io.c needs it.
*/
#if defined(__GNUC__) || defined(HAS_LONG_LONG)
typedef long long ext2_loff_t;
#else
typedef long ext2_loff_t;
#endif
/* llseek.c */
ext2_loff_t ext2fs_llseek (int, ext2_loff_t, int);
typedef struct struct_io_manager *io_manager;
typedef struct struct_io_channel *io_channel;
typedef struct struct_io_stats *io_stats;
#define CHANNEL_FLAGS_WRITETHROUGH 0x01
#define CHANNEL_FLAGS_DISCARD_ZEROES 0x02
#define CHANNEL_FLAGS_BLOCK_DEVICE 0x04
#define io_channel_discard_zeroes_data(i) (i->flags & CHANNEL_FLAGS_DISCARD_ZEROES)
struct struct_io_channel {
errcode_t magic;
io_manager manager;
char *name;
int block_size;
errcode_t (*read_error)(io_channel channel,
unsigned long block,
int count,
void *data,
size_t size,
int actual_bytes_read,
errcode_t error);
errcode_t (*write_error)(io_channel channel,
unsigned long block,
int count,
const void *data,
size_t size,
int actual_bytes_written,
errcode_t error);
int refcount;
int flags;
long reserved[14];
void *private_data;
void *app_data;
int align;
};
struct struct_io_stats {
int num_fields;
int reserved;
unsigned long long bytes_read;
unsigned long long bytes_written;
};
struct struct_io_manager {
errcode_t magic;
const char *name;
errcode_t (*open)(const char *name, int flags, io_channel *channel);
errcode_t (*close)(io_channel channel);
errcode_t (*set_blksize)(io_channel channel, int blksize);
errcode_t (*read_blk)(io_channel channel, unsigned long block,
int count, void *data);
errcode_t (*write_blk)(io_channel channel, unsigned long block,
int count, const void *data);
errcode_t (*flush)(io_channel channel);
errcode_t (*write_byte)(io_channel channel, unsigned long offset,
int count, const void *data);
errcode_t (*set_option)(io_channel channel, const char *option,
const char *arg);
errcode_t (*get_stats)(io_channel channel, io_stats *io_stats);
errcode_t (*read_blk64)(io_channel channel, unsigned long long block,
int count, void *data);
errcode_t (*write_blk64)(io_channel channel, unsigned long long block,
int count, const void *data);
errcode_t (*discard)(io_channel channel, unsigned long long block,
unsigned long long count);
errcode_t (*cache_readahead)(io_channel channel,
unsigned long long block,
unsigned long long count);
errcode_t (*zeroout)(io_channel channel, unsigned long long block,
unsigned long long count);
long reserved[14];
};
#define IO_FLAG_RW 0x0001
#define IO_FLAG_EXCLUSIVE 0x0002
#define IO_FLAG_DIRECT_IO 0x0004
#define IO_FLAG_FORCE_BOUNCE 0x0008
/*
* Convenience functions....
*/
#define io_channel_close(c) ((c)->manager->close((c)))
#define io_channel_set_blksize(c,s) ((c)->manager->set_blksize((c),s))
#define io_channel_read_blk(c,b,n,d) ((c)->manager->read_blk((c),b,n,d))
#define io_channel_write_blk(c,b,n,d) ((c)->manager->write_blk((c),b,n,d))
#define io_channel_flush(c) ((c)->manager->flush((c)))
#define io_channel_bumpcount(c) ((c)->refcount++)
/* io_manager.c */
extern errcode_t io_channel_set_options(io_channel channel,
const char *options);
extern errcode_t io_channel_write_byte(io_channel channel,
unsigned long offset,
int count, const void *data);
extern errcode_t io_channel_read_blk64(io_channel channel,
unsigned long long block,
int count, void *data);
extern errcode_t io_channel_write_blk64(io_channel channel,
unsigned long long block,
int count, const void *data);
extern errcode_t io_channel_discard(io_channel channel,
unsigned long long block,
unsigned long long count);
extern errcode_t io_channel_zeroout(io_channel channel,
unsigned long long block,
unsigned long long count);
extern errcode_t io_channel_alloc_buf(io_channel channel,
int count, void *ptr);
extern errcode_t io_channel_cache_readahead(io_channel io,
unsigned long long block,
unsigned long long count);
/* unix_io.c */
extern io_manager unix_io_manager;
extern io_manager unixfd_io_manager;
/* undo_io.c */
extern io_manager undo_io_manager;
extern errcode_t set_undo_io_backing_manager(io_manager manager);
extern errcode_t set_undo_io_backup_file(char *file_name);
/* test_io.c */
extern io_manager test_io_manager, test_io_backing_manager;
extern void (*test_io_cb_read_blk)
(unsigned long block, int count, errcode_t err);
extern void (*test_io_cb_write_blk)
(unsigned long block, int count, errcode_t err);
extern void (*test_io_cb_read_blk64)
(unsigned long long block, int count, errcode_t err);
extern void (*test_io_cb_write_blk64)
(unsigned long long block, int count, errcode_t err);
extern void (*test_io_cb_set_blksize)
(int blksize, errcode_t err);
#endif /* _EXT2FS_EXT2_IO_H */

View File

@ -0,0 +1,205 @@
/*
* If linux/types.h is already been included, assume it has defined
* everything we need. (cross fingers) Other header files may have
* also defined the types that we need.
*/
#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
!defined(_EXT2_TYPES_H))
#define _EXT2_TYPES_H
#define __S8_TYPEDEF __signed__ char
#define __U8_TYPEDEF unsigned char
#define __S16_TYPEDEF __signed__ short
#define __U16_TYPEDEF unsigned short
#define __S32_TYPEDEF __signed__ int
#define __U32_TYPEDEF unsigned int
#define __S64_TYPEDEF __signed__ long long
#define __U64_TYPEDEF unsigned long long
#ifndef HAVE___U8
#define HAVE___U8
#ifdef __U8_TYPEDEF
typedef __U8_TYPEDEF __u8;
#else
typedef unsigned char __u8;
#endif
#endif /* HAVE___U8 */
#ifndef HAVE___S8
#define HAVE___S8
#ifdef __S8_TYPEDEF
typedef __S8_TYPEDEF __s8;
#else
typedef signed char __s8;
#endif
#endif /* HAVE___S8 */
#ifndef HAVE___U16
#define HAVE___U16
#ifdef __U16_TYPEDEF
typedef __U16_TYPEDEF __u16;
#else
#if (4 == 2)
typedef unsigned int __u16;
#else
#if (2 == 2)
typedef unsigned short __u16;
#else
#undef HAVE___U16
?==error: undefined 16 bit type
#endif /* SIZEOF_SHORT == 2 */
#endif /* SIZEOF_INT == 2 */
#endif /* __U16_TYPEDEF */
#endif /* HAVE___U16 */
#ifndef HAVE___S16
#define HAVE___S16
#ifdef __S16_TYPEDEF
typedef __S16_TYPEDEF __s16;
#else
#if (4 == 2)
typedef int __s16;
#else
#if (2 == 2)
typedef short __s16;
#else
#undef HAVE___S16
?==error: undefined 16 bit type
#endif /* SIZEOF_SHORT == 2 */
#endif /* SIZEOF_INT == 2 */
#endif /* __S16_TYPEDEF */
#endif /* HAVE___S16 */
#ifndef HAVE___U32
#define HAVE___U32
#ifdef __U32_TYPEDEF
typedef __U32_TYPEDEF __u32;
#else
#if (4 == 4)
typedef unsigned int __u32;
#else
#if (8 == 4)
typedef unsigned long __u32;
#else
#if (2 == 4)
typedef unsigned short __u32;
#else
#undef HAVE___U32
?== error: undefined 32 bit type
#endif /* SIZEOF_SHORT == 4 */
#endif /* SIZEOF_LONG == 4 */
#endif /* SIZEOF_INT == 4 */
#endif /* __U32_TYPEDEF */
#endif /* HAVE___U32 */
#ifndef HAVE___S32
#define HAVE___S32
#ifdef __S32_TYPEDEF
typedef __S32_TYPEDEF __s32;
#else
#if (4 == 4)
typedef int __s32;
#else
#if (8 == 4)
typedef long __s32;
#else
#if (2 == 4)
typedef short __s32;
#else
#undef HAVE___S32
?== error: undefined 32 bit type
#endif /* SIZEOF_SHORT == 4 */
#endif /* SIZEOF_LONG == 4 */
#endif /* SIZEOF_INT == 4 */
#endif /* __S32_TYPEDEF */
#endif /* HAVE___S32 */
#ifndef HAVE___U64
#define HAVE___U64
#ifdef __U64_TYPEDEF
typedef __U64_TYPEDEF __u64;
#else
#if (4 == 8)
typedef unsigned int __u64;
#else
#if (8 == 8)
typedef unsigned long long __u64;
#else
#if (8 == 8)
typedef unsigned long __u64;
#else
#undef HAVE___U64
?== error: undefined 64 bit type
#endif /* SIZEOF_LONG_LONG == 8 */
#endif /* SIZEOF_LONG == 8 */
#endif /* SIZEOF_INT == 8 */
#endif /* __U64_TYPEDEF */
#endif /* HAVE___U64 */
#ifndef HAVE___S64
#define HAVE___S64
#ifdef __S64_TYPEDEF
typedef __S64_TYPEDEF __s64;
#else
#if (4 == 8)
typedef int __s64;
#else
#if (8 == 8)
#if defined(__GNUC__)
typedef __signed__ long long __s64;
#else
typedef signed long long __s64;
#endif /* __GNUC__ */
#else
#if (8 == 8)
typedef long __s64;
#else
#undef HAVE___S64
?== error: undefined 64 bit type
#endif /* SIZEOF_LONG_LONG == 8 */
#endif /* SIZEOF_LONG == 8 */
#endif /* SIZEOF_INT == 8 */
#endif /* __S64_TYPEDEF */
#endif /* HAVE___S64 */
#undef __S8_TYPEDEF
#undef __U8_TYPEDEF
#undef __S16_TYPEDEF
#undef __U16_TYPEDEF
#undef __S32_TYPEDEF
#undef __U32_TYPEDEF
#undef __S64_TYPEDEF
#undef __U64_TYPEDEF
#endif /* _*_TYPES_H */
#include <stdint.h>
/* endian checking stuff */
#ifndef EXT2_ENDIAN_H_
#define EXT2_ENDIAN_H_
#ifdef __CHECKER__
# ifndef __bitwise
# define __bitwise __attribute__((bitwise))
# endif
#define __force __attribute__((force))
#else
# ifndef __bitwise
# define __bitwise
# endif
#define __force
#endif
typedef __u16 __bitwise __le16;
typedef __u32 __bitwise __le32;
typedef __u64 __bitwise __le64;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __be32;
typedef __u64 __bitwise __be64;
#endif /* EXT2_ENDIAN_H_ */
/* These defines are needed for the public ext2fs.h header file */
#define HAVE_SYS_TYPES_H 1
#undef WORDS_BIGENDIAN

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,127 @@
/*
* Copyright (c) 2003,2004 Cluster File Systems, Inc, info@clusterfs.com
* Written by Alex Tomas <alex@clusterfs.com>
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Library
* General Public License, version 2.
* %End-Header%
*/
#ifndef _LINUX_EXT3_EXTENTS
#define _LINUX_EXT3_EXTENTS
/*
* ext3_inode has i_block array (total 60 bytes)
* first 4 bytes are used to store:
* - tree depth (0 mean there is no tree yet. all extents in the inode)
* - number of alive extents in the inode
*/
/*
* This is extent tail on-disk structure.
* All other extent structures are 12 bytes long. It turns out that
* block_size % 12 >= 4 for at least all powers of 2 greater than 512, which
* covers all valid ext4 block sizes. Therefore, this tail structure can be
* crammed into the end of the block without having to rebalance the tree.
*/
struct ext3_extent_tail {
__le32 et_checksum; /* crc32c(uuid+inum+extent_block) */
};
/*
* this is extent on-disk structure
* it's used at the bottom of the tree
*/
struct ext3_extent {
__le32 ee_block; /* first logical block extent covers */
__le16 ee_len; /* number of blocks covered by extent */
__le16 ee_start_hi; /* high 16 bits of physical block */
__le32 ee_start; /* low 32 bigs of physical block */
};
/*
* this is index on-disk structure
* it's used at all the levels, but the bottom
*/
struct ext3_extent_idx {
__le32 ei_block; /* index covers logical blocks from 'block' */
__le32 ei_leaf; /* pointer to the physical block of the next *
* level. leaf or next index could bet here */
__le16 ei_leaf_hi; /* high 16 bits of physical block */
__le16 ei_unused;
};
/*
* each block (leaves and indexes), even inode-stored has header
*/
struct ext3_extent_header {
__le16 eh_magic; /* probably will support different formats */
__le16 eh_entries; /* number of valid entries */
__le16 eh_max; /* capacity of store in entries */
__le16 eh_depth; /* has tree real underlying blocks? */
__le32 eh_generation; /* generation of the tree */
};
#define EXT3_EXT_MAGIC 0xf30a
/*
* array of ext3_ext_path contains path to some extent
* creation/lookup routines use it for traversal/splitting/etc
* truncate uses it to simulate recursive walking
*/
struct ext3_ext_path {
__u32 p_block;
__u16 p_depth;
struct ext3_extent *p_ext;
struct ext3_extent_idx *p_idx;
struct ext3_extent_header *p_hdr;
struct buffer_head *p_bh;
};
/*
* EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
* initialized extent. This is 2^15 and not (2^16 - 1), since we use the
* MSB of ee_len field in the extent datastructure to signify if this
* particular extent is an initialized extent or an uninitialized (i.e.
* preallocated).
* EXT_UNINIT_MAX_LEN is the maximum number of blocks we can have in an
* uninitialized extent.
* If ee_len is <= 0x8000, it is an initialized extent. Otherwise, it is an
* uninitialized one. In other words, if MSB of ee_len is set, it is an
* uninitialized extent with only one special scenario when ee_len = 0x8000.
* In this case we can not have an uninitialized extent of zero length and
* thus we make it as a special case of initialized extent with 0x8000 length.
* This way we get better extent-to-group alignment for initialized extents.
* Hence, the maximum number of blocks we can have in an *initialized*
* extent is 2^15 (32768) and in an *uninitialized* extent is 2^15-1 (32767).
*/
#define EXT_INIT_MAX_LEN (1UL << 15)
#define EXT_UNINIT_MAX_LEN (EXT_INIT_MAX_LEN - 1)
#define EXT_MAX_EXTENT_LBLK (((__u64) 1 << 32) - 1)
#define EXT_MAX_EXTENT_PBLK (((__u64) 1 << 48) - 1)
#define EXT_FIRST_EXTENT(__hdr__) \
((struct ext3_extent *) (((char *) (__hdr__)) + \
sizeof(struct ext3_extent_header)))
#define EXT_FIRST_INDEX(__hdr__) \
((struct ext3_extent_idx *) (((char *) (__hdr__)) + \
sizeof(struct ext3_extent_header)))
#define EXT_HAS_FREE_INDEX(__path__) \
(ext2fs_le16_to_cpu((__path__)->p_hdr->eh_entries) < \
ext2fs_le16_to_cpu((__path__)->p_hdr->eh_max))
#define EXT_LAST_EXTENT(__hdr__) \
(EXT_FIRST_EXTENT((__hdr__)) + \
ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1)
#define EXT_LAST_INDEX(__hdr__) \
(EXT_FIRST_INDEX((__hdr__)) + \
ext2fs_le16_to_cpu((__hdr__)->eh_entries) - 1)
#define EXT_MAX_EXTENT(__hdr__) \
(EXT_FIRST_EXTENT((__hdr__)) + \
ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1)
#define EXT_MAX_INDEX(__hdr__) \
(EXT_FIRST_INDEX((__hdr__)) + \
ext2fs_le16_to_cpu((__hdr__)->eh_max) - 1)
#endif /* _LINUX_EXT3_EXTENTS */

View File

@ -0,0 +1,113 @@
/*
* qcow2.h --- structures and function prototypes for qcow2.c to generate
* qcow2 formatted disk images. This format is used originally by QEMU
* for virtual machines, and stores the filesystem data on disk in a
* packed format to avoid creating sparse image files that need lots of
* seeking to read and write.
*
* The qcow2 format supports zlib compression, but that is not yet
* implemented.
*
* It is possible to directly mount a qcow2 image using qemu-nbd:
*
* [root]# modprobe nbd max_part=63
* [root]# qemu-nbd -c /dev/nbd0 image.img
* [root]# mount /dev/nbd0p1 /mnt/qemu
*
* Format details at http://people.gnome.org/~markmc/qcow-image-format.html
*
* Copyright (C) 2010 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com>
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*/
/* Number of l2 tables in memory before writeback */
#define L2_CACHE_PREALLOC 512
#define QCOW_MAGIC (('Q' << 24) | ('F' << 16) | ('I' << 8) | 0xfb)
#define QCOW_VERSION 2
#define QCOW_OFLAG_COPIED (1LL << 63)
#define QCOW_OFLAG_COMPRESSED (1LL << 62)
#define QCOW_COMPRESSED 1
#define QCOW_ENCRYPTED 2
struct ext2_qcow2_hdr {
__u32 magic;
__u32 version;
__u64 backing_file_offset;
__u32 backing_file_size;
__u32 cluster_bits;
__u64 size;
__u32 crypt_method;
__u32 l1_size;
__u64 l1_table_offset;
__u64 refcount_table_offset;
__u32 refcount_table_clusters;
__u32 nb_snapshots;
__u64 snapshots_offset;
};
typedef struct ext2_qcow2_l2_table L2_CACHE_HEAD;
struct ext2_qcow2_l2_table {
__u32 l1_index;
__u64 offset;
__u64 *data;
L2_CACHE_HEAD *next;
};
struct ext2_qcow2_l2_cache {
L2_CACHE_HEAD *used_head;
L2_CACHE_HEAD *used_tail;
L2_CACHE_HEAD *free_head;
__u32 free;
__u32 count;
__u64 next_offset;
};
struct ext2_qcow2_refcount {
__u64 *refcount_table;
__u64 refcount_table_offset;
__u64 refcount_block_offset;
__u32 refcount_table_clusters;
__u32 refcount_table_index;
__u32 refcount_block_index;
__u16 *refcount_block;
};
struct ext2_qcow2_image {
int fd;
struct ext2_qcow2_hdr *hdr;
struct ext2_qcow2_l2_cache *l2_cache;
struct ext2_qcow2_refcount refcount;
__u32 cluster_size;
__u32 cluster_bits;
__u32 l1_size;
__u32 l2_size;
__u64 *l1_table;
__u64 l2_offset;
__u64 l1_offset;
__u64 image_size;
};
/* Function prototypes */
/* qcow2.c */
/* Functions for converting qcow2 image into raw image */
struct ext2_qcow2_hdr *qcow2_read_header(int);
int qcow2_write_raw_image(int, int, struct ext2_qcow2_hdr *);

View File

@ -0,0 +1,215 @@
#ifndef __TDB_H__
#define __TDB_H__
/*
Unix SMB/CIFS implementation.
trivial database library
Copyright (C) Andrew Tridgell 1999-2004
** NOTE! The following LGPL license applies to the tdb
** library. This does NOT imply that all of Samba is released
** under the LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef __cplusplus
extern "C" {
#endif
/* flags to tdb_store() */
#define TDB_REPLACE 1
#define TDB_INSERT 2
#define TDB_MODIFY 3
/* flags for tdb_open() */
#define TDB_DEFAULT 0 /* just a readability place holder */
#define TDB_CLEAR_IF_FIRST 1
#define TDB_INTERNAL 2 /* don't store on disk */
#define TDB_NOLOCK 4 /* don't do any locking */
#define TDB_NOMMAP 8 /* don't use mmap */
#define TDB_CONVERT 16 /* convert endian (internal use) */
#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */
#define TDB_NOSYNC 64 /* don't use synchronous transactions */
#define TDB_SEQNUM 128 /* maintain a sequence number */
#define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret)
/* error codes */
enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK,
TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT,
TDB_ERR_NOEXIST, TDB_ERR_EINVAL, TDB_ERR_RDONLY};
/* debugging uses one of the following levels */
enum tdb_debug_level {TDB_DEBUG_FATAL = 0, TDB_DEBUG_ERROR,
TDB_DEBUG_WARNING, TDB_DEBUG_TRACE};
typedef struct TDB_DATA {
unsigned char *dptr;
size_t dsize;
} TDB_DATA;
#ifndef PRINTF_ATTRIBUTE
#if (__GNUC__ >= 3)
/** Use gcc attribute to check printf fns. a1 is the 1-based index of
* the parameter containing the format, and a2 the index of the first
* argument. Note that some gcc 2.x versions don't handle this
* properly **/
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
#else
#define PRINTF_ATTRIBUTE(a1, a2)
#endif
#endif
/* ext2fs tdb renames */
#define tdb_open ext2fs_tdb_open
#define tdb_open_ex ext2fs_tdb_open_ex
#define tdb_set_max_dead ext2fs_tdb_set_max_dead
#define tdb_reopen ext2fs_tdb_reopen
#define tdb_reopen_all ext2fs_tdb_reopen_all
#define tdb_set_logging_function ext2fs_tdb_set_logging_function
#define tdb_error ext2fs_tdb_error
#define tdb_errorstr ext2fs_tdb_errorstr
#define tdb_fetch ext2fs_tdb_fetch
#define tdb_parse_record ext2fs_tdb_parse_record
#define tdb_delete ext2fs_tdb_delete
#define tdb_store ext2fs_tdb_store
#define tdb_append ext2fs_tdb_append
#define tdb_close ext2fs_tdb_close
#define tdb_firstkey ext2fs_tdb_firstkey
#define tdb_nextkey ext2fs_tdb_nextkey
#define tdb_traverse ext2fs_tdb_traverse
#define tdb_traverse_read ext2fs_tdb_traverse_read
#define tdb_exists ext2fs_tdb_exists
#define tdb_lockall ext2fs_tdb_lockall
#define tdb_unlockall ext2fs_tdb_unlockall
#define tdb_lockall_read ext2fs_tdb_lockall_read
#define tdb_unlockall_read ext2fs_tdb_unlockall_read
#define tdb_name ext2fs_tdb_name
#define tdb_fd ext2fs_tdb_fd
#define tdb_log_fn ext2fs_tdb_log_fn
#define tdb_get_logging_private ext2fs_tdb_get_logging_private
#define tdb_transaction_start ext2fs_tdb_transaction_start
#define tdb_transaction_commit ext2fs_tdb_transaction_commit
#define tdb_transaction_cancel ext2fs_tdb_transaction_cancel
#define tdb_transaction_recover ext2fs_tdb_transaction_recover
#define tdb_get_seqnum ext2fs_tdb_get_seqnum
#define tdb_hash_size ext2fs_tdb_hash_size
#define tdb_map_size ext2fs_tdb_map_size
#define tdb_get_flags ext2fs_tdb_get_flags
#define tdb_chainlock ext2fs_tdb_chainlock
#define tdb_chainunlock ext2fs_tdb_chainunlock
#define tdb_chainlock_read ext2fs_tdb_chainlock_read
#define tdb_chainunlock_read ext2fs_tdb_chainunlock_read
#define tdb_dump_all ext2fs_tdb_dump_all
#define tdb_printfreelist ext2fs_tdb_printfreelist
#define tdb_validate_freelist ext2fs_tdb_validate_freelist
#define tdb_chainlock_mark ext2fs_tdb_chainlock_mark
#define tdb_chainlock_nonblock ext2fs_tdb_chainlock_nonblock
#define tdb_chainlock_unmark ext2fs_tdb_chainlock_unmark
#define tdb_enable_seqnum ext2fs_tdb_enable_seqnum
#define tdb_increment_seqnum_nonblock ext2fs_tdb_increment_seqnum_nonblock
#define tdb_lock_nonblock ext2fs_tdb_lock_nonblock
#define tdb_lockall_mark ext2fs_tdb_lockall_mark
#define tdb_lockall_nonblock ext2fs_tdb_lockall_nonblock
#define tdb_lockall_read_nonblock ext2fs_tdb_lockall_read_nonblock
#define tdb_lockall_unmark ext2fs_tdb_lockall_unmark
#define tdb_flush ext2fs_tdb_flush
/* this is the context structure that is returned from a db open */
typedef struct tdb_context TDB_CONTEXT;
typedef int (*tdb_traverse_func)(struct tdb_context *, TDB_DATA, TDB_DATA, void *);
typedef void (*tdb_log_func)(struct tdb_context *, enum tdb_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4);
typedef unsigned int (*tdb_hash_func)(TDB_DATA *key);
struct tdb_logging_context {
tdb_log_func log_fn;
void *log_private;
};
struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode);
struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
int open_flags, mode_t mode,
const struct tdb_logging_context *log_ctx,
tdb_hash_func hash_fn);
void tdb_set_max_dead(struct tdb_context *tdb, int max_dead);
int tdb_reopen(struct tdb_context *tdb);
int tdb_reopen_all(int parent_longlived);
void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx);
enum TDB_ERROR tdb_error(struct tdb_context *tdb);
const char *tdb_errorstr(struct tdb_context *tdb);
TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key);
int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key,
int (*parser)(TDB_DATA key, TDB_DATA data,
void *private_data),
void *private_data);
int tdb_delete(struct tdb_context *tdb, TDB_DATA key);
int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag);
int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf);
int tdb_close(struct tdb_context *tdb);
TDB_DATA tdb_firstkey(struct tdb_context *tdb);
TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key);
int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *);
int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *);
int tdb_exists(struct tdb_context *tdb, TDB_DATA key);
int tdb_lockall(struct tdb_context *tdb);
int tdb_lockall_nonblock(struct tdb_context *tdb);
int tdb_unlockall(struct tdb_context *tdb);
int tdb_lockall_read(struct tdb_context *tdb);
int tdb_lockall_read_nonblock(struct tdb_context *tdb);
int tdb_unlockall_read(struct tdb_context *tdb);
int tdb_lockall_mark(struct tdb_context *tdb);
int tdb_lockall_unmark(struct tdb_context *tdb);
const char *tdb_name(struct tdb_context *tdb);
int tdb_fd(struct tdb_context *tdb);
tdb_log_func tdb_log_fn(struct tdb_context *tdb);
void *tdb_get_logging_private(struct tdb_context *tdb);
int tdb_transaction_start(struct tdb_context *tdb);
int tdb_transaction_commit(struct tdb_context *tdb);
int tdb_transaction_cancel(struct tdb_context *tdb);
int tdb_transaction_recover(struct tdb_context *tdb);
int tdb_get_seqnum(struct tdb_context *tdb);
int tdb_hash_size(struct tdb_context *tdb);
size_t tdb_map_size(struct tdb_context *tdb);
int tdb_get_flags(struct tdb_context *tdb);
void tdb_enable_seqnum(struct tdb_context *tdb);
void tdb_increment_seqnum_nonblock(struct tdb_context *tdb);
int tdb_flush(struct tdb_context *tdb);
/* Low level locking functions: use with care */
int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key);
int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key);
/* Debug functions. Not used in production. */
void tdb_dump_all(struct tdb_context *tdb);
int tdb_printfreelist(struct tdb_context *tdb);
int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries);
#ifdef __cplusplus
}
#endif
#endif /* tdb.h */

View File

@ -0,0 +1,346 @@
/* JIT declarations for GDB, the GNU Debugger.
Copyright (C) 2011-2016 Free Software Foundation, Inc.
This file is part of GDB.
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 GDB_JIT_READER_H
#define GDB_JIT_READER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Versioning information. See gdb_reader_funcs. */
#define GDB_READER_INTERFACE_VERSION 1
/* Readers must be released under a GPL compatible license. To
declare that the reader is indeed released under a GPL compatible
license, invoke the macro GDB_DECLARE_GPL_COMPATIBLE in a source
file. */
#ifdef __cplusplus
#define GDB_DECLARE_GPL_COMPATIBLE_READER \
extern "C" { \
extern int plugin_is_GPL_compatible (void); \
extern int plugin_is_GPL_compatible (void) \
{ \
return 0; \
} \
}
#else
#define GDB_DECLARE_GPL_COMPATIBLE_READER \
extern int plugin_is_GPL_compatible (void); \
extern int plugin_is_GPL_compatible (void) \
{ \
return 0; \
}
#endif
/* Represents an address on the target system. */
typedef unsigned long GDB_CORE_ADDR;
/* Return status codes. */
enum gdb_status {
GDB_FAIL = 0,
GDB_SUCCESS = 1
};
struct gdb_object;
struct gdb_symtab;
struct gdb_block;
struct gdb_symbol_callbacks;
/* An array of these are used to represent a map from code addresses to line
numbers in the source file. */
struct gdb_line_mapping
{
int line;
GDB_CORE_ADDR pc;
};
/* Create a new GDB code object. Each code object can have one or
more symbol tables, each representing a compiled source file. */
typedef struct gdb_object *(gdb_object_open) (struct gdb_symbol_callbacks *cb);
/* The callback used to create new symbol table. CB is the
gdb_symbol_callbacks which the structure is part of. FILE_NAME is
an (optionally NULL) file name to associate with this new symbol
table.
Returns a new instance to gdb_symtab that can later be passed to
gdb_block_new, gdb_symtab_add_line_mapping and gdb_symtab_close. */
typedef struct gdb_symtab *(gdb_symtab_open) (struct gdb_symbol_callbacks *cb,
struct gdb_object *obj,
const char *file_name);
/* Creates a new block in a given symbol table. A symbol table is a
forest of blocks, each block representing an code address range and
a corresponding (optionally NULL) NAME. In case the block
corresponds to a function, the NAME passed should be the name of
the function.
If the new block to be created is a child of (i.e. is nested in)
another block, the parent block can be passed in PARENT. SYMTAB is
the symbol table the new block is to belong in. BEGIN, END is the
code address range the block corresponds to.
Returns a new instance of gdb_block, which, as of now, has no use.
Note that the gdb_block returned must not be freed by the
caller. */
typedef struct gdb_block *(gdb_block_open) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab,
struct gdb_block *parent,
GDB_CORE_ADDR begin,
GDB_CORE_ADDR end,
const char *name);
/* Adds a PC to line number mapping for the symbol table SYMTAB.
NLINES is the number of elements in LINES, each element
corresponding to one (PC, line) pair. */
typedef void (gdb_symtab_add_line_mapping) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab,
int nlines,
struct gdb_line_mapping *lines);
/* Close the symtab SYMTAB. This signals to GDB that no more blocks
will be opened on this symtab. */
typedef void (gdb_symtab_close) (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab);
/* Closes the gdb_object OBJ and adds the emitted information into
GDB's internal structures. Once this is done, the debug
information will be picked up and used; this will usually be the
last operation in gdb_read_debug_info. */
typedef void (gdb_object_close) (struct gdb_symbol_callbacks *cb,
struct gdb_object *obj);
/* Reads LEN bytes from TARGET_MEM in the target's virtual address
space into GDB_BUF.
Returns GDB_FAIL on failure, and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_target_read) (GDB_CORE_ADDR target_mem,
void *gdb_buf, int len);
/* The list of callbacks that are passed to read. These callbacks are
to be used to construct the symbol table. The functions have been
described above. */
struct gdb_symbol_callbacks
{
gdb_object_open *object_open;
gdb_symtab_open *symtab_open;
gdb_block_open *block_open;
gdb_symtab_close *symtab_close;
gdb_object_close *object_close;
gdb_symtab_add_line_mapping *line_mapping_add;
gdb_target_read *target_read;
/* For internal use by GDB. */
void *priv_data;
};
/* Forward declaration. */
struct gdb_reg_value;
/* A function of this type is used to free a gdb_reg_value. See the
comment on `free' in struct gdb_reg_value. */
typedef void (gdb_reg_value_free) (struct gdb_reg_value *);
/* Denotes the value of a register. */
struct gdb_reg_value
{
/* The size of the register in bytes. The reader need not set this
field. This will be set for (defined) register values being read
from GDB using reg_get. */
int size;
/* Set to non-zero if the value for the register is known. The
registers for which the reader does not call reg_set are also
assumed to be undefined */
int defined;
/* Since gdb_reg_value is a variable sized structure, it will
usually be allocated on the heap. This function is expected to
contain the corresponding "free" function.
When a pointer to gdb_reg_value is being sent from GDB to the
reader (via gdb_unwind_reg_get), the reader is expected to call
this function (with the same gdb_reg_value as argument) once it
is done with the value.
When the function sends the a gdb_reg_value to GDB (via
gdb_unwind_reg_set), it is expected to set this field to point to
an appropriate cleanup routine (or to NULL if no cleanup is
required). */
gdb_reg_value_free *free;
/* The value of the register. */
unsigned char value[1];
};
/* get_frame_id in gdb_reader_funcs is to return a gdb_frame_id
corresponding to the current frame. The registers corresponding to
the current frame can be read using reg_get. Calling get_frame_id
on a particular frame should return the same gdb_frame_id
throughout its lifetime (i.e. till before it gets unwound). One
way to do this is by having the CODE_ADDRESS point to the
function's first instruction and STACK_ADDRESS point to the value
of the stack pointer when entering the function. */
struct gdb_frame_id
{
GDB_CORE_ADDR code_address;
GDB_CORE_ADDR stack_address;
};
/* Forward declaration. */
struct gdb_unwind_callbacks;
/* Returns the value of a particular register in the current frame.
The current frame is the frame that needs to be unwound into the
outer (earlier) frame.
CB is the struct gdb_unwind_callbacks * the callback belongs to.
REGNUM is the DWARF register number of the register that needs to
be unwound.
Returns the gdb_reg_value corresponding to the register requested.
In case the value of the register has been optimized away or
otherwise unavailable, the defined flag in the returned
gdb_reg_value will be zero. */
typedef struct gdb_reg_value *(gdb_unwind_reg_get)
(struct gdb_unwind_callbacks *cb, int regnum);
/* Sets the previous value of a particular register. REGNUM is the
(DWARF) register number whose value is to be set. VAL is the value
the register is to be set to.
VAL is *not* copied, so the memory allocated to it cannot be
reused. Once GDB no longer needs the value, it is deallocated
using the FREE function (see gdb_reg_value).
A register can also be "set" to an undefined value by setting the
defined in VAL to zero. */
typedef void (gdb_unwind_reg_set) (struct gdb_unwind_callbacks *cb, int regnum,
struct gdb_reg_value *val);
/* This struct is passed to unwind in gdb_reader_funcs, and is to be
used to unwind the current frame (current being the frame whose
registers can be read using reg_get) into the earlier frame. The
functions have been described above. */
struct gdb_unwind_callbacks
{
gdb_unwind_reg_get *reg_get;
gdb_unwind_reg_set *reg_set;
gdb_target_read *target_read;
/* For internal use by GDB. */
void *priv_data;
};
/* Forward declaration. */
struct gdb_reader_funcs;
/* Parse the debug info off a block of memory, pointed to by MEMORY
(already copied to GDB's address space) and MEMORY_SZ bytes long.
The implementation has to use the functions in CB to actually emit
the parsed data into GDB. SELF is the same structure returned by
gdb_init_reader.
Return GDB_FAIL on failure and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_read_debug_info) (struct gdb_reader_funcs *self,
struct gdb_symbol_callbacks *cb,
void *memory, long memory_sz);
/* Unwind the current frame, CB is the set of unwind callbacks that
are to be used to do this.
Return GDB_FAIL on failure and GDB_SUCCESS on success. */
typedef enum gdb_status (gdb_unwind_frame) (struct gdb_reader_funcs *self,
struct gdb_unwind_callbacks *cb);
/* Return the frame ID corresponding to the current frame, using C to
read the current register values. See the comment on struct
gdb_frame_id. */
typedef struct gdb_frame_id (gdb_get_frame_id) (struct gdb_reader_funcs *self,
struct gdb_unwind_callbacks *c);
/* Called when a reader is being unloaded. This function should also
free SELF, if required. */
typedef void (gdb_destroy_reader) (struct gdb_reader_funcs *self);
/* Called when the reader is loaded. Must either return a properly
populated gdb_reader_funcs or NULL. The memory allocated for the
gdb_reader_funcs is to be managed by the reader itself (i.e. if it
is allocated from the heap, it must also be freed in
gdb_destroy_reader). */
extern struct gdb_reader_funcs *gdb_init_reader (void);
/* Pointer to the functions which implement the reader's
functionality. The individual functions have been documented
above.
None of the fields are optional. */
struct gdb_reader_funcs
{
/* Must be set to GDB_READER_INTERFACE_VERSION. */
int reader_version;
/* For use by the reader. */
void *priv_data;
gdb_read_debug_info *read;
gdb_unwind_frame *unwind;
gdb_get_frame_id *get_frame_id;
gdb_destroy_reader *destroy;
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -0,0 +1,357 @@
/* Public API for GNU gettext PO files - contained in libgettextpo.
Copyright (C) 2003-2008, 2010, 2015-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
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 _GETTEXT_PO_H
#define _GETTEXT_PO_H 1
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/* =========================== Meta Information ============================ */
/* Version number: (major<<16) + (minor<<8) + subminor */
#define LIBGETTEXTPO_VERSION 0x001308
extern int libgettextpo_version;
/* ================================= Types ================================= */
/* A po_file_t represents the contents of a PO file. */
typedef struct po_file *po_file_t;
/* A po_message_iterator_t represents an iterator through a domain of a
PO file. */
typedef struct po_message_iterator *po_message_iterator_t;
/* A po_message_t represents a message in a PO file. */
typedef struct po_message *po_message_t;
/* A po_filepos_t represents a string's position within a source file. */
typedef struct po_filepos *po_filepos_t;
/* A po_error_handler handles error situations. */
struct po_error_handler
{
/* Signal an error. The error message is built from FORMAT and the following
arguments. ERRNUM, if nonzero, is an errno value.
Must increment the error_message_count variable declared in error.h.
Must not return if STATUS is nonzero. */
void (*error) (int status, int errnum,
const char *format, ...)
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__
__attribute__ ((__format__ (__printf__, 3, 4)))
#endif
;
/* Signal an error. The error message is built from FORMAT and the following
arguments. The error location is at FILENAME line LINENO. ERRNUM, if
nonzero, is an errno value.
Must increment the error_message_count variable declared in error.h.
Must not return if STATUS is nonzero. */
void (*error_at_line) (int status, int errnum,
const char *filename, unsigned int lineno,
const char *format, ...)
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__
__attribute__ ((__format__ (__printf__, 5, 6)))
#endif
;
/* Signal a multiline warning. The PREFIX applies to all lines of the
MESSAGE. Free the PREFIX and MESSAGE when done. */
void (*multiline_warning) (char *prefix, char *message);
/* Signal a multiline error. The PREFIX applies to all lines of the
MESSAGE. Free the PREFIX and MESSAGE when done.
Must increment the error_message_count variable declared in error.h if
PREFIX is non-NULL. */
void (*multiline_error) (char *prefix, char *message);
};
typedef const struct po_error_handler *po_error_handler_t;
/* A po_xerror_handler handles warnings, error and fatal error situations. */
#define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */
#define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */
#define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */
struct po_xerror_handler
{
/* Signal a problem of the given severity.
MESSAGE and/or FILENAME + LINENO indicate where the problem occurred.
If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored.
If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored.
If COLUMN is (size_t)(-1), it should be ignored.
MESSAGE_TEXT is the problem description (if MULTILINE_P is true,
multiple lines of text, each terminated with a newline, otherwise
usually a single line).
Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */
void (*xerror) (int severity,
po_message_t message,
const char *filename, size_t lineno, size_t column,
int multiline_p, const char *message_text);
/* Signal a problem that refers to two messages.
Similar to two calls to xerror.
If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to
MESSAGE_TEXT2. */
void (*xerror2) (int severity,
po_message_t message1,
const char *filename1, size_t lineno1, size_t column1,
int multiline_p1, const char *message_text1,
po_message_t message2,
const char *filename2, size_t lineno2, size_t column2,
int multiline_p2, const char *message_text2);
};
typedef const struct po_xerror_handler *po_xerror_handler_t;
/* Memory allocation:
The memory allocations performed by these functions use xmalloc(),
therefore will cause a program exit if memory is exhausted.
The memory allocated by po_file_read, and implicitly returned through
the po_message_* functions, lasts until freed with po_file_free. */
/* ============================= po_file_t API ============================= */
/* Create an empty PO file representation in memory. */
extern po_file_t po_file_create (void);
/* Read a PO file into memory.
Return its contents. Upon failure, return NULL and set errno. */
#define po_file_read po_file_read_v3
extern po_file_t po_file_read (const char *filename,
po_xerror_handler_t handler);
/* Write an in-memory PO file to a file.
Upon failure, return NULL and set errno. */
#define po_file_write po_file_write_v2
extern po_file_t po_file_write (po_file_t file, const char *filename,
po_xerror_handler_t handler);
/* Free a PO file from memory. */
extern void po_file_free (po_file_t file);
/* Return the names of the domains covered by a PO file in memory. */
extern const char * const * po_file_domains (po_file_t file);
/* =========================== Header entry API ============================ */
/* Return the header entry of a domain of a PO file in memory.
The domain NULL denotes the default domain.
Return NULL if there is no header entry. */
extern const char * po_file_domain_header (po_file_t file, const char *domain);
/* Return the value of a field in a header entry.
The return value is either a freshly allocated string, to be freed by the
caller, or NULL. */
extern char * po_header_field (const char *header, const char *field);
/* Return the header entry with a given field set to a given value. The field
is added if necessary.
The return value is a freshly allocated string. */
extern char * po_header_set_field (const char *header, const char *field, const char *value);
/* ======================= po_message_iterator_t API ======================= */
/* Create an iterator for traversing a domain of a PO file in memory.
The domain NULL denotes the default domain. */
extern po_message_iterator_t po_message_iterator (po_file_t file, const char *domain);
/* Free an iterator. */
extern void po_message_iterator_free (po_message_iterator_t iterator);
/* Return the next message, and advance the iterator.
Return NULL at the end of the message list. */
extern po_message_t po_next_message (po_message_iterator_t iterator);
/* Insert a message in a PO file in memory, in the domain and at the position
indicated by the iterator. The iterator thereby advances past the freshly
inserted message. */
extern void po_message_insert (po_message_iterator_t iterator, po_message_t message);
/* =========================== po_message_t API ============================ */
/* Return a freshly constructed message.
To finish initializing the message, you must set the msgid and msgstr. */
extern po_message_t po_message_create (void);
/* Return the context of a message, or NULL for a message not restricted to a
context. */
extern const char * po_message_msgctxt (po_message_t message);
/* Change the context of a message. NULL means a message not restricted to a
context. */
extern void po_message_set_msgctxt (po_message_t message, const char *msgctxt);
/* Return the msgid (untranslated English string) of a message. */
extern const char * po_message_msgid (po_message_t message);
/* Change the msgid (untranslated English string) of a message. */
extern void po_message_set_msgid (po_message_t message, const char *msgid);
/* Return the msgid_plural (untranslated English plural string) of a message,
or NULL for a message without plural. */
extern const char * po_message_msgid_plural (po_message_t message);
/* Change the msgid_plural (untranslated English plural string) of a message.
NULL means a message without plural. */
extern void po_message_set_msgid_plural (po_message_t message, const char *msgid_plural);
/* Return the msgstr (translation) of a message.
Return the empty string for an untranslated message. */
extern const char * po_message_msgstr (po_message_t message);
/* Change the msgstr (translation) of a message.
Use an empty string to denote an untranslated message. */
extern void po_message_set_msgstr (po_message_t message, const char *msgstr);
/* Return the msgstr[index] for a message with plural handling, or
NULL when the index is out of range or for a message without plural. */
extern const char * po_message_msgstr_plural (po_message_t message, int index);
/* Change the msgstr[index] for a message with plural handling.
Use a NULL value at the end to reduce the number of plural forms. */
extern void po_message_set_msgstr_plural (po_message_t message, int index, const char *msgstr);
/* Return the comments for a message. */
extern const char * po_message_comments (po_message_t message);
/* Change the comments for a message.
comments should be a multiline string, ending in a newline, or empty. */
extern void po_message_set_comments (po_message_t message, const char *comments);
/* Return the extracted comments for a message. */
extern const char * po_message_extracted_comments (po_message_t message);
/* Change the extracted comments for a message.
comments should be a multiline string, ending in a newline, or empty. */
extern void po_message_set_extracted_comments (po_message_t message, const char *comments);
/* Return the i-th file position for a message, or NULL if i is out of
range. */
extern po_filepos_t po_message_filepos (po_message_t message, int i);
/* Remove the i-th file position from a message.
The indices of all following file positions for the message are decremented
by one. */
extern void po_message_remove_filepos (po_message_t message, int i);
/* Add a file position to a message, if it is not already present for the
message.
file is the file name.
start_line is the line number where the string starts, or (size_t)(-1) if no
line number is available. */
extern void po_message_add_filepos (po_message_t message, const char *file, size_t start_line);
/* Return the previous context of a message, or NULL for none. */
extern const char * po_message_prev_msgctxt (po_message_t message);
/* Change the previous context of a message. NULL is allowed. */
extern void po_message_set_prev_msgctxt (po_message_t message, const char *prev_msgctxt);
/* Return the previous msgid (untranslated English string) of a message, or
NULL for none. */
extern const char * po_message_prev_msgid (po_message_t message);
/* Change the previous msgid (untranslated English string) of a message.
NULL is allowed. */
extern void po_message_set_prev_msgid (po_message_t message, const char *prev_msgid);
/* Return the previous msgid_plural (untranslated English plural string) of a
message, or NULL for none. */
extern const char * po_message_prev_msgid_plural (po_message_t message);
/* Change the previous msgid_plural (untranslated English plural string) of a
message. NULL is allowed. */
extern void po_message_set_prev_msgid_plural (po_message_t message, const char *prev_msgid_plural);
/* Return true if the message is marked obsolete. */
extern int po_message_is_obsolete (po_message_t message);
/* Change the obsolete mark of a message. */
extern void po_message_set_obsolete (po_message_t message, int obsolete);
/* Return true if the message is marked fuzzy. */
extern int po_message_is_fuzzy (po_message_t message);
/* Change the fuzzy mark of a message. */
extern void po_message_set_fuzzy (po_message_t message, int fuzzy);
/* Return true if the message is marked as being a format string of the given
type (e.g. "c-format"). */
extern int po_message_is_format (po_message_t message, const char *format_type);
/* Change the format string mark for a given type of a message. */
extern void po_message_set_format (po_message_t message, const char *format_type, /*bool*/int value);
/* If a numeric range of a message is set, return true and store the minimum
and maximum value in *MINP and *MAXP. */
extern int po_message_is_range (po_message_t message, int *minp, int *maxp);
/* Change the numeric range of a message. MIN and MAX must be non-negative,
with MIN < MAX. Use MIN = MAX = -1 to remove the numeric range of a
message. */
extern void po_message_set_range (po_message_t message, int min, int max);
/* =========================== po_filepos_t API ============================ */
/* Return the file name. */
extern const char * po_filepos_file (po_filepos_t filepos);
/* Return the line number where the string starts, or (size_t)(-1) if no line
number is available. */
extern size_t po_filepos_start_line (po_filepos_t filepos);
/* ============================ Format type API ============================= */
/* Return a NULL terminated array of the supported format types. */
extern const char * const * po_format_list (void);
/* Return the pretty name associated with a format type.
For example, for "csharp-format", return "C#".
Return NULL if the argument is not a supported format type. */
extern const char * po_format_pretty_name (const char *format_type);
/* ============================= Checking API ============================== */
/* Test whether an entire file PO file is valid, like msgfmt does it.
If it is invalid, pass the reasons to the handler. */
extern void po_file_check_all (po_file_t file, po_xerror_handler_t handler);
/* Test a single message, to be inserted in a PO file in memory, like msgfmt
does it. If it is invalid, pass the reasons to the handler. The iterator
is not modified by this call; it only specifies the file and the domain. */
extern void po_message_check_all (po_message_t message, po_message_iterator_t iterator, po_xerror_handler_t handler);
/* Test whether the message translation is a valid format string if the message
is marked as being a format string. If it is invalid, pass the reasons to
the handler. */
#define po_message_check_format po_message_check_format_v2
extern void po_message_check_format (po_message_t message, po_xerror_handler_t handler);
#ifdef __cplusplus
}
#endif
#endif /* _GETTEXT_PO_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,761 @@
/*
* libfdisk.h - libfdisk API
*
* Copyright (C) 2012-2014 Karel Zak <kzak@redhat.com>
*
* 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 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.
*/
#ifndef _LIBFDISK_H
#define _LIBFDISK_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>
/**
* LIBFDISK_VERSION:
*
* Library version string
*/
#define LIBFDISK_VERSION "2.31.1"
#define LIBFDISK_MAJOR_VERSION 2
#define LIBFDISK_MINOR_VERSION 31
#define LIBFDISK_PATCH_VERSION 1
/**
* fdisk_context:
*
* Basic library handler.
*/
struct fdisk_context;
/**
* fdisk_label:
*
* Disk label specific driver and setting.
*/
struct fdisk_label;
/**
* fdisk_parttype:
*
* Partition type.
*/
struct fdisk_parttype;
/**
* fdisk_partition:
*
* Partition abstraction (and template).
*/
struct fdisk_partition;
/**
* fdisk_ask:
*
* Ask API handler for dialogs with users.
*/
struct fdisk_ask;
/**
* fdisk_iter:
*
* Unified iterator.
*/
struct fdisk_iter;
/**
* fdisk_table:
*
* Container for fdisk_partition objects
*/
struct fdisk_table;
/**
* fdisk_field
*
* Output field description.
*/
struct fdisk_field;
/**
* fdisk_script
*
* library handler for sfdisk compatible scripts and dumps
*/
struct fdisk_script;
/**
* fdisk_sector_t
*
* LBA adresses type
*/
typedef uint64_t fdisk_sector_t;
/**
* fdisk_labeltype:
*
* Supported partition table types (labels)
*/
enum fdisk_labeltype {
FDISK_DISKLABEL_DOS = (1 << 1), /* MBR label type */
FDISK_DISKLABEL_SUN = (1 << 2), /* SUN label type */
FDISK_DISKLABEL_SGI = (1 << 3), /* SGI label type */
FDISK_DISKLABEL_BSD = (1 << 4), /* BSD label t ype */
FDISK_DISKLABEL_GPT = (1 << 5) /* UEFI GPT type */
};
/**
* fdisk_labelitem
*
* library handler for label specific information. See
* generic FDISK_LABELITEM_* and label specific {GPT,MBR,..}_LABELITEM_*.
*/
struct fdisk_labelitem;
/**
* fdisk_asktype:
*
* Ask API dialog types
*/
enum fdisk_asktype {
FDISK_ASKTYPE_NONE = 0, /* undefined type */
FDISK_ASKTYPE_NUMBER, /* ask for number */
FDISK_ASKTYPE_OFFSET, /* ask for offset */
FDISK_ASKTYPE_WARN, /* print warning message and errno */
FDISK_ASKTYPE_WARNX, /* print warning message */
FDISK_ASKTYPE_INFO, /* print infor message */
FDISK_ASKTYPE_YESNO, /* ask Yes/No question */
FDISK_ASKTYPE_STRING, /* ask for string */
FDISK_ASKTYPE_MENU /* ask for menu item */
};
/* init.c */
extern void fdisk_init_debug(int mask);
/* version.c */
extern int fdisk_parse_version_string(const char *ver_string);
extern int fdisk_get_library_version(const char **ver_string);
extern int fdisk_get_library_features(const char ***features);
/* context.h */
#define FDISK_PLURAL 0
#define FDISK_SINGULAR 1
struct fdisk_context *fdisk_new_context(void);
struct fdisk_context *fdisk_new_nested_context(struct fdisk_context *parent, const char *name);
void fdisk_unref_context(struct fdisk_context *cxt);
void fdisk_ref_context(struct fdisk_context *cxt);
struct fdisk_context *fdisk_get_parent(struct fdisk_context *cxt);
size_t fdisk_get_npartitions(struct fdisk_context *cxt);
struct fdisk_label *fdisk_get_label(struct fdisk_context *cxt, const char *name);
int fdisk_next_label(struct fdisk_context *cxt, struct fdisk_label **lb);
size_t fdisk_get_nlabels(struct fdisk_context *cxt);
int fdisk_has_label(struct fdisk_context *cxt);
int fdisk_is_labeltype(struct fdisk_context *cxt, enum fdisk_labeltype id);
#define fdisk_is_label(c, x) fdisk_is_labeltype(c, FDISK_DISKLABEL_ ## x)
int fdisk_assign_device(struct fdisk_context *cxt,
const char *fname, int readonly);
int fdisk_deassign_device(struct fdisk_context *cxt, int nosync);
int fdisk_reassign_device(struct fdisk_context *cxt);
int fdisk_is_readonly(struct fdisk_context *cxt);
int fdisk_is_regfile(struct fdisk_context *cxt);
int fdisk_device_is_used(struct fdisk_context *cxt);
int fdisk_disable_dialogs(struct fdisk_context *cxt, int disable);
int fdisk_has_dialogs(struct fdisk_context *cxt);
int fdisk_enable_details(struct fdisk_context *cxt, int enable);
int fdisk_is_details(struct fdisk_context *cxt);
int fdisk_enable_listonly(struct fdisk_context *cxt, int enable);
int fdisk_is_listonly(struct fdisk_context *cxt);
int fdisk_enable_wipe(struct fdisk_context *cxt, int enable);
int fdisk_has_wipe(struct fdisk_context *cxt);
const char *fdisk_get_collision(struct fdisk_context *cxt);
int fdisk_is_ptcollision(struct fdisk_context *cxt);
int fdisk_set_unit(struct fdisk_context *cxt, const char *str);
const char *fdisk_get_unit(struct fdisk_context *cxt, int n);
int fdisk_use_cylinders(struct fdisk_context *cxt);
unsigned int fdisk_get_units_per_sector(struct fdisk_context *cxt);
unsigned long fdisk_get_optimal_iosize(struct fdisk_context *cxt);
unsigned long fdisk_get_minimal_iosize(struct fdisk_context *cxt);
unsigned long fdisk_get_physector_size(struct fdisk_context *cxt);
unsigned long fdisk_get_sector_size(struct fdisk_context *cxt);
unsigned long fdisk_get_alignment_offset(struct fdisk_context *cxt);
unsigned long fdisk_get_grain_size(struct fdisk_context *cxt);
fdisk_sector_t fdisk_get_first_lba(struct fdisk_context *cxt);
fdisk_sector_t fdisk_set_first_lba(struct fdisk_context *cxt, fdisk_sector_t lba);
fdisk_sector_t fdisk_get_last_lba(struct fdisk_context *cxt);
fdisk_sector_t fdisk_set_last_lba(struct fdisk_context *cxt, fdisk_sector_t lba);
fdisk_sector_t fdisk_get_nsectors(struct fdisk_context *cxt);
const char *fdisk_get_devname(struct fdisk_context *cxt);
int fdisk_get_devfd(struct fdisk_context *cxt);
unsigned int fdisk_get_geom_heads(struct fdisk_context *cxt);
fdisk_sector_t fdisk_get_geom_sectors(struct fdisk_context *cxt);
fdisk_sector_t fdisk_get_geom_cylinders(struct fdisk_context *cxt);
enum {
FDISK_SIZEUNIT_HUMAN = 0, /* default, human readable {M,G,P,...} */
FDISK_SIZEUNIT_BYTES /* bytes */
};
int fdisk_set_size_unit(struct fdisk_context *cxt, int unit);
int fdisk_get_size_unit(struct fdisk_context *cxt);
int fdisk_has_protected_bootbits(struct fdisk_context *cxt);
int fdisk_enable_bootbits_protection(struct fdisk_context *cxt, int enable);
/* parttype.c */
struct fdisk_parttype *fdisk_new_parttype(void);
void fdisk_ref_parttype(struct fdisk_parttype *t);
void fdisk_unref_parttype(struct fdisk_parttype *t);
int fdisk_parttype_set_name(struct fdisk_parttype *t, const char *str);
int fdisk_parttype_set_typestr(struct fdisk_parttype *t, const char *str);
int fdisk_parttype_set_code(struct fdisk_parttype *t, int code);
size_t fdisk_label_get_nparttypes(const struct fdisk_label *lb);
struct fdisk_parttype *fdisk_label_get_parttype(const struct fdisk_label *lb, size_t n);
int fdisk_label_has_code_parttypes(const struct fdisk_label *lb);
struct fdisk_parttype *fdisk_label_get_parttype_from_code(
const struct fdisk_label *lb,
unsigned int code);
struct fdisk_parttype *fdisk_label_get_parttype_from_string(
const struct fdisk_label *lb,
const char *str);
struct fdisk_parttype *fdisk_new_unknown_parttype(unsigned int code,
const char *typestr);
struct fdisk_parttype *fdisk_copy_parttype(const struct fdisk_parttype *type);
struct fdisk_parttype *fdisk_label_parse_parttype(
const struct fdisk_label *lb,
const char *str);
const char *fdisk_parttype_get_string(const struct fdisk_parttype *t);
unsigned int fdisk_parttype_get_code(const struct fdisk_parttype *t);
const char *fdisk_parttype_get_name(const struct fdisk_parttype *t);
int fdisk_parttype_is_unknown(const struct fdisk_parttype *t);
/* field.c */
extern int fdisk_field_get_id(const struct fdisk_field *field);
extern const char *fdisk_field_get_name(const struct fdisk_field *field);
extern double fdisk_field_get_width(const struct fdisk_field *field);
extern int fdisk_field_is_number(const struct fdisk_field *field);
/* label.c */
/**
* fdisk_fieldtype:
*
* Types of fdisk_field. The fields describe a partition.
*/
enum fdisk_fieldtype {
FDISK_FIELD_NONE = 0,
/* generic */
FDISK_FIELD_DEVICE, /* partition device name */
FDISK_FIELD_START, /* start offset of the partition */
FDISK_FIELD_END, /* end offset of the partition */
FDISK_FIELD_SECTORS, /* number of sectors */
FDISK_FIELD_CYLINDERS, /* number of cylinders (deprecated) */
FDISK_FIELD_SIZE, /* partition size */
FDISK_FIELD_TYPE, /* partition type */
FDISK_FIELD_TYPEID, /* partition type ID */
/* label specific */
FDISK_FIELD_ATTR, /* partition attribute (GPT) */
FDISK_FIELD_BOOT, /* partition boot flag */
FDISK_FIELD_BSIZE, /* size of the boot area (BSD) */
FDISK_FIELD_CPG, /* BSD */
FDISK_FIELD_EADDR, /* End-C/H/S (MBR) */
FDISK_FIELD_FSIZE, /* BSD */
FDISK_FIELD_NAME, /* partition label/name (GPT) */
FDISK_FIELD_SADDR, /* Start-C/H/S (MBR) */
FDISK_FIELD_UUID, /* partition UUID (GPT) */
FDISK_FIELD_FSUUID,
FDISK_FIELD_FSLABEL,
FDISK_FIELD_FSTYPE,
FDISK_NFIELDS /* must be last */
};
int fdisk_label_get_type(const struct fdisk_label *lb);
const char *fdisk_label_get_name(const struct fdisk_label *lb);
int fdisk_label_require_geometry(const struct fdisk_label *lb);
extern int fdisk_write_disklabel(struct fdisk_context *cxt);
extern int fdisk_verify_disklabel(struct fdisk_context *cxt);
extern int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name);
extern int fdisk_list_disklabel(struct fdisk_context *cxt);
extern int fdisk_locate_disklabel(struct fdisk_context *cxt, int n,
const char **name,
uint64_t *offset,
size_t *size);
/**
* fdisk_labelitem_gen:
*
* Generic disklabel items
*/
enum fdisk_labelitem_gen {
FDISK_LABELITEM_ID = 0, /* Unique disk identifier */
__FDISK_NLABELITEMS = 8 /* Specifies reserved range for generic items (0..7) */
};
/* item.c */
extern struct fdisk_labelitem *fdisk_new_labelitem(void);
extern void fdisk_ref_labelitem(struct fdisk_labelitem *li);
extern int fdisk_reset_labelitem(struct fdisk_labelitem *li);
extern void fdisk_unref_labelitem(struct fdisk_labelitem *li);
extern const char *fdisk_labelitem_get_name(struct fdisk_labelitem *li);
extern int fdisk_labelitem_get_id(struct fdisk_labelitem *li);
extern int fdisk_labelitem_get_data_u64(struct fdisk_labelitem *li, uint64_t *data);
extern int fdisk_labelitem_get_data_string(struct fdisk_labelitem *li, const char **data);
extern int fdisk_labelitem_is_string(struct fdisk_labelitem *li);
extern int fdisk_labelitem_is_number(struct fdisk_labelitem *li);
extern int fdisk_get_disklabel_item(struct fdisk_context *cxt, int id, struct fdisk_labelitem *item);
extern int fdisk_get_disklabel_id(struct fdisk_context *cxt, char **id);
extern int fdisk_set_disklabel_id(struct fdisk_context *cxt);
extern int fdisk_get_partition(struct fdisk_context *cxt, size_t partno, struct fdisk_partition **pa);
extern int fdisk_set_partition(struct fdisk_context *cxt, size_t partno, struct fdisk_partition *pa);
extern int fdisk_add_partition(struct fdisk_context *cxt, struct fdisk_partition *pa, size_t *partno);
extern int fdisk_delete_partition(struct fdisk_context *cxt, size_t partno);
extern int fdisk_delete_all_partitions(struct fdisk_context *cxt);
extern int fdisk_wipe_partition(struct fdisk_context *cxt, size_t partno, int enable);
extern int fdisk_set_partition_type(struct fdisk_context *cxt, size_t partnum,
struct fdisk_parttype *t);
extern int fdisk_label_get_fields_ids(
const struct fdisk_label *lb,
struct fdisk_context *cxt,
int **ids, size_t *nids);
extern int fdisk_label_get_fields_ids_all(
const struct fdisk_label *lb,
struct fdisk_context *cxt,
int **ids, size_t *nids);
extern const struct fdisk_field *fdisk_label_get_field(const struct fdisk_label *lb, int id);
extern const struct fdisk_field *fdisk_label_get_field_by_name(
const struct fdisk_label *lb,
const char *name);
extern void fdisk_label_set_changed(struct fdisk_label *lb, int changed);
extern int fdisk_label_is_changed(const struct fdisk_label *lb);
extern void fdisk_label_set_disabled(struct fdisk_label *lb, int disabled);
extern int fdisk_label_is_disabled(const struct fdisk_label *lb);
extern int fdisk_is_partition_used(struct fdisk_context *cxt, size_t n);
extern int fdisk_toggle_partition_flag(struct fdisk_context *cxt, size_t partnum, unsigned long flag);
extern struct fdisk_partition *fdisk_new_partition(void);
extern void fdisk_reset_partition(struct fdisk_partition *pa);
extern void fdisk_ref_partition(struct fdisk_partition *pa);
extern void fdisk_unref_partition(struct fdisk_partition *pa);
extern int fdisk_partition_is_freespace(struct fdisk_partition *pa);
int fdisk_partition_set_start(struct fdisk_partition *pa, uint64_t off);
int fdisk_partition_unset_start(struct fdisk_partition *pa);
fdisk_sector_t fdisk_partition_get_start(struct fdisk_partition *pa);
int fdisk_partition_has_start(struct fdisk_partition *pa);
int fdisk_partition_cmp_start(struct fdisk_partition *a,
struct fdisk_partition *b);
int fdisk_partition_start_follow_default(struct fdisk_partition *pa, int enable);
int fdisk_partition_start_is_default(struct fdisk_partition *pa);
int fdisk_partition_set_size(struct fdisk_partition *pa, uint64_t sz);
int fdisk_partition_unset_size(struct fdisk_partition *pa);
fdisk_sector_t fdisk_partition_get_size(struct fdisk_partition *pa);
int fdisk_partition_has_size(struct fdisk_partition *pa);
int fdisk_partition_size_explicit(struct fdisk_partition *pa, int enable);
int fdisk_partition_has_end(struct fdisk_partition *pa);
fdisk_sector_t fdisk_partition_get_end(struct fdisk_partition *pa);
int fdisk_partition_set_partno(struct fdisk_partition *pa, size_t num);
int fdisk_partition_unset_partno(struct fdisk_partition *pa);
size_t fdisk_partition_get_partno(struct fdisk_partition *pa);
int fdisk_partition_has_partno(struct fdisk_partition *pa);
int fdisk_partition_cmp_partno(struct fdisk_partition *a,
struct fdisk_partition *b);
int fdisk_partition_partno_follow_default(struct fdisk_partition *pa, int enable);
extern int fdisk_partition_set_type(struct fdisk_partition *pa, struct fdisk_parttype *type);
extern struct fdisk_parttype *fdisk_partition_get_type(struct fdisk_partition *pa);
extern int fdisk_partition_set_name(struct fdisk_partition *pa, const char *name);
extern const char *fdisk_partition_get_name(struct fdisk_partition *pa);
extern int fdisk_partition_set_uuid(struct fdisk_partition *pa, const char *uuid);
extern int fdisk_partition_set_attrs(struct fdisk_partition *pa, const char *attrs);
extern const char *fdisk_partition_get_uuid(struct fdisk_partition *pa);
extern const char *fdisk_partition_get_attrs(struct fdisk_partition *pa);
extern int fdisk_partition_is_nested(struct fdisk_partition *pa);
extern int fdisk_partition_is_container(struct fdisk_partition *pa);
extern int fdisk_partition_get_parent(struct fdisk_partition *pa, size_t *parent);
extern int fdisk_partition_is_used(struct fdisk_partition *pa);
extern int fdisk_partition_is_bootable(struct fdisk_partition *pa);
extern int fdisk_partition_is_wholedisk(struct fdisk_partition *pa);
extern int fdisk_partition_to_string(struct fdisk_partition *pa,
struct fdisk_context *cxt,
int id, char **data);
int fdisk_partition_next_partno(struct fdisk_partition *pa,
struct fdisk_context *cxt,
size_t *n);
extern int fdisk_partition_end_follow_default(struct fdisk_partition *pa, int enable);
extern int fdisk_partition_end_is_default(struct fdisk_partition *pa);
extern int fdisk_reorder_partitions(struct fdisk_context *cxt);
extern int fdisk_partition_has_wipe(struct fdisk_context *cxt, struct fdisk_partition *pa);
/* table.c */
extern struct fdisk_table *fdisk_new_table(void);
extern int fdisk_reset_table(struct fdisk_table *tb);
extern void fdisk_ref_table(struct fdisk_table *tb);
extern void fdisk_unref_table(struct fdisk_table *tb);
extern size_t fdisk_table_get_nents(struct fdisk_table *tb);
extern int fdisk_table_is_empty(struct fdisk_table *tb);
extern int fdisk_table_add_partition(struct fdisk_table *tb, struct fdisk_partition *pa);
extern int fdisk_table_remove_partition(struct fdisk_table *tb, struct fdisk_partition *pa);
extern int fdisk_get_partitions(struct fdisk_context *cxt, struct fdisk_table **tb);
extern int fdisk_get_freespaces(struct fdisk_context *cxt, struct fdisk_table **tb);
extern int fdisk_table_wrong_order(struct fdisk_table *tb);
extern int fdisk_table_sort_partitions(struct fdisk_table *tb,
int (*cmp)(struct fdisk_partition *,
struct fdisk_partition *));
extern int fdisk_table_next_partition(
struct fdisk_table *tb,
struct fdisk_iter *itr,
struct fdisk_partition **pa);
extern struct fdisk_partition *fdisk_table_get_partition(
struct fdisk_table *tb,
size_t n);
extern struct fdisk_partition *fdisk_table_get_partition_by_partno(
struct fdisk_table *tb,
size_t partno);
extern int fdisk_apply_table(struct fdisk_context *cxt, struct fdisk_table *tb);
/* alignment.c */
#define FDISK_ALIGN_UP 1
#define FDISK_ALIGN_DOWN 2
#define FDISK_ALIGN_NEAREST 3
fdisk_sector_t fdisk_align_lba(struct fdisk_context *cxt, fdisk_sector_t lba, int direction);
fdisk_sector_t fdisk_align_lba_in_range(struct fdisk_context *cxt,
fdisk_sector_t lba, fdisk_sector_t start, fdisk_sector_t stop);
int fdisk_lba_is_phy_aligned(struct fdisk_context *cxt, fdisk_sector_t lba);
int fdisk_override_geometry(struct fdisk_context *cxt,
unsigned int cylinders,
unsigned int heads,
unsigned int sectors);
int fdisk_save_user_geometry(struct fdisk_context *cxt,
unsigned int cylinders,
unsigned int heads,
unsigned int sectors);
int fdisk_save_user_sector_size(struct fdisk_context *cxt,
unsigned int phy,
unsigned int log);
int fdisk_save_user_grain(struct fdisk_context *cxt, unsigned long grain);
int fdisk_has_user_device_properties(struct fdisk_context *cxt);
int fdisk_reset_alignment(struct fdisk_context *cxt);
int fdisk_reset_device_properties(struct fdisk_context *cxt);
int fdisk_reread_partition_table(struct fdisk_context *cxt);
int fdisk_reread_changes(struct fdisk_context *cxt, struct fdisk_table *org);
/* iter.c */
enum {
FDISK_ITER_FORWARD = 0,
FDISK_ITER_BACKWARD
};
extern struct fdisk_iter *fdisk_new_iter(int direction);
extern void fdisk_free_iter(struct fdisk_iter *itr);
extern void fdisk_reset_iter(struct fdisk_iter *itr, int direction);
extern int fdisk_iter_get_direction(struct fdisk_iter *itr);
/* dos.c */
#define DOS_FLAG_ACTIVE 1
extern int fdisk_dos_move_begin(struct fdisk_context *cxt, size_t i);
extern int fdisk_dos_enable_compatible(struct fdisk_label *lb, int enable);
extern int fdisk_dos_is_compatible(struct fdisk_label *lb);
/* sun.h */
extern int fdisk_sun_set_alt_cyl(struct fdisk_context *cxt);
extern int fdisk_sun_set_xcyl(struct fdisk_context *cxt);
extern int fdisk_sun_set_ilfact(struct fdisk_context *cxt);
extern int fdisk_sun_set_rspeed(struct fdisk_context *cxt);
extern int fdisk_sun_set_pcylcount(struct fdisk_context *cxt);
/**
* fdisk_labelitem_sun:
*
* SUN specific label items.
*/
enum fdisk_labelitem_sun {
SUN_LABELITEM_LABELID = __FDISK_NLABELITEMS,
SUN_LABELITEM_VTOCID,
SUN_LABELITEM_RPM,
SUN_LABELITEM_ACYL,
SUN_LABELITEM_PCYL,
SUN_LABELITEM_APC,
SUN_LABELITEM_INTRLV
};
/* bsd.c */
extern int fdisk_bsd_edit_disklabel(struct fdisk_context *cxt);
extern int fdisk_bsd_write_bootstrap(struct fdisk_context *cxt);
extern int fdisk_bsd_link_partition(struct fdisk_context *cxt);
/**
* fdisk_labelitem_bsd:
*
* BSD specific label items.
*/
enum fdisk_labelitem_bsd {
/* specific */
BSD_LABELITEM_TYPE = __FDISK_NLABELITEMS,
BSD_LABELITEM_DISK,
BSD_LABELITEM_PACKNAME,
BSD_LABELITEM_FLAGS,
BSD_LABELITEM_SECSIZE,
BSD_LABELITEM_NTRACKS,
BSD_LABELITEM_SECPERCYL,
BSD_LABELITEM_CYLINDERS,
BSD_LABELITEM_RPM,
BSD_LABELITEM_INTERLEAVE,
BSD_LABELITEM_TRACKSKEW,
BSD_LABELITEM_CYLINDERSKEW,
BSD_LABELITEM_HEADSWITCH,
BSD_LABELITEM_TRKSEEK
};
/* sgi.h */
#define SGI_FLAG_BOOT 1
#define SGI_FLAG_SWAP 2
extern int fdisk_sgi_set_bootfile(struct fdisk_context *cxt);
extern int fdisk_sgi_create_info(struct fdisk_context *cxt);
/**
* fdisk_labelitem_sgi:
*
* SGI specific label items.
*/
enum fdisk_labelitem_sgi {
SGI_LABELITEM_PCYLCOUNT = __FDISK_NLABELITEMS,
SGI_LABELITEM_SPARECYL,
SGI_LABELITEM_ILFACT,
SGI_LABELITEM_BOOTFILE
};
/* gpt */
/*
* GPT partition attributes
*/
/**
* GPT_FLAG_REQUIRED:
*
* GPT attribute; marks a partition as system partition (disk
* partitioning utilities must preserve the partition as is)
*/
#define GPT_FLAG_REQUIRED 1
/**
* GPT_FLAG_NOBLOCK:
*
* GPT attribute; EFI firmware should ignore the content of the
* partition and not try to read from it
*/
#define GPT_FLAG_NOBLOCK 2
/**
* GPT_FLAG_LEGACYBOOT:
*
* GPT attribute; use the partition for legacy boot method
*/
#define GPT_FLAG_LEGACYBOOT 3
/**
* GPT_FLAG_GUIDSPECIFIC:
*
* GPT attribute; for bites 48-63, defined and used by the individual partition
* type.
*
* The flag GPT_FLAG_GUIDSPECIFIC forces libfdisk to ask (by ask API)
* for a bit number. If you want to toggle specific bit and avoid any
* dialog, then use the bit number (in range 48..63). For example:
*
* // start dialog to ask for bit number
* fdisk_toggle_partition_flag(cxt, n, GPT_FLAG_GUIDSPECIFIC);
*
* // toggle bit 60
* fdisk_toggle_partition_flag(cxt, n, 60);
*/
#define GPT_FLAG_GUIDSPECIFIC 4
extern int fdisk_gpt_is_hybrid(struct fdisk_context *cxt);
extern int fdisk_gpt_set_npartitions(struct fdisk_context *cxt, uint32_t entries);
extern int fdisk_gpt_get_partition_attrs(struct fdisk_context *cxt, size_t partnum, uint64_t *attrs);
extern int fdisk_gpt_set_partition_attrs(struct fdisk_context *cxt, size_t partnum, uint64_t attrs);
/**
* fdisk_labelitem_gpt:
*
* GPT specific label items.
*/
enum fdisk_labelitem_gpt {
/* generic */
GPT_LABELITEM_ID = FDISK_LABELITEM_ID, /* GPT disklabel UUID (!= partition UUID) */
/* specific */
GPT_LABELITEM_FIRSTLBA = __FDISK_NLABELITEMS, /* First Usable LBA */
GPT_LABELITEM_LASTLBA, /* Last Usable LBA */
GPT_LABELITEM_ALTLBA, /* Alternative LBA (backup header LBA) */
GPT_LABELITEM_ENTRIESLBA, /* Partitions entires array LBA */
GPT_LABELITEM_ENTRIESALLOC /* Number of allocated entries in entries array */
};
/* script.c */
struct fdisk_script *fdisk_new_script(struct fdisk_context *cxt);
struct fdisk_script *fdisk_new_script_from_file(struct fdisk_context *cxt,
const char *filename);
void fdisk_ref_script(struct fdisk_script *dp);
void fdisk_unref_script(struct fdisk_script *dp);
const char *fdisk_script_get_header(struct fdisk_script *dp, const char *name);
int fdisk_script_set_header(struct fdisk_script *dp, const char *name, const char *data);
struct fdisk_table *fdisk_script_get_table(struct fdisk_script *dp);
int fdisk_script_get_nlines(struct fdisk_script *dp);
int fdisk_script_has_force_label(struct fdisk_script *dp);
int fdisk_script_set_userdata(struct fdisk_script *dp, void *data);
void *fdisk_script_get_userdata(struct fdisk_script *dp);
int fdisk_script_set_fgets(struct fdisk_script *dp,
char *(*fn_fgets)(struct fdisk_script *, char *, size_t, FILE *));
int fdisk_script_read_context(struct fdisk_script *dp, struct fdisk_context *cxt);
int fdisk_script_enable_json(struct fdisk_script *dp, int json);
int fdisk_script_write_file(struct fdisk_script *dp, FILE *f);
int fdisk_script_read_file(struct fdisk_script *dp, FILE *f);
int fdisk_script_read_line(struct fdisk_script *dp, FILE *f, char *buf, size_t bufsz);
int fdisk_set_script(struct fdisk_context *cxt, struct fdisk_script *dp);
struct fdisk_script *fdisk_get_script(struct fdisk_context *cxt);
int fdisk_apply_script_headers(struct fdisk_context *cxt, struct fdisk_script *dp);
int fdisk_apply_script(struct fdisk_context *cxt, struct fdisk_script *dp);
/* ask.c */
#define fdisk_is_ask(a, x) (fdisk_ask_get_type(a) == FDISK_ASKTYPE_ ## x)
int fdisk_set_ask(struct fdisk_context *cxt,
int (*ask_cb)(struct fdisk_context *, struct fdisk_ask *, void *),
void *data);
void fdisk_ref_ask(struct fdisk_ask *ask);
void fdisk_unref_ask(struct fdisk_ask *ask);
const char *fdisk_ask_get_query(struct fdisk_ask *ask);
int fdisk_ask_get_type(struct fdisk_ask *ask);
const char *fdisk_ask_number_get_range(struct fdisk_ask *ask);
uint64_t fdisk_ask_number_get_default(struct fdisk_ask *ask);
uint64_t fdisk_ask_number_get_low(struct fdisk_ask *ask);
uint64_t fdisk_ask_number_get_high(struct fdisk_ask *ask);
uint64_t fdisk_ask_number_get_result(struct fdisk_ask *ask);
int fdisk_ask_number_set_result(struct fdisk_ask *ask, uint64_t result);
uint64_t fdisk_ask_number_get_base(struct fdisk_ask *ask);
uint64_t fdisk_ask_number_get_unit(struct fdisk_ask *ask);
int fdisk_ask_number_set_relative(struct fdisk_ask *ask, int relative);
int fdisk_ask_number_inchars(struct fdisk_ask *ask);
int fdisk_ask_partnum(struct fdisk_context *cxt, size_t *partnum, int wantnew);
int fdisk_ask_number(struct fdisk_context *cxt,
uintmax_t low,
uintmax_t dflt,
uintmax_t high,
const char *query,
uintmax_t *result);
char *fdisk_ask_string_get_result(struct fdisk_ask *ask);
int fdisk_ask_string_set_result(struct fdisk_ask *ask, char *result);
int fdisk_ask_string(struct fdisk_context *cxt,
const char *query,
char **result);
int fdisk_ask_yesno(struct fdisk_context *cxt,
const char *query,
int *result);
int fdisk_ask_yesno_get_result(struct fdisk_ask *ask);
int fdisk_ask_yesno_set_result(struct fdisk_ask *ask, int result);
int fdisk_ask_menu_get_default(struct fdisk_ask *ask);
int fdisk_ask_menu_set_result(struct fdisk_ask *ask, int key);
int fdisk_ask_menu_get_result(struct fdisk_ask *ask, int *key);
int fdisk_ask_menu_get_item(struct fdisk_ask *ask, size_t idx, int *key,
const char **name, const char **desc);
size_t fdisk_ask_menu_get_nitems(struct fdisk_ask *ask);
int fdisk_ask_print_get_errno(struct fdisk_ask *ask);
const char *fdisk_ask_print_get_mesg(struct fdisk_ask *ask);
int fdisk_info(struct fdisk_context *cxt, const char *fmt, ...);
int fdisk_warn(struct fdisk_context *cxt, const char *fmt, ...);
int fdisk_warnx(struct fdisk_context *cxt, const char *fmt, ...);
/* utils.h */
extern char *fdisk_partname(const char *dev, size_t partno);
#ifdef __cplusplus
}
#endif
#endif /* _LIBFDISK_H */

View File

@ -0,0 +1,91 @@
/* lt_dlloader.h -- dynamic library loader interface
Copyright (C) 2004, 2007-2008, 2011-2015 Free Software Foundation,
Inc.
Written by Gary V. Vaughan, 2004
NOTE: The canonical source of this file is maintained with the
GNU Libtool package. Report bugs to bug-libtool@gnu.org.
GNU Libltdl is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
As a special exception to the GNU Lesser General Public License,
if you distribute this file as part of a program or library that
is built using GNU Libtool, you may include this file under the
same distribution terms that you use for the rest of that program.
GNU Libltdl 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 GNU Libltdl; see the file COPYING.LIB. If not, a
copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
or obtained by writing to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#if !defined LT_DLLOADER_H
#define LT_DLLOADER_H 1
#include <libltdl/lt_system.h>
LT_BEGIN_C_DECLS
typedef void * lt_dlloader;
typedef void * lt_module;
typedef void * lt_user_data;
typedef struct lt__advise * lt_dladvise;
/* Function pointer types for module loader vtable entries: */
typedef lt_module lt_module_open (lt_user_data data,
const char *filename,
lt_dladvise advise);
typedef int lt_module_close (lt_user_data data,
lt_module module);
typedef void * lt_find_sym (lt_user_data data, lt_module module,
const char *symbolname);
typedef int lt_dlloader_init (lt_user_data data);
typedef int lt_dlloader_exit (lt_user_data data);
/* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */
typedef enum {
LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND
} lt_dlloader_priority;
/* This structure defines a module loader, as populated by the get_vtable
entry point of each loader. */
typedef struct {
const char * name;
const char * sym_prefix;
lt_module_open * module_open;
lt_module_close * module_close;
lt_find_sym * find_sym;
lt_dlloader_init * dlloader_init;
lt_dlloader_exit * dlloader_exit;
lt_user_data dlloader_data;
lt_dlloader_priority priority;
} lt_dlvtable;
LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable);
LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader);
LT_SCOPE lt_dlvtable * lt_dlloader_remove (const char *name);
LT_SCOPE const lt_dlvtable *lt_dlloader_find (const char *name);
LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader);
/* Type of a function to get a loader's vtable: */
typedef const lt_dlvtable *lt_get_vtable (lt_user_data data);
#ifdef LT_DEBUG_LOADERS
LT_SCOPE void lt_dlloader_dump (void);
#endif
LT_END_C_DECLS
#endif /*!defined LT_DLLOADER_H*/

View File

@ -0,0 +1,86 @@
/* lt_error.h -- error propagation interface
Copyright (C) 1999-2001, 2004, 2007, 2011-2015 Free Software
Foundation, Inc.
Written by Thomas Tanner, 1999
NOTE: The canonical source of this file is maintained with the
GNU Libtool package. Report bugs to bug-libtool@gnu.org.
GNU Libltdl is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
As a special exception to the GNU Lesser General Public License,
if you distribute this file as part of a program or library that
is built using GNU Libtool, you may include this file under the
same distribution terms that you use for the rest of that program.
GNU Libltdl 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 GNU Libltdl; see the file COPYING.LIB. If not, a
copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
or obtained by writing to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Only include this header file once. */
#if !defined LT_ERROR_H
#define LT_ERROR_H 1
#include <libltdl/lt_system.h>
LT_BEGIN_C_DECLS
/* Defining error strings alongside their symbolic names in a macro in
this way allows us to expand the macro in different contexts with
confidence that the enumeration of symbolic names will map correctly
onto the table of error strings. \0 is appended to the strings to
expilicitely initialize the string terminator. */
#define lt_dlerror_table \
LT_ERROR(UNKNOWN, "unknown error\0") \
LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \
LT_ERROR(INVALID_LOADER, "invalid loader\0") \
LT_ERROR(INIT_LOADER, "loader initialization failed\0") \
LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \
LT_ERROR(FILE_NOT_FOUND, "file not found\0") \
LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \
LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \
LT_ERROR(CANNOT_OPEN, "can't open the module\0") \
LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \
LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \
LT_ERROR(NO_MEMORY, "not enough memory\0") \
LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \
LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \
LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \
LT_ERROR(SHUTDOWN, "library already shutdown\0") \
LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \
LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\
LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")\
LT_ERROR(CONFLICTING_FLAGS, "symbol visibility can be global or local\0")
/* Enumerate the symbolic error names. */
enum {
#define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name),
lt_dlerror_table
#undef LT_ERROR
LT_ERROR_MAX
};
/* Should be max of the error string lengths above (plus one for C++) */
#define LT_ERROR_LEN_MAX (41)
/* These functions are only useful from inside custom module loaders. */
LT_SCOPE int lt_dladderror (const char *diagnostic);
LT_SCOPE int lt_dlseterror (int errorcode);
LT_END_C_DECLS
#endif /*!defined LT_ERROR_H*/

View File

@ -0,0 +1,166 @@
/* lt_system.h -- system portability abstraction layer
Copyright (C) 2004, 2007, 2010-2015 Free Software Foundation, Inc.
Written by Gary V. Vaughan, 2004
NOTE: The canonical source of this file is maintained with the
GNU Libtool package. Report bugs to bug-libtool@gnu.org.
GNU Libltdl is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
As a special exception to the GNU Lesser General Public License,
if you distribute this file as part of a program or library that
is built using GNU Libtool, you may include this file under the
same distribution terms that you use for the rest of that program.
GNU Libltdl 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 GNU Libltdl; see the file COPYING.LIB. If not, a
copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
or obtained by writing to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#if !defined LT_SYSTEM_H
#define LT_SYSTEM_H 1
#include <stddef.h>
#include <stdlib.h>
#include <sys/types.h>
/* Some systems do not define EXIT_*, even with STDC_HEADERS. */
#if !defined EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
#if !defined EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
/* Just pick a big number... */
#define LT_FILENAME_MAX 2048
/* Saves on those hard to debug '\0' typos.... */
#define LT_EOS_CHAR '\0'
/* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations,
so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at
the end of C declarations. */
#if defined __cplusplus
# define LT_BEGIN_C_DECLS extern "C" {
# define LT_END_C_DECLS }
#else
# define LT_BEGIN_C_DECLS /* empty */
# define LT_END_C_DECLS /* empty */
#endif
/* LT_STMT_START/END are used to create macros that expand to a
a single compound statement in a portable way. */
#if defined __GNUC__ && !defined __STRICT_ANSI__ && !defined __cplusplus
# define LT_STMT_START (void)(
# define LT_STMT_END )
#else
# if (defined sun || defined __sun__)
# define LT_STMT_START if (1)
# define LT_STMT_END else (void)0
# else
# define LT_STMT_START do
# define LT_STMT_END while (0)
# endif
#endif
/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
/* DATA imports from DLLs on WIN32 can't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs. */
# define LT_DLSYM_CONST
#elif defined __osf__
/* This system does not cope well with relocations in const data. */
# define LT_DLSYM_CONST
#else
# define LT_DLSYM_CONST const
#endif
/* Canonicalise Windows and Cygwin recognition macros.
To match the values set by recent Cygwin compilers, make sure that if
__CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */
#if defined __CYGWIN32__ && !defined __CYGWIN__
# define __CYGWIN__ __CYGWIN32__
#endif
#if defined __CYGWIN__
# if defined __WINDOWS__
# undef __WINDOWS__
# endif
#elif defined _WIN32
# define __WINDOWS__ _WIN32
#elif defined WIN32
# define __WINDOWS__ WIN32
#endif
#if defined __CYGWIN__ && defined __WINDOWS__
# undef __WINDOWS__
#endif
/* DLL building support on win32 hosts; mostly to workaround their
ridiculous implementation of data symbol exporting. */
#if !defined LT_SCOPE
# if defined __WINDOWS__ || defined __CYGWIN__
# if defined DLL_EXPORT /* defined by libtool (if required) */
# define LT_SCOPE extern __declspec(dllexport)
# endif
# if defined LIBLTDL_DLL_IMPORT /* define if linking with this dll */
/* note: cygwin/mingw compilers can rely instead on auto-import */
# define LT_SCOPE extern __declspec(dllimport)
# endif
# endif
# if !defined LT_SCOPE /* static linking or !__WINDOWS__ */
# define LT_SCOPE extern
# endif
#endif
#if defined __WINDOWS__
/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory
separator when it is set. */
# define LT_DIRSEP_CHAR '\\'
# define LT_PATHSEP_CHAR ';'
#else
# define LT_PATHSEP_CHAR ':'
#endif
#if defined _MSC_VER /* Visual Studio */
# define R_OK 4
#endif
/* fopen() mode flags for reading a text file */
#undef LT_READTEXT_MODE
#if defined __WINDOWS__ || defined __CYGWIN__
# define LT_READTEXT_MODE "rt"
#else
# define LT_READTEXT_MODE "r"
#endif
/* The extra indirection to the LT__STR and LT__CONC macros is required so
that if the arguments to LT_STR() (or LT_CONC()) are themselves macros,
they will be expanded before being quoted. */
#ifndef LT_STR
# define LT__STR(arg) #arg
# define LT_STR(arg) LT__STR(arg)
#endif
#ifndef LT_CONC
# define LT__CONC(a, b) a##b
# define LT_CONC(a, b) LT__CONC(a, b)
#endif
#ifndef LT_CONC3
# define LT__CONC3(a, b, c) a##b##c
# define LT_CONC3(a, b, c) LT__CONC3(a, b, c)
#endif
#endif /*!defined LT_SYSTEM_H*/

View File

@ -0,0 +1,956 @@
/*
* mount.h - libmount API
*
* Copyright (C) 2008-2009 Karel Zak <kzak@redhat.com>
*
* 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 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.
*/
#ifndef _LIBMOUNT_MOUNT_H
#define _LIBMOUNT_MOUNT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <mntent.h>
#include <sys/types.h>
#define LIBMOUNT_VERSION "2.31.1"
#define LIBMOUNT_MAJOR_VERSION 2
#define LIBMOUNT_MINOR_VERSION 31
#define LIBMOUNT_PATCH_VERSION 1
/**
* libmnt_cache:
*
* Stores canonicalized paths and evaluated tags
*/
struct libmnt_cache;
/**
* libmnt_lock:
*
* Stores information about the locked file (e.g. /etc/mtab)
*/
struct libmnt_lock;
/**
* libmnt_iter:
*
* Generic iterator (stores state about lists)
*/
struct libmnt_iter;
/**
* libmnt_optmap:
* @name: option name[=type] where type is printf-like type specifier")
* @id: option ID or MS_* flags (e.g MS_RDONLY)
* @mask: MNT_{NOMTAB,INVERT,...} mask
*
* Mount options description (map)
*/
struct libmnt_optmap
{
const char *name;
int id;
int mask;
};
/*
* mount options map masks
*/
#define MNT_INVERT (1 << 1) /* invert the mountflag */
#define MNT_NOMTAB (1 << 2) /* skip in the mtab option string */
#define MNT_PREFIX (1 << 3) /* prefix used for some options (e.g. "x-foo") */
#define MNT_NOHLPS (1 << 4) /* don't add the option to mount.<type> helpers command line */
/**
* libmnt_fs:
*
* Parsed fstab/mtab/mountinfo entry
*/
struct libmnt_fs;
/**
* libmnt_table:
*
* List of struct libmnt_fs entries (parsed fstab/mtab/mountinfo)
*/
struct libmnt_table;
/**
* libmnt_update
*
* /etc/mtab or utab update description
*/
struct libmnt_update;
/**
* libmnt_context
*
* Mount/umount status
*/
struct libmnt_context;
/**
* libmnt_monitor
*
* Mount tables monitor
*/
struct libmnt_monitor;
/**
* libmnt_tabdiff:
*
* Stores mountinfo state
*/
struct libmnt_tabdiff;
/*
* Actions
*/
enum {
MNT_ACT_MOUNT = 1,
MNT_ACT_UMOUNT
};
/*
* Errors -- by default libmount returns -errno for generic errors (ENOMEM,
* EINVAL, ...) and for mount(2) errors, but for some specific operations it
* returns private error codes. Note that maximum system errno value should be
* 4095 on UNIXes.
*
* See also mnt_context_get_syscall_errno() and mnt_context_get_helper_status().
*/
/**
* MNT_ERR_NOFSTAB:
*
* not found required entry in fstab
*/
#define MNT_ERR_NOFSTAB 5000
/**
* MNT_ERR_NOFSTYPE:
*
* failed to detect filesystem type
*/
#define MNT_ERR_NOFSTYPE 5001
/**
* MNT_ERR_NOSOURCE:
*
* required mount source undefined
*/
#define MNT_ERR_NOSOURCE 5002
/**
* MNT_ERR_LOOPDEV:
*
* loopdev setup failed, errno set by libc
*/
#define MNT_ERR_LOOPDEV 5003
/**
* MNT_ERR_MOUNTOPT:
*
* failed to parse/use userspace mount options
*/
#define MNT_ERR_MOUNTOPT 5004
/**
* MNT_ERR_APPLYFLAGS:
*
* failed to apply MS_PROPAGATION flags
*/
#define MNT_ERR_APPLYFLAGS 5005
/**
* MNT_ERR_AMBIFS:
*
* libblkid detected more filesystems on the device
*/
#define MNT_ERR_AMBIFS 5006
/**
* MNT_ERR_LOOPOVERLAP:
*
* detected overlapping loop device that cannot be re-used
*/
#define MNT_ERR_LOOPOVERLAP 5007
/**
* MNT_ERR_LOCK:
*
* failed to lock mtab/utab or so.
*/
#define MNT_ERR_LOCK 5008
/*
* Overall return codes -- based on mount(8) and umount(8) return codes.
* See mnt_context_get_excode() for more details.
*/
/**
* MNT_EX_SUCCESS:
*
* [u]mount(8) exit code: no errors
*/
#define MNT_EX_SUCCESS 0
/**
* MNT_EX_USAGE:
*
* [u]mount(8) exit code: incorrect invocation or permission
*/
#define MNT_EX_USAGE 1
/**
* MNT_EX_SYSERR:
*
* [u]mount(8) exit code: out of memory, cannot fork, ...
*/
#define MNT_EX_SYSERR 2
/**
* MNT_EX_SOFTWARE:
*
* [u]mount(8) exit code: internal mount bug or wrong version
*/
#define MNT_EX_SOFTWARE 4
/**
* MNT_EX_USER:
*
* [u]mount(8) exit code: user interrupt
*/
#define MNT_EX_USER 8
/**
* MNT_EX_FILEIO:
*
* [u]mount(8) exit code: problems writing, locking, ... mtab/utab
*/
#define MNT_EX_FILEIO 16
/**
* MNT_EX_FAIL:
*
* [u]mount(8) exit code: mount failure
*/
#define MNT_EX_FAIL 32
/**
* MNT_EX_SOMEOK:
*
* [u]mount(8) exit code: some mount succeeded; usually when executed with
* --all options. Never returned by libmount.
*/
#define MNT_EX_SOMEOK 64
#ifndef __GNUC_PREREQ
# if defined __GNUC__ && defined __GNUC_MINOR__
# define __GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
# else
# define __GNUC_PREREQ(maj, min) 0
# endif
#endif
#ifndef __ul_attribute__
# if __GNUC_PREREQ (3, 4)
# define __ul_attribute__(_a_) __attribute__(_a_)
# else
# define __ul_attribute__(_a_)
# endif
#endif
/* init.c */
extern void mnt_init_debug(int mask);
/* version.c */
extern int mnt_parse_version_string(const char *ver_string);
extern int mnt_get_library_version(const char **ver_string);
extern int mnt_get_library_features(const char ***features);
/* utils.c */
extern char *mnt_mangle(const char *str)
__ul_attribute__((warn_unused_result));
extern char *mnt_unmangle(const char *str)
__ul_attribute__((warn_unused_result));
extern int mnt_tag_is_valid(const char *tag);
extern int mnt_fstype_is_netfs(const char *type);
extern int mnt_fstype_is_pseudofs(const char *type);
extern int mnt_match_fstype(const char *type, const char *pattern)
__ul_attribute__((warn_unused_result));
extern int mnt_match_options(const char *optstr, const char *pattern)
__ul_attribute__((warn_unused_result));
extern const char *mnt_get_fstab_path(void);
extern const char *mnt_get_swaps_path(void);
extern const char *mnt_get_mtab_path(void);
extern int mnt_has_regular_mtab(const char **mtab, int *writable);
extern char *mnt_get_mountpoint(const char *path)
__ul_attribute__((warn_unused_result));
/* cache.c */
extern struct libmnt_cache *mnt_new_cache(void)
__ul_attribute__((warn_unused_result));
extern void mnt_free_cache(struct libmnt_cache *cache);
extern void mnt_ref_cache(struct libmnt_cache *cache);
extern void mnt_unref_cache(struct libmnt_cache *cache);
extern int mnt_cache_set_targets(struct libmnt_cache *cache,
struct libmnt_table *mtab);
extern int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname);
extern int mnt_cache_device_has_tag(struct libmnt_cache *cache,
const char *devname,
const char *token,
const char *value);
extern char *mnt_cache_find_tag_value(struct libmnt_cache *cache,
const char *devname, const char *token);
extern char *mnt_get_fstype(const char *devname, int *ambi,
struct libmnt_cache *cache)
__ul_attribute__((warn_unused_result));
extern char *mnt_resolve_path(const char *path, struct libmnt_cache *cache)
__ul_attribute__((warn_unused_result));
extern char *mnt_resolve_target(const char *path, struct libmnt_cache *cache)
__ul_attribute__((warn_unused_result));
extern char *mnt_resolve_tag(const char *token, const char *value,
struct libmnt_cache *cache)
__ul_attribute__((warn_unused_result));
extern char *mnt_resolve_spec(const char *spec, struct libmnt_cache *cache)
__ul_attribute__((warn_unused_result));
extern char *mnt_pretty_path(const char *path, struct libmnt_cache *cache)
__ul_attribute__((warn_unused_result));
/* optstr.c */
extern int mnt_optstr_next_option(char **optstr, char **name, size_t *namesz,
char **value, size_t *valuesz);
extern int mnt_optstr_append_option(char **optstr, const char *name,
const char *value);
extern int mnt_optstr_prepend_option(char **optstr, const char *name,
const char *value);
extern int mnt_optstr_get_option(const char *optstr, const char *name,
char **value, size_t *valsz);
extern int mnt_optstr_set_option(char **optstr, const char *name,
const char *value);
extern int mnt_optstr_remove_option(char **optstr, const char *name);
extern int mnt_optstr_deduplicate_option(char **optstr, const char *name);
extern int mnt_split_optstr(const char *optstr,
char **user, char **vfs, char **fs,
int ignore_user, int ignore_vfs);
extern int mnt_optstr_get_options(const char *optstr, char **subset,
const struct libmnt_optmap *map, int ignore);
extern int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
const struct libmnt_optmap *map);
extern int mnt_optstr_apply_flags(char **optstr, unsigned long flags,
const struct libmnt_optmap *map);
/* iter.c */
enum {
MNT_ITER_FORWARD = 0,
MNT_ITER_BACKWARD
};
extern struct libmnt_iter *mnt_new_iter(int direction)
__ul_attribute__((warn_unused_result));
extern void mnt_free_iter(struct libmnt_iter *itr);
extern void mnt_reset_iter(struct libmnt_iter *itr, int direction)
__ul_attribute__((nonnull));
extern int mnt_iter_get_direction(struct libmnt_iter *itr)
__ul_attribute__((nonnull));
/* optmap.c */
enum {
MNT_LINUX_MAP = 1,
MNT_USERSPACE_MAP
};
extern const struct libmnt_optmap *mnt_get_builtin_optmap(int id);
/* lock.c */
extern struct libmnt_lock *mnt_new_lock(const char *datafile, pid_t id)
__ul_attribute__((warn_unused_result));
extern void mnt_free_lock(struct libmnt_lock *ml);
extern void mnt_unlock_file(struct libmnt_lock *ml);
extern int mnt_lock_file(struct libmnt_lock *ml);
extern int mnt_lock_block_signals(struct libmnt_lock *ml, int enable);
/* fs.c */
extern struct libmnt_fs *mnt_new_fs(void)
__ul_attribute__((warn_unused_result));
extern void mnt_free_fs(struct libmnt_fs *fs);
extern void mnt_ref_fs(struct libmnt_fs *fs);
extern void mnt_unref_fs(struct libmnt_fs *fs);
extern void mnt_reset_fs(struct libmnt_fs *fs);
extern struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest,
const struct libmnt_fs *src)
__ul_attribute__((warn_unused_result));
extern void *mnt_fs_get_userdata(struct libmnt_fs *fs);
extern int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data);
extern const char *mnt_fs_get_source(struct libmnt_fs *fs);
extern int mnt_fs_set_source(struct libmnt_fs *fs, const char *source);
extern const char *mnt_fs_get_srcpath(struct libmnt_fs *fs);
extern int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name,
const char **value);
extern const char *mnt_fs_get_target(struct libmnt_fs *fs);
extern int mnt_fs_set_target(struct libmnt_fs *fs, const char *tgt);
extern const char *mnt_fs_get_fstype(struct libmnt_fs *fs);
extern int mnt_fs_set_fstype(struct libmnt_fs *fs, const char *fstype);
extern int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path)
__ul_attribute__((warn_unused_result));
extern int mnt_fs_streq_target(struct libmnt_fs *fs, const char *path)
__ul_attribute__((warn_unused_result));
extern char *mnt_fs_strdup_options(struct libmnt_fs *fs)
__ul_attribute__((warn_unused_result));
extern const char *mnt_fs_get_options(struct libmnt_fs *fs)
__ul_attribute__((warn_unused_result));
extern const char *mnt_fs_get_optional_fields(struct libmnt_fs *fs)
__ul_attribute__((warn_unused_result));
extern int mnt_fs_get_propagation(struct libmnt_fs *fs, unsigned long *flags);
extern int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr);
extern int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr);
extern int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr);
extern int mnt_fs_get_option(struct libmnt_fs *fs, const char *name,
char **value, size_t *valsz);
extern const char *mnt_fs_get_fs_options(struct libmnt_fs *fs);
extern const char *mnt_fs_get_vfs_options(struct libmnt_fs *fs);
extern const char *mnt_fs_get_user_options(struct libmnt_fs *fs);
extern const char *mnt_fs_get_attributes(struct libmnt_fs *fs);
extern int mnt_fs_set_attributes(struct libmnt_fs *fs, const char *optstr);
extern int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name,
char **value, size_t *valsz);
extern int mnt_fs_append_attributes(struct libmnt_fs *fs, const char *optstr);
extern int mnt_fs_prepend_attributes(struct libmnt_fs *fs, const char *optstr);
extern int mnt_fs_get_freq(struct libmnt_fs *fs);
extern int mnt_fs_set_freq(struct libmnt_fs *fs, int freq);
extern int mnt_fs_get_passno(struct libmnt_fs *fs);
extern int mnt_fs_set_passno(struct libmnt_fs *fs, int passno);
extern const char *mnt_fs_get_root(struct libmnt_fs *fs);
extern int mnt_fs_set_root(struct libmnt_fs *fs, const char *path);
extern const char *mnt_fs_get_bindsrc(struct libmnt_fs *fs);
extern int mnt_fs_set_bindsrc(struct libmnt_fs *fs, const char *src);
extern int mnt_fs_get_id(struct libmnt_fs *fs);
extern int mnt_fs_get_parent_id(struct libmnt_fs *fs);
extern dev_t mnt_fs_get_devno(struct libmnt_fs *fs);
extern pid_t mnt_fs_get_tid(struct libmnt_fs *fs);
extern const char *mnt_fs_get_swaptype(struct libmnt_fs *fs);
extern off_t mnt_fs_get_size(struct libmnt_fs *fs);
extern off_t mnt_fs_get_usedsize(struct libmnt_fs *fs);
extern int mnt_fs_get_priority(struct libmnt_fs *fs);
extern int mnt_fs_set_priority(struct libmnt_fs *fs, int prio);
extern const char *mnt_fs_get_comment(struct libmnt_fs *fs);
extern int mnt_fs_set_comment(struct libmnt_fs *fs, const char *comm);
extern int mnt_fs_append_comment(struct libmnt_fs *fs, const char *comm);
extern int mnt_fs_match_target(struct libmnt_fs *fs, const char *target,
struct libmnt_cache *cache);
extern int mnt_fs_match_source(struct libmnt_fs *fs, const char *source,
struct libmnt_cache *cache);
extern int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types);
extern int mnt_fs_match_options(struct libmnt_fs *fs, const char *options);
extern int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file);
extern int mnt_fs_is_kernel(struct libmnt_fs *fs);
extern int mnt_fs_is_swaparea(struct libmnt_fs *fs);
extern int mnt_fs_is_netfs(struct libmnt_fs *fs);
extern int mnt_fs_is_pseudofs(struct libmnt_fs *fs);
extern void mnt_free_mntent(struct mntent *mnt);
extern int mnt_fs_to_mntent(struct libmnt_fs *fs, struct mntent **mnt);
/* tab-parse.c */
extern struct libmnt_table *mnt_new_table_from_file(const char *filename)
__ul_attribute__((warn_unused_result));
extern struct libmnt_table *mnt_new_table_from_dir(const char *dirname)
__ul_attribute__((warn_unused_result));
extern int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f,
const char *filename);
extern int mnt_table_parse_file(struct libmnt_table *tb, const char *filename);
extern int mnt_table_parse_dir(struct libmnt_table *tb, const char *dirname);
extern int mnt_table_parse_fstab(struct libmnt_table *tb, const char *filename);
extern int mnt_table_parse_swaps(struct libmnt_table *tb, const char *filename);
extern int mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename);
extern int mnt_table_set_parser_errcb(struct libmnt_table *tb,
int (*cb)(struct libmnt_table *tb, const char *filename, int line));
/* tab.c */
extern struct libmnt_table *mnt_new_table(void)
__ul_attribute__((warn_unused_result));
extern void mnt_free_table(struct libmnt_table *tb);
extern void mnt_ref_table(struct libmnt_table *tb);
extern void mnt_unref_table(struct libmnt_table *tb);
extern int mnt_reset_table(struct libmnt_table *tb);
extern int mnt_table_get_nents(struct libmnt_table *tb);
extern int mnt_table_is_empty(struct libmnt_table *tb);
extern int mnt_table_set_userdata(struct libmnt_table *tb, void *data);
extern void *mnt_table_get_userdata(struct libmnt_table *tb);
extern void mnt_table_enable_comments(struct libmnt_table *tb, int enable);
extern int mnt_table_with_comments(struct libmnt_table *tb);
extern const char *mnt_table_get_intro_comment(struct libmnt_table *tb);
extern int mnt_table_set_intro_comment(struct libmnt_table *tb, const char *comm);
extern int mnt_table_append_intro_comment(struct libmnt_table *tb, const char *comm);
extern int mnt_table_set_trailing_comment(struct libmnt_table *tb, const char *comm);
extern const char *mnt_table_get_trailing_comment(struct libmnt_table *tb);
extern int mnt_table_append_trailing_comment(struct libmnt_table *tb, const char *comm);
extern int mnt_table_set_cache(struct libmnt_table *tb, struct libmnt_cache *mpc);
extern struct libmnt_cache *mnt_table_get_cache(struct libmnt_table *tb);
extern int mnt_table_add_fs(struct libmnt_table *tb, struct libmnt_fs *fs);
extern int mnt_table_remove_fs(struct libmnt_table *tb, struct libmnt_fs *fs);
extern int mnt_table_first_fs(struct libmnt_table *tb, struct libmnt_fs **fs);
extern int mnt_table_last_fs(struct libmnt_table *tb, struct libmnt_fs **fs);
extern int mnt_table_next_fs(struct libmnt_table *tb, struct libmnt_iter *itr,
struct libmnt_fs **fs);
extern int mnt_table_next_child_fs(struct libmnt_table *tb, struct libmnt_iter *itr,
struct libmnt_fs *parent, struct libmnt_fs **chld);
extern int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root);
extern int mnt_table_set_iter(struct libmnt_table *tb, struct libmnt_iter *itr,
struct libmnt_fs *fs);
enum {
MNT_UNIQ_FORWARD = (1 << 1), /* default is backward */
MNT_UNIQ_KEEPTREE = (1 << 2)
};
extern int mnt_table_uniq_fs(struct libmnt_table *tb, int flags,
int (*cmp)(struct libmnt_table *,
struct libmnt_fs *,
struct libmnt_fs *));
extern struct libmnt_fs *mnt_table_find_mountpoint(struct libmnt_table *tb,
const char *path, int direction);
extern struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb,
const char *path, int direction);
extern struct libmnt_fs *mnt_table_find_srcpath(struct libmnt_table *tb,
const char *path, int direction);
extern struct libmnt_fs *mnt_table_find_tag(struct libmnt_table *tb, const char *tag,
const char *val, int direction);
extern struct libmnt_fs *mnt_table_find_target_with_option(struct libmnt_table *tb, const char *path,
const char *option, const char *val, int direction);
extern struct libmnt_fs *mnt_table_find_source(struct libmnt_table *tb,
const char *source, int direction);
extern struct libmnt_fs *mnt_table_find_pair(struct libmnt_table *tb,
const char *source,
const char *target, int direction);
extern struct libmnt_fs *mnt_table_find_devno(struct libmnt_table *tb,
dev_t devno, int direction);
extern int mnt_table_find_next_fs(struct libmnt_table *tb,
struct libmnt_iter *itr,
int (*match_func)(struct libmnt_fs *, void *),
void *userdata,
struct libmnt_fs **fs);
extern int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs);
/* tab_update.c */
extern struct libmnt_update *mnt_new_update(void)
__ul_attribute__((warn_unused_result));
extern void mnt_free_update(struct libmnt_update *upd);
extern int mnt_table_replace_file(struct libmnt_table *tb, const char *filename);
extern int mnt_table_write_file(struct libmnt_table *tb, FILE *file);
extern int mnt_update_is_ready(struct libmnt_update *upd);
extern int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags,
const char *target, struct libmnt_fs *fs);
extern int mnt_update_table(struct libmnt_update *upd, struct libmnt_lock *lc);
extern unsigned long mnt_update_get_mflags(struct libmnt_update *upd);
extern int mnt_update_force_rdonly(struct libmnt_update *upd, int rdonly);
extern const char *mnt_update_get_filename(struct libmnt_update *upd);
extern struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd);
/* tab_diff.c */
enum {
MNT_TABDIFF_MOUNT = 1,
MNT_TABDIFF_UMOUNT,
MNT_TABDIFF_MOVE,
MNT_TABDIFF_REMOUNT,
MNT_TABDIFF_PROPAGATION, /* not implemented yet (TODO) */
};
extern struct libmnt_tabdiff *mnt_new_tabdiff(void)
__ul_attribute__((warn_unused_result));
extern void mnt_free_tabdiff(struct libmnt_tabdiff *df);
extern int mnt_diff_tables(struct libmnt_tabdiff *df,
struct libmnt_table *old_tab,
struct libmnt_table *new_tab);
extern int mnt_tabdiff_next_change(struct libmnt_tabdiff *df,
struct libmnt_iter *itr,
struct libmnt_fs **old_fs,
struct libmnt_fs **new_fs,
int *oper);
/* monitor.c */
enum {
MNT_MONITOR_TYPE_USERSPACE = 1, /* userspace mount options */
MNT_MONITOR_TYPE_KERNEL /* kernel mount table */
};
extern struct libmnt_monitor *mnt_new_monitor(void);
extern void mnt_ref_monitor(struct libmnt_monitor *mn);
extern void mnt_unref_monitor(struct libmnt_monitor *mn);
extern int mnt_monitor_enable_kernel(struct libmnt_monitor *mn, int enable);
extern int mnt_monitor_enable_userspace(struct libmnt_monitor *mn,
int enable, const char *filename);
extern int mnt_monitor_get_fd(struct libmnt_monitor *mn);
extern int mnt_monitor_close_fd(struct libmnt_monitor *mn);
extern int mnt_monitor_wait(struct libmnt_monitor *mn, int timeout);
extern int mnt_monitor_next_change(struct libmnt_monitor *mn,
const char **filename, int *type);
extern int mnt_monitor_event_cleanup(struct libmnt_monitor *mn);
/* context.c */
/*
* Mode for mount options from fstab (or mtab), see mnt_context_set_optsmode().
*/
enum {
MNT_OMODE_IGNORE = (1 << 1), /* ignore mtab/fstab options */
MNT_OMODE_APPEND = (1 << 2), /* append mtab/fstab options to existing options */
MNT_OMODE_PREPEND = (1 << 3), /* prepend mtab/fstab options to existing options */
MNT_OMODE_REPLACE = (1 << 4), /* replace existing options with options from mtab/fstab */
MNT_OMODE_FORCE = (1 << 5), /* always read mtab/fstab options */
MNT_OMODE_FSTAB = (1 << 10), /* read from fstab */
MNT_OMODE_MTAB = (1 << 11), /* read from mtab if fstab not enabled or failed */
MNT_OMODE_NOTAB = (1 << 12), /* do not read fstab/mtab at all */
/* default */
MNT_OMODE_AUTO = (MNT_OMODE_PREPEND | MNT_OMODE_FSTAB | MNT_OMODE_MTAB),
/* non-root users */
MNT_OMODE_USER = (MNT_OMODE_REPLACE | MNT_OMODE_FORCE | MNT_OMODE_FSTAB)
};
extern struct libmnt_context *mnt_new_context(void)
__ul_attribute__((warn_unused_result));
extern void mnt_free_context(struct libmnt_context *cxt);
extern int mnt_reset_context(struct libmnt_context *cxt);
extern int mnt_context_is_restricted(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_init_helper(struct libmnt_context *cxt,
int action, int flags);
extern int mnt_context_helper_setopt(struct libmnt_context *cxt, int c, char *arg);
extern int mnt_context_set_optsmode(struct libmnt_context *cxt, int mode);
extern int mnt_context_disable_canonicalize(struct libmnt_context *cxt, int disable);
extern int mnt_context_enable_lazy(struct libmnt_context *cxt, int enable);
extern int mnt_context_enable_rdonly_umount(struct libmnt_context *cxt, int enable);
extern int mnt_context_enable_rwonly_mount(struct libmnt_context *cxt, int enable);
extern int mnt_context_disable_helpers(struct libmnt_context *cxt, int disable);
extern int mnt_context_enable_sloppy(struct libmnt_context *cxt, int enable);
extern int mnt_context_enable_fake(struct libmnt_context *cxt, int enable);
extern int mnt_context_disable_mtab(struct libmnt_context *cxt, int disable);
extern int mnt_context_enable_force(struct libmnt_context *cxt, int enable);
extern int mnt_context_enable_verbose(struct libmnt_context *cxt, int enable);
extern int mnt_context_enable_loopdel(struct libmnt_context *cxt, int enable);
extern int mnt_context_enable_fork(struct libmnt_context *cxt, int enable);
extern int mnt_context_disable_swapmatch(struct libmnt_context *cxt, int disable);
extern int mnt_context_get_optsmode(struct libmnt_context *cxt);
extern int mnt_context_is_lazy(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_rdonly_umount(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_rwonly_mount(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_sloppy(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_fake(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_nomtab(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_force(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_verbose(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_loopdel(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_nohelpers(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_nocanonicalize(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_swapmatch(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_forced_rdonly(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_fork(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_parent(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_is_child(struct libmnt_context *cxt)
__ul_attribute__((nonnull));
extern int mnt_context_wait_for_children(struct libmnt_context *cxt,
int *nchildren, int *nerrs);
extern int mnt_context_is_fs_mounted(struct libmnt_context *cxt,
struct libmnt_fs *fs, int *mounted);
extern int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs);
extern struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt);
extern int mnt_context_set_source(struct libmnt_context *cxt, const char *source);
extern int mnt_context_set_target(struct libmnt_context *cxt, const char *target);
extern int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype);
extern const char *mnt_context_get_source(struct libmnt_context *cxt);
extern const char *mnt_context_get_target(struct libmnt_context *cxt);
extern const char *mnt_context_get_fstype(struct libmnt_context *cxt);
extern void *mnt_context_get_mtab_userdata(struct libmnt_context *cxt);
extern void *mnt_context_get_fstab_userdata(struct libmnt_context *cxt);
extern void *mnt_context_get_fs_userdata(struct libmnt_context *cxt);
extern int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr);
extern int mnt_context_append_options(struct libmnt_context *cxt, const char *optstr);
extern const char *mnt_context_get_options(struct libmnt_context *cxt);
extern int mnt_context_set_fstype_pattern(struct libmnt_context *cxt, const char *pattern);
extern int mnt_context_set_options_pattern(struct libmnt_context *cxt, const char *pattern);
extern int mnt_context_set_passwd_cb(struct libmnt_context *cxt,
char *(*get)(struct libmnt_context *),
void (*release)(struct libmnt_context *, char *))
__ul_attribute__((deprecated));
extern int mnt_context_set_tables_errcb(struct libmnt_context *cxt,
int (*cb)(struct libmnt_table *tb, const char *filename, int line));
extern int mnt_context_set_fstab(struct libmnt_context *cxt,
struct libmnt_table *tb);
extern int mnt_context_get_fstab(struct libmnt_context *cxt,
struct libmnt_table **tb);
extern int mnt_context_get_mtab(struct libmnt_context *cxt,
struct libmnt_table **tb);
extern int mnt_context_get_table(struct libmnt_context *cxt,
const char *filename,
struct libmnt_table **tb);
extern int mnt_context_set_cache(struct libmnt_context *cxt,
struct libmnt_cache *cache);
extern struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt);
extern struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt);
extern int mnt_context_set_mflags(struct libmnt_context *cxt,
unsigned long flags);
extern int mnt_context_get_mflags(struct libmnt_context *cxt,
unsigned long *flags);
extern int mnt_context_set_user_mflags(struct libmnt_context *cxt,
unsigned long flags);
extern int mnt_context_get_user_mflags(struct libmnt_context *cxt,
unsigned long *flags);
extern int mnt_context_set_mountdata(struct libmnt_context *cxt, void *data);
extern int mnt_context_apply_fstab(struct libmnt_context *cxt);
extern int mnt_context_reset_status(struct libmnt_context *cxt);
extern int mnt_context_get_status(struct libmnt_context *cxt);
extern int mnt_context_helper_executed(struct libmnt_context *cxt);
extern int mnt_context_get_helper_status(struct libmnt_context *cxt);
extern int mnt_context_syscall_called(struct libmnt_context *cxt);
extern int mnt_context_get_syscall_errno(struct libmnt_context *cxt);
extern int mnt_context_strerror(struct libmnt_context *cxt, char *buf,
size_t bufsiz)
__ul_attribute__((deprecated));
extern int mnt_context_get_excode(struct libmnt_context *cxt,
int rc, char *buf, size_t bufsz);
/* context_mount.c */
extern int mnt_context_mount(struct libmnt_context *cxt);
extern int mnt_context_umount(struct libmnt_context *cxt);
extern int mnt_context_next_mount(struct libmnt_context *cxt,
struct libmnt_iter *itr,
struct libmnt_fs **fs,
int *mntrc, int *ignored);
extern int mnt_context_prepare_mount(struct libmnt_context *cxt)
__ul_attribute__((warn_unused_result));
extern int mnt_context_do_mount(struct libmnt_context *cxt);
extern int mnt_context_finalize_mount(struct libmnt_context *cxt);
/* context_umount.c */
extern int mnt_context_find_umount_fs(struct libmnt_context *cxt,
const char *tgt,
struct libmnt_fs **pfs);
extern int mnt_context_next_umount(struct libmnt_context *cxt,
struct libmnt_iter *itr,
struct libmnt_fs **fs,
int *mntrc, int *ignored);
extern int mnt_context_prepare_umount(struct libmnt_context *cxt)
__ul_attribute__((warn_unused_result));
extern int mnt_context_do_umount(struct libmnt_context *cxt);
extern int mnt_context_finalize_umount(struct libmnt_context *cxt);
extern int mnt_context_tab_applied(struct libmnt_context *cxt);
extern int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status);
/*
* mount(8) userspace options masks (MNT_MAP_USERSPACE map)
*/
#define MNT_MS_NOAUTO (1 << 2)
#define MNT_MS_USER (1 << 3)
#define MNT_MS_USERS (1 << 4)
#define MNT_MS_OWNER (1 << 5)
#define MNT_MS_GROUP (1 << 6)
#define MNT_MS_NETDEV (1 << 7)
#define MNT_MS_COMMENT (1 << 8)
#define MNT_MS_LOOP (1 << 9)
#define MNT_MS_NOFAIL (1 << 10)
#define MNT_MS_UHELPER (1 << 11)
#define MNT_MS_HELPER (1 << 12)
#define MNT_MS_XCOMMENT (1 << 13)
#define MNT_MS_OFFSET (1 << 14)
#define MNT_MS_SIZELIMIT (1 << 15)
#define MNT_MS_ENCRYPTION (1 << 16)
#define MNT_MS_XFSTABCOMM (1 << 17)
/*
* mount(2) MS_* masks (MNT_MAP_LINUX map)
*/
#ifndef MS_RDONLY
#define MS_RDONLY 1 /* Mount read-only */
#endif
#ifndef MS_NOSUID
#define MS_NOSUID 2 /* Ignore suid and sgid bits */
#endif
#ifndef MS_NODEV
#define MS_NODEV 4 /* Disallow access to device special files */
#endif
#ifndef MS_NOEXEC
#define MS_NOEXEC 8 /* Disallow program execution */
#endif
#ifndef MS_SYNCHRONOUS
#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
#endif
#ifndef MS_REMOUNT
#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
#endif
#ifndef MS_MANDLOCK
#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
#endif
#ifndef MS_DIRSYNC
#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
#endif
#ifndef MS_NOATIME
#define MS_NOATIME 0x400 /* 1024: Do not update access times. */
#endif
#ifndef MS_NODIRATIME
#define MS_NODIRATIME 0x800 /* 2048: Don't update directory access times */
#endif
#ifndef MS_BIND
#define MS_BIND 0x1000 /* 4096: Mount existing tree elsewhere as well */
#endif
#ifndef MS_MOVE
#define MS_MOVE 0x2000 /* 8192: Atomically move the tree */
#endif
#ifndef MS_REC
#define MS_REC 0x4000 /* 16384: Recursive loopback */
#endif
#ifndef MS_SILENT
#define MS_SILENT 0x8000 /* 32768: Don't emit certain kernel messages */
#endif
#ifndef MS_UNBINDABLE
#define MS_UNBINDABLE (1<<17) /* 131072: Make unbindable */
#endif
#ifndef MS_PRIVATE
#define MS_PRIVATE (1<<18) /* 262144: Make private */
#endif
#ifndef MS_SLAVE
#define MS_SLAVE (1<<19) /* 524288: Make slave */
#endif
#ifndef MS_SHARED
#define MS_SHARED (1<<20) /* 1048576: Make shared */
#endif
#ifndef MS_RELATIME
#define MS_RELATIME (1<<21) /* 2097152: Update atime relative to mtime/ctime */
#endif
#ifndef MS_I_VERSION
#define MS_I_VERSION (1<<23) /* Update the inode I_version field */
#endif
#ifndef MS_STRICTATIME
#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
#endif
#ifndef MS_LAZYTIME
#define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */
#endif
/*
* Magic mount flag number. Had to be or-ed to the flag values.
*/
#ifndef MS_MGC_VAL
#define MS_MGC_VAL 0xC0ED0000 /* magic flag number to indicate "new" flags */
#endif
#ifndef MS_MGC_MSK
#define MS_MGC_MSK 0xffff0000 /* magic flag number mask */
#endif
/* Shared-subtree options */
#define MS_PROPAGATION (MS_SHARED|MS_SLAVE|MS_UNBINDABLE|MS_PRIVATE)
/* Options that we make ordinary users have by default. */
#define MS_SECURE (MS_NOEXEC|MS_NOSUID|MS_NODEV)
/* Options that we make owner-mounted devices have by default */
#define MS_OWNERSECURE (MS_NOSUID|MS_NODEV)
#ifdef __cplusplus
}
#endif
#endif /* _LIBMOUNT_MOUNT_H */

View File

@ -0,0 +1,309 @@
/*
* Prints table or tree.
*
* Copyright (C) 2014 Ondrej Oprala <ooprala@redhat.com>
* Copyright (C) 2014 Karel Zak <kzak@redhat.com>
*
* This file may be redistributed under the terms of the
* GNU Lesser General Public License.
*/
#ifndef _LIBSMARTCOLS_H
#define _LIBSMARTCOLS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
/**
* LIBSMARTCOLS_VERSION:
*
* Library version string
*/
#define LIBSMARTCOLS_VERSION "2.31.1"
/**
* libscols_iter:
*
* Generic iterator
*/
struct libscols_iter;
/**
* libscols_symbols:
*
* Symbol groups for printing tree hierarchies
*/
struct libscols_symbols;
/**
* libscols_cell:
*
* A cell - the smallest library object
*/
struct libscols_cell;
/**
* libscols_line:
*
* A line - an array of cells
*/
struct libscols_line;
/**
* libscols_table:
*
* A table - The most abstract object, encapsulating lines, columns, symbols and cells
*/
struct libscols_table;
/**
* libscols_column:
*
* A column - defines the number of columns and column names
*/
struct libscols_column;
/* iter.c */
enum {
SCOLS_ITER_FORWARD = 0,
SCOLS_ITER_BACKWARD
};
/*
* Column flags
*/
enum {
SCOLS_FL_TRUNC = (1 << 0), /* truncate fields data if necessary */
SCOLS_FL_TREE = (1 << 1), /* use tree "ascii art" */
SCOLS_FL_RIGHT = (1 << 2), /* align to the right */
SCOLS_FL_STRICTWIDTH = (1 << 3), /* don't reduce width if column is empty */
SCOLS_FL_NOEXTREMES = (1 << 4), /* ignore extreme fields when count column width*/
SCOLS_FL_HIDDEN = (1 << 5), /* maintain data, but don't print */
SCOLS_FL_WRAP = (1 << 6) /* wrap long lines to multi-line cells */
};
/*
* Cell flags, see scols_cell_set_flags() before use
*/
enum {
/* alignment evaluated in order: right,center,left */
SCOLS_CELL_FL_LEFT = 0,
SCOLS_CELL_FL_CENTER = (1 << 0),
SCOLS_CELL_FL_RIGHT = (1 << 1)
};
extern struct libscols_iter *scols_new_iter(int direction);
extern void scols_free_iter(struct libscols_iter *itr);
extern void scols_reset_iter(struct libscols_iter *itr, int direction);
extern int scols_iter_get_direction(const struct libscols_iter *itr);
/* init.c */
extern void scols_init_debug(int mask);
/* version.c */
extern int scols_parse_version_string(const char *ver_string);
extern int scols_get_library_version(const char **ver_string);
/* symbols.c */
extern struct libscols_symbols *scols_new_symbols(void);
extern void scols_ref_symbols(struct libscols_symbols *sy);
extern void scols_unref_symbols(struct libscols_symbols *sy);
extern struct libscols_symbols *scols_copy_symbols(const struct libscols_symbols *sy);
extern int scols_symbols_set_branch(struct libscols_symbols *sy, const char *str);
extern int scols_symbols_set_vertical(struct libscols_symbols *sy, const char *str);
extern int scols_symbols_set_right(struct libscols_symbols *sy, const char *str);
extern int scols_symbols_set_title_padding(struct libscols_symbols *sy, const char *str);
extern int scols_symbols_set_cell_padding(struct libscols_symbols *sy, const char *str);
/* cell.c */
extern int scols_reset_cell(struct libscols_cell *ce);
extern int scols_cell_copy_content(struct libscols_cell *dest,
const struct libscols_cell *src);
extern int scols_cell_set_data(struct libscols_cell *ce, const char *data);
extern int scols_cell_refer_data(struct libscols_cell *ce, char *data);
extern const char *scols_cell_get_data(const struct libscols_cell *ce);
extern int scols_cell_set_color(struct libscols_cell *ce, const char *color);
extern const char *scols_cell_get_color(const struct libscols_cell *ce);
extern int scols_cell_set_flags(struct libscols_cell *ce, int flags);
extern int scols_cell_get_flags(const struct libscols_cell *ce);
extern int scols_cell_get_alignment(const struct libscols_cell *ce);
extern void *scols_cell_get_userdata(struct libscols_cell *ce);
extern int scols_cell_set_userdata(struct libscols_cell *ce, void *data);
extern int scols_cmpstr_cells(struct libscols_cell *a,
struct libscols_cell *b, void *data);
/* column.c */
extern int scols_column_is_tree(const struct libscols_column *cl);
extern int scols_column_is_trunc(const struct libscols_column *cl);
extern int scols_column_is_right(const struct libscols_column *cl);
extern int scols_column_is_strict_width(const struct libscols_column *cl);
extern int scols_column_is_hidden(const struct libscols_column *cl);
extern int scols_column_is_noextremes(const struct libscols_column *cl);
extern int scols_column_is_wrap(const struct libscols_column *cl);
extern int scols_column_is_customwrap(const struct libscols_column *cl);
extern size_t scols_column_get_width(const struct libscols_column *cl);
extern int scols_column_set_safechars(struct libscols_column *cl, const char *safe);
extern const char *scols_column_get_safechars(const struct libscols_column *cl);
extern int scols_column_set_flags(struct libscols_column *cl, int flags);
extern int scols_column_get_flags(const struct libscols_column *cl);
extern struct libscols_column *scols_new_column(void);
extern void scols_ref_column(struct libscols_column *cl);
extern void scols_unref_column(struct libscols_column *cl);
extern struct libscols_column *scols_copy_column(const struct libscols_column *cl);
extern int scols_column_set_whint(struct libscols_column *cl, double whint);
extern double scols_column_get_whint(const struct libscols_column *cl);
extern struct libscols_cell *scols_column_get_header(struct libscols_column *cl);
extern int scols_column_set_color(struct libscols_column *cl, const char *color);
extern const char *scols_column_get_color(const struct libscols_column *cl);
extern struct libscols_table *scols_column_get_table(const struct libscols_column *cl);
extern int scols_column_set_cmpfunc(struct libscols_column *cl,
int (*cmp)(struct libscols_cell *a,
struct libscols_cell *b, void *),
void *data);
extern int scols_column_set_wrapfunc(struct libscols_column *cl,
size_t (*wrap_chunksize)(const struct libscols_column *,
const char *, void *),
char * (*wrap_nextchunk)(const struct libscols_column *,
char *, void *),
void *userdata);
extern char *scols_wrapnl_nextchunk(const struct libscols_column *cl, char *data, void *userdata);
extern size_t scols_wrapnl_chunksize(const struct libscols_column *cl, const char *data, void *userdata);
/* line.c */
extern struct libscols_line *scols_new_line(void);
extern void scols_ref_line(struct libscols_line *ln);
extern void scols_unref_line(struct libscols_line *ln);
extern int scols_line_alloc_cells(struct libscols_line *ln, size_t n);
extern void scols_line_free_cells(struct libscols_line *ln);
extern int scols_line_set_userdata(struct libscols_line *ln, void *data);
extern void *scols_line_get_userdata(struct libscols_line *ln);
extern int scols_line_remove_child(struct libscols_line *ln, struct libscols_line *child);
extern int scols_line_add_child(struct libscols_line *ln, struct libscols_line *child);
extern int scols_line_has_children(struct libscols_line *ln);
extern int scols_line_is_ancestor(struct libscols_line *ln, struct libscols_line *parent);
extern int scols_line_next_child(struct libscols_line *ln,
struct libscols_iter *itr, struct libscols_line **chld);
extern struct libscols_line *scols_line_get_parent(const struct libscols_line *ln);
extern int scols_line_set_color(struct libscols_line *ln, const char *color);
extern const char *scols_line_get_color(const struct libscols_line *ln);
extern size_t scols_line_get_ncells(const struct libscols_line *ln);
extern struct libscols_cell *scols_line_get_cell(struct libscols_line *ln, size_t n);
extern struct libscols_cell *scols_line_get_column_cell(
struct libscols_line *ln,
struct libscols_column *cl);
extern int scols_line_set_data(struct libscols_line *ln, size_t n, const char *data);
extern int scols_line_refer_data(struct libscols_line *ln, size_t n, char *data);
extern int scols_line_set_column_data(struct libscols_line *ln, struct libscols_column *cl, const char *data);
extern int scols_line_refer_column_data(struct libscols_line *ln, struct libscols_column *cl, char *data);
extern struct libscols_line *scols_copy_line(const struct libscols_line *ln);
/* table */
extern int scols_table_colors_wanted(const struct libscols_table *tb);
extern int scols_table_set_name(struct libscols_table *tb, const char *name);
extern const char *scols_table_get_name(const struct libscols_table *tb);
extern struct libscols_cell *scols_table_get_title(struct libscols_table *tb);
extern int scols_table_is_raw(const struct libscols_table *tb);
extern int scols_table_is_ascii(const struct libscols_table *tb);
extern int scols_table_is_json(const struct libscols_table *tb);
extern int scols_table_is_noheadings(const struct libscols_table *tb);
extern int scols_table_is_header_repeat(const struct libscols_table *tb);
extern int scols_table_is_empty(const struct libscols_table *tb);
extern int scols_table_is_export(const struct libscols_table *tb);
extern int scols_table_is_maxout(const struct libscols_table *tb);
extern int scols_table_is_nowrap(const struct libscols_table *tb);
extern int scols_table_is_nolinesep(const struct libscols_table *tb);
extern int scols_table_is_tree(const struct libscols_table *tb);
extern int scols_table_is_noencoding(const struct libscols_table *tb);
extern int scols_table_enable_colors(struct libscols_table *tb, int enable);
extern int scols_table_enable_raw(struct libscols_table *tb, int enable);
extern int scols_table_enable_ascii(struct libscols_table *tb, int enable);
extern int scols_table_enable_json(struct libscols_table *tb, int enable);
extern int scols_table_enable_noheadings(struct libscols_table *tb, int enable);
extern int scols_table_enable_header_repeat(struct libscols_table *tb, int enable);
extern int scols_table_enable_export(struct libscols_table *tb, int enable);
extern int scols_table_enable_maxout(struct libscols_table *tb, int enable);
extern int scols_table_enable_nowrap(struct libscols_table *tb, int enable);
extern int scols_table_enable_nolinesep(struct libscols_table *tb, int enable);
extern int scols_table_enable_noencoding(struct libscols_table *tb, int enable);
extern int scols_table_set_column_separator(struct libscols_table *tb, const char *sep);
extern int scols_table_set_line_separator(struct libscols_table *tb, const char *sep);
extern struct libscols_table *scols_new_table(void);
extern void scols_ref_table(struct libscols_table *tb);
extern void scols_unref_table(struct libscols_table *tb);
extern int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl);
extern int scols_table_remove_column(struct libscols_table *tb, struct libscols_column *cl);
extern int scols_table_remove_columns(struct libscols_table *tb);
extern int scols_table_move_column(struct libscols_table *tb, struct libscols_column *pre, struct libscols_column *cl);
extern struct libscols_column *scols_table_new_column(struct libscols_table *tb, const char *name, double whint, int flags);
extern int scols_table_next_column(struct libscols_table *tb, struct libscols_iter *itr, struct libscols_column **cl);
extern const char *scols_table_get_column_separator(const struct libscols_table *tb);
extern const char *scols_table_get_line_separator(const struct libscols_table *tb);
extern size_t scols_table_get_ncols(const struct libscols_table *tb);
extern size_t scols_table_get_nlines(const struct libscols_table *tb);
extern struct libscols_column *scols_table_get_column(struct libscols_table *tb, size_t n);
extern int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln);
extern int scols_table_remove_line(struct libscols_table *tb, struct libscols_line *ln);
extern void scols_table_remove_lines(struct libscols_table *tb);
extern int scols_table_next_line(struct libscols_table *tb, struct libscols_iter *itr, struct libscols_line **ln);
extern struct libscols_line *scols_table_new_line(struct libscols_table *tb, struct libscols_line *parent);
extern struct libscols_line *scols_table_get_line(struct libscols_table *tb, size_t n);
extern struct libscols_table *scols_copy_table(struct libscols_table *tb);
extern int scols_table_set_symbols(struct libscols_table *tb, struct libscols_symbols *sy);
extern int scols_table_set_default_symbols(struct libscols_table *tb);
extern struct libscols_symbols *scols_table_get_symbols(const struct libscols_table *tb);
extern int scols_table_set_stream(struct libscols_table *tb, FILE *stream);
extern FILE *scols_table_get_stream(const struct libscols_table *tb);
extern int scols_table_reduce_termwidth(struct libscols_table *tb, size_t reduce);
extern int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl);
extern int scols_sort_table_by_tree(struct libscols_table *tb);
/*
*
*/
enum {
SCOLS_TERMFORCE_AUTO = 0,
SCOLS_TERMFORCE_NEVER,
SCOLS_TERMFORCE_ALWAYS
};
extern int scols_table_set_termforce(struct libscols_table *tb, int force);
extern int scols_table_get_termforce(const struct libscols_table *tb);
extern int scols_table_set_termwidth(struct libscols_table *tb, size_t width);
extern size_t scols_table_get_termwidth(const struct libscols_table *tb);
extern int scols_table_set_termheight(struct libscols_table *tb, size_t height);
extern size_t scols_table_get_termheight(const struct libscols_table *tb);
/* table_print.c */
extern int scols_print_table(struct libscols_table *tb);
extern int scols_print_table_to_string(struct libscols_table *tb, char **data);
extern int scols_table_print_range( struct libscols_table *tb,
struct libscols_line *start,
struct libscols_line *end);
extern int scols_table_print_range_to_string( struct libscols_table *tb,
struct libscols_line *start,
struct libscols_line *end,
char **data);
#ifdef __cplusplus
}
#endif
#endif /* _LIBSMARTCOLS_H */

View File

@ -0,0 +1,96 @@
/*
* Summary: old DocBook SGML parser
* Description: interface for a DocBook SGML non-verifying parser
* This code is DEPRECATED, and should not be used anymore.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DOCB_PARSER_H__
#define __DOCB_PARSER_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_DOCB_ENABLED
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#ifndef IN_LIBXML
#ifdef __GNUC__
#warning "The DOCBparser module has been deprecated in libxml2-2.6.0"
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Most of the back-end structures from XML and SGML are shared.
*/
typedef xmlParserCtxt docbParserCtxt;
typedef xmlParserCtxtPtr docbParserCtxtPtr;
typedef xmlSAXHandler docbSAXHandler;
typedef xmlSAXHandlerPtr docbSAXHandlerPtr;
typedef xmlParserInput docbParserInput;
typedef xmlParserInputPtr docbParserInputPtr;
typedef xmlDocPtr docbDocPtr;
/*
* There is only few public functions.
*/
XMLPUBFUN int XMLCALL
docbEncodeEntities(unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen, int quoteChar);
XMLPUBFUN docbDocPtr XMLCALL
docbSAXParseDoc (xmlChar *cur,
const char *encoding,
docbSAXHandlerPtr sax,
void *userData);
XMLPUBFUN docbDocPtr XMLCALL
docbParseDoc (xmlChar *cur,
const char *encoding);
XMLPUBFUN docbDocPtr XMLCALL
docbSAXParseFile (const char *filename,
const char *encoding,
docbSAXHandlerPtr sax,
void *userData);
XMLPUBFUN docbDocPtr XMLCALL
docbParseFile (const char *filename,
const char *encoding);
/**
* Interfaces for the Push mode.
*/
XMLPUBFUN void XMLCALL
docbFreeParserCtxt (docbParserCtxtPtr ctxt);
XMLPUBFUN docbParserCtxtPtr XMLCALL
docbCreatePushParserCtxt(docbSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
docbParseChunk (docbParserCtxtPtr ctxt,
const char *chunk,
int size,
int terminate);
XMLPUBFUN docbParserCtxtPtr XMLCALL
docbCreateFileParserCtxt(const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
docbParseDocument (docbParserCtxtPtr ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_DOCB_ENABLED */
#endif /* __DOCB_PARSER_H__ */

View File

@ -0,0 +1,306 @@
/*
* Summary: interface for an HTML 4.0 non-verifying parser
* Description: this module implements an HTML 4.0 non-verifying parser
* with API compatible with the XML parser ones. It should
* be able to parse "real world" HTML, even if severely
* broken from a specification point of view.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __HTML_PARSER_H__
#define __HTML_PARSER_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#ifdef LIBXML_HTML_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/*
* Most of the back-end structures from XML and HTML are shared.
*/
typedef xmlParserCtxt htmlParserCtxt;
typedef xmlParserCtxtPtr htmlParserCtxtPtr;
typedef xmlParserNodeInfo htmlParserNodeInfo;
typedef xmlSAXHandler htmlSAXHandler;
typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
typedef xmlParserInput htmlParserInput;
typedef xmlParserInputPtr htmlParserInputPtr;
typedef xmlDocPtr htmlDocPtr;
typedef xmlNodePtr htmlNodePtr;
/*
* Internal description of an HTML element, representing HTML 4.01
* and XHTML 1.0 (which share the same structure).
*/
typedef struct _htmlElemDesc htmlElemDesc;
typedef htmlElemDesc *htmlElemDescPtr;
struct _htmlElemDesc {
const char *name; /* The tag name */
char startTag; /* Whether the start tag can be implied */
char endTag; /* Whether the end tag can be implied */
char saveEndTag; /* Whether the end tag should be saved */
char empty; /* Is this an empty element ? */
char depr; /* Is this a deprecated element ? */
char dtd; /* 1: only in Loose DTD, 2: only Frameset one */
char isinline; /* is this a block 0 or inline 1 element */
const char *desc; /* the description */
/* NRK Jan.2003
* New fields encapsulating HTML structure
*
* Bugs:
* This is a very limited representation. It fails to tell us when
* an element *requires* subelements (we only have whether they're
* allowed or not), and it doesn't tell us where CDATA and PCDATA
* are allowed. Some element relationships are not fully represented:
* these are flagged with the word MODIFIER
*/
const char** subelts; /* allowed sub-elements of this element */
const char* defaultsubelt; /* subelement for suggested auto-repair
if necessary or NULL */
const char** attrs_opt; /* Optional Attributes */
const char** attrs_depr; /* Additional deprecated attributes */
const char** attrs_req; /* Required attributes */
};
/*
* Internal description of an HTML entity.
*/
typedef struct _htmlEntityDesc htmlEntityDesc;
typedef htmlEntityDesc *htmlEntityDescPtr;
struct _htmlEntityDesc {
unsigned int value; /* the UNICODE value for the character */
const char *name; /* The entity name */
const char *desc; /* the description */
};
/*
* There is only few public functions.
*/
XMLPUBFUN const htmlElemDesc * XMLCALL
htmlTagLookup (const xmlChar *tag);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlEntityLookup(const xmlChar *name);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlEntityValueLookup(unsigned int value);
XMLPUBFUN int XMLCALL
htmlIsAutoClosed(htmlDocPtr doc,
htmlNodePtr elem);
XMLPUBFUN int XMLCALL
htmlAutoCloseTag(htmlDocPtr doc,
const xmlChar *name,
htmlNodePtr elem);
XMLPUBFUN const htmlEntityDesc * XMLCALL
htmlParseEntityRef(htmlParserCtxtPtr ctxt,
const xmlChar **str);
XMLPUBFUN int XMLCALL
htmlParseCharRef(htmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
htmlParseElement(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlNewParserCtxt(void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN int XMLCALL
htmlParseDocument(htmlParserCtxtPtr ctxt);
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseDoc (const xmlChar *cur,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseDoc (const xmlChar *cur,
const char *encoding);
XMLPUBFUN htmlDocPtr XMLCALL
htmlSAXParseFile(const char *filename,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseFile (const char *filename,
const char *encoding);
XMLPUBFUN int XMLCALL
UTF8ToHtml (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
XMLPUBFUN int XMLCALL
htmlEncodeEntities(unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen, int quoteChar);
XMLPUBFUN int XMLCALL
htmlIsScriptAttribute(const xmlChar *name);
XMLPUBFUN int XMLCALL
htmlHandleOmittedElem(int val);
#ifdef LIBXML_PUSH_ENABLED
/**
* Interfaces for the Push mode.
*/
XMLPUBFUN htmlParserCtxtPtr XMLCALL
htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
void *user_data,
const char *chunk,
int size,
const char *filename,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
htmlParseChunk (htmlParserCtxtPtr ctxt,
const char *chunk,
int size,
int terminate);
#endif /* LIBXML_PUSH_ENABLED */
XMLPUBFUN void XMLCALL
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
/*
* New set of simpler/more flexible APIs
*/
/**
* xmlParserOption:
*
* This is the set of XML parser options that can be passed down
* to the xmlReadDoc() and similar calls.
*/
typedef enum {
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
HTML_PARSE_NONET = 1<<11,/* Forbid network access */
HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */
HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */
HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */
} htmlParserOption;
XMLPUBFUN void XMLCALL
htmlCtxtReset (htmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
htmlCtxtUseOptions (htmlParserCtxtPtr ctxt,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadDoc (const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadFile (const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadFile (xmlParserCtxtPtr ctxt,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadFd (xmlParserCtxtPtr ctxt,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN htmlDocPtr XMLCALL
htmlCtxtReadIO (xmlParserCtxtPtr ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/* NRK/Jan2003: further knowledge of HTML structure
*/
typedef enum {
HTML_NA = 0 , /* something we don't check at all */
HTML_INVALID = 0x1 ,
HTML_DEPRECATED = 0x2 ,
HTML_VALID = 0x4 ,
HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */
} htmlStatus ;
/* Using htmlElemDesc rather than name here, to emphasise the fact
that otherwise there's a lookup overhead
*/
XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ;
/**
* htmlDefaultSubelement:
* @elt: HTML element
*
* Returns the default subelement for this element
*/
#define htmlDefaultSubelement(elt) elt->defaultsubelt
/**
* htmlElementAllowedHereDesc:
* @parent: HTML parent element
* @elt: HTML element
*
* Checks whether an HTML element description may be a
* direct child of the specified element.
*
* Returns 1 if allowed; 0 otherwise.
*/
#define htmlElementAllowedHereDesc(parent,elt) \
htmlElementAllowedHere((parent), (elt)->name)
/**
* htmlRequiredAttrs:
* @elt: HTML element
*
* Returns the attributes required for the specified element.
*/
#define htmlRequiredAttrs(elt) (elt)->attrs_req
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTML_ENABLED */
#endif /* __HTML_PARSER_H__ */

View File

@ -0,0 +1,147 @@
/*
* Summary: specific APIs to process HTML tree, especially serialization
* Description: this module implements a few function needed to process
* tree in an HTML specific way.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __HTML_TREE_H__
#define __HTML_TREE_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/HTMLparser.h>
#ifdef LIBXML_HTML_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* HTML_TEXT_NODE:
*
* Macro. A text node in a HTML document is really implemented
* the same way as a text node in an XML document.
*/
#define HTML_TEXT_NODE XML_TEXT_NODE
/**
* HTML_ENTITY_REF_NODE:
*
* Macro. An entity reference in a HTML document is really implemented
* the same way as an entity reference in an XML document.
*/
#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE
/**
* HTML_COMMENT_NODE:
*
* Macro. A comment in a HTML document is really implemented
* the same way as a comment in an XML document.
*/
#define HTML_COMMENT_NODE XML_COMMENT_NODE
/**
* HTML_PRESERVE_NODE:
*
* Macro. A preserved node in a HTML document is really implemented
* the same way as a CDATA section in an XML document.
*/
#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE
/**
* HTML_PI_NODE:
*
* Macro. A processing instruction in a HTML document is really implemented
* the same way as a processing instruction in an XML document.
*/
#define HTML_PI_NODE XML_PI_NODE
XMLPUBFUN htmlDocPtr XMLCALL
htmlNewDoc (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN htmlDocPtr XMLCALL
htmlNewDocNoDtD (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN const xmlChar * XMLCALL
htmlGetMetaEncoding (htmlDocPtr doc);
XMLPUBFUN int XMLCALL
htmlSetMetaEncoding (htmlDocPtr doc,
const xmlChar *encoding);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
htmlDocDumpMemory (xmlDocPtr cur,
xmlChar **mem,
int *size);
XMLPUBFUN void XMLCALL
htmlDocDumpMemoryFormat (xmlDocPtr cur,
xmlChar **mem,
int *size,
int format);
XMLPUBFUN int XMLCALL
htmlDocDump (FILE *f,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
htmlSaveFile (const char *filename,
xmlDocPtr cur);
XMLPUBFUN int XMLCALL
htmlNodeDump (xmlBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN void XMLCALL
htmlNodeDumpFile (FILE *out,
xmlDocPtr doc,
xmlNodePtr cur);
XMLPUBFUN int XMLCALL
htmlNodeDumpFileFormat (FILE *out,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding,
int format);
XMLPUBFUN int XMLCALL
htmlSaveFileEnc (const char *filename,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN int XMLCALL
htmlSaveFileFormat (const char *filename,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding);
XMLPUBFUN void XMLCALL
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
xmlDocPtr cur,
const char *encoding,
int format);
XMLPUBFUN void XMLCALL
htmlNodeDumpOutput (xmlOutputBufferPtr buf,
xmlDocPtr doc,
xmlNodePtr cur,
const char *encoding);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
htmlIsBooleanAttr (const xmlChar *name);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTML_ENABLED */
#endif /* __HTML_TREE_H__ */

View File

@ -0,0 +1,173 @@
/*
* Summary: Old SAX version 1 handler, deprecated
* Description: DEPRECATED set of SAX version 1 interfaces used to
* build the DOM tree.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SAX_H__
#define __XML_SAX_H__
#include <stdio.h>
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xlink.h>
#ifdef LIBXML_LEGACY_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN const xmlChar * XMLCALL
getPublicId (void *ctx);
XMLPUBFUN const xmlChar * XMLCALL
getSystemId (void *ctx);
XMLPUBFUN void XMLCALL
setDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc);
XMLPUBFUN int XMLCALL
getLineNumber (void *ctx);
XMLPUBFUN int XMLCALL
getColumnNumber (void *ctx);
XMLPUBFUN int XMLCALL
isStandalone (void *ctx);
XMLPUBFUN int XMLCALL
hasInternalSubset (void *ctx);
XMLPUBFUN int XMLCALL
hasExternalSubset (void *ctx);
XMLPUBFUN void XMLCALL
internalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN void XMLCALL
externalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlEntityPtr XMLCALL
getEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
getParameterEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlParserInputPtr XMLCALL
resolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
entityDecl (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
XMLPUBFUN void XMLCALL
attributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
XMLPUBFUN void XMLCALL
elementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
notationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
unparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
XMLPUBFUN void XMLCALL
startDocument (void *ctx);
XMLPUBFUN void XMLCALL
endDocument (void *ctx);
XMLPUBFUN void XMLCALL
attribute (void *ctx,
const xmlChar *fullname,
const xmlChar *value);
XMLPUBFUN void XMLCALL
startElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XMLPUBFUN void XMLCALL
endElement (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
reference (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
characters (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
ignorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
processingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XMLPUBFUN void XMLCALL
globalNamespace (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
setNamespace (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlNsPtr XMLCALL
getNamespace (void *ctx);
XMLPUBFUN int XMLCALL
checkNamespace (void *ctx,
xmlChar *nameSpace);
XMLPUBFUN void XMLCALL
namespaceDecl (void *ctx,
const xmlChar *href,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
comment (void *ctx,
const xmlChar *value);
XMLPUBFUN void XMLCALL
cdataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN void XMLCALL
initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN void XMLCALL
initdocbDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
#endif
#endif /* LIBXML_SAX1_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_LEGACY_ENABLED */
#endif /* __XML_SAX_H__ */

View File

@ -0,0 +1,178 @@
/*
* Summary: SAX2 parser interface used to build the DOM tree
* Description: those are the default SAX2 interfaces used by
* the library when building DOM tree.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SAX2_H__
#define __XML_SAX2_H__
#include <stdio.h>
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xlink.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN const xmlChar * XMLCALL
xmlSAX2GetPublicId (void *ctx);
XMLPUBFUN const xmlChar * XMLCALL
xmlSAX2GetSystemId (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2SetDocumentLocator (void *ctx,
xmlSAXLocatorPtr loc);
XMLPUBFUN int XMLCALL
xmlSAX2GetLineNumber (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2GetColumnNumber (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2IsStandalone (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2HasInternalSubset (void *ctx);
XMLPUBFUN int XMLCALL
xmlSAX2HasExternalSubset (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2InternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN void XMLCALL
xmlSAX2ExternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *ExternalID,
const xmlChar *SystemID);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlSAX2GetEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlSAX2GetParameterEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlSAX2ResolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
xmlSAX2EntityDecl (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
XMLPUBFUN void XMLCALL
xmlSAX2AttributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
XMLPUBFUN void XMLCALL
xmlSAX2ElementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlSAX2NotationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void XMLCALL
xmlSAX2UnparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
XMLPUBFUN void XMLCALL
xmlSAX2StartDocument (void *ctx);
XMLPUBFUN void XMLCALL
xmlSAX2EndDocument (void *ctx);
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || \
defined(LIBXML_LEGACY_ENABLED)
XMLPUBFUN void XMLCALL
xmlSAX2StartElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XMLPUBFUN void XMLCALL
xmlSAX2EndElement (void *ctx,
const xmlChar *name);
#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */
XMLPUBFUN void XMLCALL
xmlSAX2StartElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI,
int nb_namespaces,
const xmlChar **namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar **attributes);
XMLPUBFUN void XMLCALL
xmlSAX2EndElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI);
XMLPUBFUN void XMLCALL
xmlSAX2Reference (void *ctx,
const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlSAX2Characters (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
xmlSAX2IgnorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void XMLCALL
xmlSAX2ProcessingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XMLPUBFUN void XMLCALL
xmlSAX2Comment (void *ctx,
const xmlChar *value);
XMLPUBFUN void XMLCALL
xmlSAX2CDataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN int XMLCALL
xmlSAXDefaultVersion (int version);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int XMLCALL
xmlSAXVersion (xmlSAXHandler *hdlr,
int version);
XMLPUBFUN void XMLCALL
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void XMLCALL
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
XMLPUBFUN void XMLCALL
htmlDefaultSAXHandlerInit (void);
#endif
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN void XMLCALL
xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr);
XMLPUBFUN void XMLCALL
docbDefaultSAXHandlerInit (void);
#endif
XMLPUBFUN void XMLCALL
xmlDefaultSAXHandlerInit (void);
#ifdef __cplusplus
}
#endif
#endif /* __XML_SAX2_H__ */

View File

@ -0,0 +1,126 @@
/*
* Summary: Provide Canonical XML and Exclusive XML Canonicalization
* Description: the c14n modules provides a
*
* "Canonical XML" implementation
* http://www.w3.org/TR/xml-c14n
*
* and an
*
* "Exclusive XML Canonicalization" implementation
* http://www.w3.org/TR/xml-exc-c14n
* Copy: See Copyright for the status of this software.
*
* Author: Aleksey Sanin <aleksey@aleksey.com>
*/
#ifndef __XML_C14N_H__
#define __XML_C14N_H__
#ifdef LIBXML_C14N_ENABLED
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
/*
* XML Canonicazation
* http://www.w3.org/TR/xml-c14n
*
* Exclusive XML Canonicazation
* http://www.w3.org/TR/xml-exc-c14n
*
* Canonical form of an XML document could be created if and only if
* a) default attributes (if any) are added to all nodes
* b) all character and parsed entity references are resolved
* In order to achive this in libxml2 the document MUST be loaded with
* following global setings:
*
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
* xmlSubstituteEntitiesDefault(1);
*
* or corresponding parser context setting:
* xmlParserCtxtPtr ctxt;
*
* ...
* ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
* ctxt->replaceEntities = 1;
* ...
*/
/*
* xmlC14NMode:
*
* Predefined values for C14N modes
*
*/
typedef enum {
XML_C14N_1_0 = 0, /* Origianal C14N 1.0 spec */
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
XML_C14N_1_1 = 2 /* C14N 1.1 spec */
} xmlC14NMode;
XMLPUBFUN int XMLCALL
xmlC14NDocSaveTo (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf);
XMLPUBFUN int XMLCALL
xmlC14NDocDumpMemory (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlChar **doc_txt_ptr);
XMLPUBFUN int XMLCALL
xmlC14NDocSave (xmlDocPtr doc,
xmlNodeSetPtr nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
const char* filename,
int compression);
/**
* This is the core C14N function
*/
/**
* xmlC14NIsVisibleCallback:
* @user_data: user data
* @node: the curent node
* @parent: the parent node
*
* Signature for a C14N callback on visible nodes
*
* Returns 1 if the node should be included
*/
typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
xmlNodePtr node,
xmlNodePtr parent);
XMLPUBFUN int XMLCALL
xmlC14NExecute (xmlDocPtr doc,
xmlC14NIsVisibleCallback is_visible_callback,
void* user_data,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBufferPtr buf);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* LIBXML_C14N_ENABLED */
#endif /* __XML_C14N_H__ */

View File

@ -0,0 +1,182 @@
/**
* Summary: interfaces to the Catalog handling system
* Description: the catalog module implements the support for
* XML Catalogs and SGML catalogs
*
* SGML Open Technical Resolution TR9401:1997.
* http://www.jclark.com/sp/catalog.htm
*
* XML Catalogs Working Draft 06 August 2001
* http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_CATALOG_H__
#define __XML_CATALOG_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#include <libxml/tree.h>
#ifdef LIBXML_CATALOG_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* XML_CATALOGS_NAMESPACE:
*
* The namespace for the XML Catalogs elements.
*/
#define XML_CATALOGS_NAMESPACE \
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
/**
* XML_CATALOG_PI:
*
* The specific XML Catalog Processing Instuction name.
*/
#define XML_CATALOG_PI \
(const xmlChar *) "oasis-xml-catalog"
/*
* The API is voluntarily limited to general cataloging.
*/
typedef enum {
XML_CATA_PREFER_NONE = 0,
XML_CATA_PREFER_PUBLIC = 1,
XML_CATA_PREFER_SYSTEM
} xmlCatalogPrefer;
typedef enum {
XML_CATA_ALLOW_NONE = 0,
XML_CATA_ALLOW_GLOBAL = 1,
XML_CATA_ALLOW_DOCUMENT = 2,
XML_CATA_ALLOW_ALL = 3
} xmlCatalogAllow;
typedef struct _xmlCatalog xmlCatalog;
typedef xmlCatalog *xmlCatalogPtr;
/*
* Operations on a given catalog.
*/
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlNewCatalog (int sgml);
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlLoadACatalog (const char *filename);
XMLPUBFUN xmlCatalogPtr XMLCALL
xmlLoadSGMLSuperCatalog (const char *filename);
XMLPUBFUN int XMLCALL
xmlConvertSGMLCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
xmlACatalogAdd (xmlCatalogPtr catal,
const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int XMLCALL
xmlACatalogRemove (xmlCatalogPtr catal,
const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolve (xmlCatalogPtr catal,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveSystem(xmlCatalogPtr catal,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolvePublic(xmlCatalogPtr catal,
const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL
xmlACatalogResolveURI (xmlCatalogPtr catal,
const xmlChar *URI);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlACatalogDump (xmlCatalogPtr catal,
FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeCatalog (xmlCatalogPtr catal);
XMLPUBFUN int XMLCALL
xmlCatalogIsEmpty (xmlCatalogPtr catal);
/*
* Global operations.
*/
XMLPUBFUN void XMLCALL
xmlInitializeCatalog (void);
XMLPUBFUN int XMLCALL
xmlLoadCatalog (const char *filename);
XMLPUBFUN void XMLCALL
xmlLoadCatalogs (const char *paths);
XMLPUBFUN void XMLCALL
xmlCatalogCleanup (void);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlCatalogDump (FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolve (const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolveSystem (const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolvePublic (const xmlChar *pubID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogResolveURI (const xmlChar *URI);
XMLPUBFUN int XMLCALL
xmlCatalogAdd (const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int XMLCALL
xmlCatalogRemove (const xmlChar *value);
XMLPUBFUN xmlDocPtr XMLCALL
xmlParseCatalogFile (const char *filename);
XMLPUBFUN int XMLCALL
xmlCatalogConvert (void);
/*
* Strictly minimal interfaces for per-document catalogs used
* by the parser.
*/
XMLPUBFUN void XMLCALL
xmlCatalogFreeLocal (void *catalogs);
XMLPUBFUN void * XMLCALL
xmlCatalogAddLocal (void *catalogs,
const xmlChar *URL);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogLocalResolve (void *catalogs,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar * XMLCALL
xmlCatalogLocalResolveURI(void *catalogs,
const xmlChar *URI);
/*
* Preference settings.
*/
XMLPUBFUN int XMLCALL
xmlCatalogSetDebug (int level);
XMLPUBFUN xmlCatalogPrefer XMLCALL
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
XMLPUBFUN void XMLCALL
xmlCatalogSetDefaults (xmlCatalogAllow allow);
XMLPUBFUN xmlCatalogAllow XMLCALL
xmlCatalogGetDefaults (void);
/* DEPRECATED interfaces */
XMLPUBFUN const xmlChar * XMLCALL
xmlCatalogGetSystem (const xmlChar *sysID);
XMLPUBFUN const xmlChar * XMLCALL
xmlCatalogGetPublic (const xmlChar *pubID);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_CATALOG_ENABLED */
#endif /* __XML_CATALOG_H__ */

View File

@ -0,0 +1,230 @@
/*
* Summary: Unicode character range checking
* Description: this module exports interfaces for the character
* range validation APIs
*
* This file is automatically generated from the cvs source
* definition files using the genChRanges.py Python script
*
* Generation date: Mon Mar 27 11:09:48 2006
* Sources: chvalid.def
* Author: William Brack <wbrack@mmm.com.hk>
*/
#ifndef __XML_CHVALID_H__
#define __XML_CHVALID_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define our typedefs and structures
*
*/
typedef struct _xmlChSRange xmlChSRange;
typedef xmlChSRange *xmlChSRangePtr;
struct _xmlChSRange {
unsigned short low;
unsigned short high;
};
typedef struct _xmlChLRange xmlChLRange;
typedef xmlChLRange *xmlChLRangePtr;
struct _xmlChLRange {
unsigned int low;
unsigned int high;
};
typedef struct _xmlChRangeGroup xmlChRangeGroup;
typedef xmlChRangeGroup *xmlChRangeGroupPtr;
struct _xmlChRangeGroup {
int nbShortRange;
int nbLongRange;
const xmlChSRange *shortRange; /* points to an array of ranges */
const xmlChLRange *longRange;
};
/**
* Range checking routine
*/
XMLPUBFUN int XMLCALL
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
/**
* xmlIsBaseChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a)) || \
((0xc0 <= (c)) && ((c) <= 0xd6)) || \
((0xd8 <= (c)) && ((c) <= 0xf6)) || \
(0xf8 <= (c)))
/**
* xmlIsBaseCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
xmlIsBaseChar_ch((c)) : \
xmlCharInRange((c), &xmlIsBaseCharGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
/**
* xmlIsBlank_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBlank_ch(c) (((c) == 0x20) || \
((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd))
/**
* xmlIsBlankQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsBlankQ(c) (((c) < 0x100) ? \
xmlIsBlank_ch((c)) : 0)
/**
* xmlIsChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd) || \
(0x20 <= (c)))
/**
* xmlIsCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsCharQ(c) (((c) < 0x100) ? \
xmlIsChar_ch((c)) :\
(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
((0x10000 <= (c)) && ((c) <= 0x10ffff))))
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
/**
* xmlIsCombiningQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsCombiningQ(c) (((c) < 0x100) ? \
0 : \
xmlCharInRange((c), &xmlIsCombiningGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
/**
* xmlIsDigit_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
/**
* xmlIsDigitQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsDigitQ(c) (((c) < 0x100) ? \
xmlIsDigit_ch((c)) : \
xmlCharInRange((c), &xmlIsDigitGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
/**
* xmlIsExtender_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsExtender_ch(c) (((c) == 0xb7))
/**
* xmlIsExtenderQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsExtenderQ(c) (((c) < 0x100) ? \
xmlIsExtender_ch((c)) : \
xmlCharInRange((c), &xmlIsExtenderGroup))
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
/**
* xmlIsIdeographicQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
0 :\
(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
((c) == 0x3007) || \
((0x3021 <= (c)) && ((c) <= 0x3029))))
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
/**
* xmlIsPubidChar_ch:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
/**
* xmlIsPubidCharQ:
* @c: char to validate
*
* Automatically generated by genChRanges.py
*/
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
xmlIsPubidChar_ch((c)) : 0)
XMLPUBFUN int XMLCALL
xmlIsBaseChar(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsBlank(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsChar(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsCombining(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsDigit(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsExtender(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsIdeographic(unsigned int ch);
XMLPUBFUN int XMLCALL
xmlIsPubidChar(unsigned int ch);
#ifdef __cplusplus
}
#endif
#endif /* __XML_CHVALID_H__ */

View File

@ -0,0 +1,217 @@
/*
* Summary: Tree debugging APIs
* Description: Interfaces to a set of routines used for debugging the tree
* produced by the XML parser.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DEBUG_XML__
#define __DEBUG_XML__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_DEBUG_ENABLED
#include <libxml/xpath.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The standard Dump routines.
*/
XMLPUBFUN void XMLCALL
xmlDebugDumpString (FILE *output,
const xmlChar *str);
XMLPUBFUN void XMLCALL
xmlDebugDumpAttr (FILE *output,
xmlAttrPtr attr,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpAttrList (FILE *output,
xmlAttrPtr attr,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpOneNode (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpNode (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpNodeList (FILE *output,
xmlNodePtr node,
int depth);
XMLPUBFUN void XMLCALL
xmlDebugDumpDocumentHead(FILE *output,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlDebugDumpDocument (FILE *output,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlDebugDumpDTD (FILE *output,
xmlDtdPtr dtd);
XMLPUBFUN void XMLCALL
xmlDebugDumpEntities (FILE *output,
xmlDocPtr doc);
/****************************************************************
* *
* Checking routines *
* *
****************************************************************/
XMLPUBFUN int XMLCALL
xmlDebugCheckDocument (FILE * output,
xmlDocPtr doc);
/****************************************************************
* *
* XML shell helpers *
* *
****************************************************************/
XMLPUBFUN void XMLCALL
xmlLsOneNode (FILE *output, xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlLsCountNode (xmlNodePtr node);
XMLPUBFUN const char * XMLCALL
xmlBoolToText (int boolval);
/****************************************************************
* *
* The XML shell related structures and functions *
* *
****************************************************************/
#ifdef LIBXML_XPATH_ENABLED
/**
* xmlShellReadlineFunc:
* @prompt: a string prompt
*
* This is a generic signature for the XML shell input function.
*
* Returns a string which will be freed by the Shell.
*/
typedef char * (* xmlShellReadlineFunc)(char *prompt);
/**
* xmlShellCtxt:
*
* A debugging shell context.
* TODO: add the defined function tables.
*/
typedef struct _xmlShellCtxt xmlShellCtxt;
typedef xmlShellCtxt *xmlShellCtxtPtr;
struct _xmlShellCtxt {
char *filename;
xmlDocPtr doc;
xmlNodePtr node;
xmlXPathContextPtr pctxt;
int loaded;
FILE *output;
xmlShellReadlineFunc input;
};
/**
* xmlShellCmd:
* @ctxt: a shell context
* @arg: a string argument
* @node: a first node
* @node2: a second node
*
* This is a generic signature for the XML shell functions.
*
* Returns an int, negative returns indicating errors.
*/
typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN void XMLCALL
xmlShellPrintXPathError (int errorType,
const char *arg);
XMLPUBFUN void XMLCALL
xmlShellPrintXPathResult(xmlXPathObjectPtr list);
XMLPUBFUN int XMLCALL
xmlShellList (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellBase (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellDir (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellLoad (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlShellPrintNode (xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlShellCat (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellWrite (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellSave (xmlShellCtxtPtr ctxt,
char *filename,
xmlNodePtr node,
xmlNodePtr node2);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int XMLCALL
xmlShellValidate (xmlShellCtxtPtr ctxt,
char *dtd,
xmlNodePtr node,
xmlNodePtr node2);
#endif /* LIBXML_VALID_ENABLED */
XMLPUBFUN int XMLCALL
xmlShellDu (xmlShellCtxtPtr ctxt,
char *arg,
xmlNodePtr tree,
xmlNodePtr node2);
XMLPUBFUN int XMLCALL
xmlShellPwd (xmlShellCtxtPtr ctxt,
char *buffer,
xmlNodePtr node,
xmlNodePtr node2);
/*
* The Shell interface.
*/
XMLPUBFUN void XMLCALL
xmlShell (xmlDocPtr doc,
char *filename,
xmlShellReadlineFunc input,
FILE *output);
#endif /* LIBXML_XPATH_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_DEBUG_ENABLED */
#endif /* __DEBUG_XML__ */

View File

@ -0,0 +1,86 @@
/*
* Summary: string dictionary
* Description: dictionary of reusable strings, just used to avoid allocation
* and freeing operations.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_DICT_H__
#define __XML_DICT_H__
#ifdef __cplusplus
#define __XML_EXTERNC extern "C"
#else
#define __XML_EXTERNC
#endif
/*
* The dictionary.
*/
__XML_EXTERNC typedef struct _xmlDict xmlDict;
__XML_EXTERNC typedef xmlDict *xmlDictPtr;
#include <limits.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Initializer
*/
XMLPUBFUN int XMLCALL xmlInitializeDict(void);
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlDictPtr XMLCALL
xmlDictCreate (void);
XMLPUBFUN size_t XMLCALL
xmlDictSetLimit (xmlDictPtr dict,
size_t limit);
XMLPUBFUN size_t XMLCALL
xmlDictGetUsage (xmlDictPtr dict);
XMLPUBFUN xmlDictPtr XMLCALL
xmlDictCreateSub(xmlDictPtr sub);
XMLPUBFUN int XMLCALL
xmlDictReference(xmlDictPtr dict);
XMLPUBFUN void XMLCALL
xmlDictFree (xmlDictPtr dict);
/*
* Lookup of entry in the dictionary.
*/
XMLPUBFUN const xmlChar * XMLCALL
xmlDictLookup (xmlDictPtr dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlDictExists (xmlDictPtr dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlDictQLookup (xmlDictPtr dict,
const xmlChar *prefix,
const xmlChar *name);
XMLPUBFUN int XMLCALL
xmlDictOwns (xmlDictPtr dict,
const xmlChar *str);
XMLPUBFUN int XMLCALL
xmlDictSize (xmlDictPtr dict);
/*
* Cleanup function
*/
XMLPUBFUN void XMLCALL
xmlDictCleanup (void);
#ifdef __cplusplus
}
#endif
#endif /* ! __XML_DICT_H__ */

View File

@ -0,0 +1,245 @@
/*
* Summary: interface for the encoding conversion functions
* Description: interface for the encoding conversion functions needed for
* XML basic encoding and iconv() support.
*
* Related specs are
* rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies
* [ISO-10646] UTF-8 and UTF-16 in Annexes
* [ISO-8859-1] ISO Latin-1 characters codes.
* [UNICODE] The Unicode Consortium, "The Unicode Standard --
* Worldwide Character Encoding -- Version 1.0", Addison-
* Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is
* described in Unicode Technical Report #4.
* [US-ASCII] Coded Character Set--7-bit American Standard Code for
* Information Interchange, ANSI X3.4-1986.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_CHAR_ENCODING_H__
#define __XML_CHAR_ENCODING_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_ICONV_ENABLED
#include <iconv.h>
#endif
#ifdef LIBXML_ICU_ENABLED
#include <unicode/ucnv.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* xmlCharEncoding:
*
* Predefined values for some standard encodings.
* Libxml does not do beforehand translation on UTF8 and ISOLatinX.
* It also supports ASCII, ISO-8859-1, and UTF16 (LE and BE) by default.
*
* Anything else would have to be translated to UTF8 before being
* given to the parser itself. The BOM for UTF16 and the encoding
* declaration are looked at and a converter is looked for at that
* point. If not found the parser stops here as asked by the XML REC. A
* converter can be registered by the user using xmlRegisterCharEncodingHandler
* but the current form doesn't allow stateful transcoding (a serious
* problem agreed !). If iconv has been found it will be used
* automatically and allow stateful transcoding, the simplest is then
* to be sure to enable iconv and to provide iconv libs for the encoding
* support needed.
*
* Note that the generic "UTF-16" is not a predefined value. Instead, only
* the specific UTF-16LE and UTF-16BE are present.
*/
typedef enum {
XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
} xmlCharEncoding;
/**
* xmlCharEncodingInputFunc:
* @out: a pointer to an array of bytes to store the UTF-8 result
* @outlen: the length of @out
* @in: a pointer to an array of chars in the original encoding
* @inlen: the length of @in
*
* Take a block of chars in the original encoding and try to convert
* it to an UTF-8 block of chars out.
*
* Returns the number of bytes written, -1 if lack of space, or -2
* if the transcoding failed.
* The value of @inlen after return is the number of octets consumed
* if the return value is positive, else unpredictiable.
* The value of @outlen after return is the number of octets consumed.
*/
typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen);
/**
* xmlCharEncodingOutputFunc:
* @out: a pointer to an array of bytes to store the result
* @outlen: the length of @out
* @in: a pointer to an array of UTF-8 chars
* @inlen: the length of @in
*
* Take a block of UTF-8 chars in and try to convert it to another
* encoding.
* Note: a first call designed to produce heading info is called with
* in = NULL. If stateful this should also initialize the encoder state.
*
* Returns the number of bytes written, -1 if lack of space, or -2
* if the transcoding failed.
* The value of @inlen after return is the number of octets consumed
* if the return value is positive, else unpredictiable.
* The value of @outlen after return is the number of octets produced.
*/
typedef int (* xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen);
/*
* Block defining the handlers for non UTF-8 encodings.
* If iconv is supported, there are two extra fields.
*/
#ifdef LIBXML_ICU_ENABLED
/* Size of pivot buffer, same as icu/source/common/ucnv.cpp CHUNK_SIZE */
#define ICU_PIVOT_BUF_SIZE 1024
struct _uconv_t {
UConverter *uconv; /* for conversion between an encoding and UTF-16 */
UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
UChar pivot_buf[ICU_PIVOT_BUF_SIZE];
UChar *pivot_source;
UChar *pivot_target;
};
typedef struct _uconv_t uconv_t;
#endif
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
struct _xmlCharEncodingHandler {
char *name;
xmlCharEncodingInputFunc input;
xmlCharEncodingOutputFunc output;
#ifdef LIBXML_ICONV_ENABLED
iconv_t iconv_in;
iconv_t iconv_out;
#endif /* LIBXML_ICONV_ENABLED */
#ifdef LIBXML_ICU_ENABLED
uconv_t *uconv_in;
uconv_t *uconv_out;
#endif /* LIBXML_ICU_ENABLED */
};
#ifdef __cplusplus
}
#endif
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Interfaces for encoding handlers.
*/
XMLPUBFUN void XMLCALL
xmlInitCharEncodingHandlers (void);
XMLPUBFUN void XMLCALL
xmlCleanupCharEncodingHandlers (void);
XMLPUBFUN void XMLCALL
xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlGetCharEncodingHandler (xmlCharEncoding enc);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlFindCharEncodingHandler (const char *name);
XMLPUBFUN xmlCharEncodingHandlerPtr XMLCALL
xmlNewCharEncodingHandler (const char *name,
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output);
/*
* Interfaces for encoding names and aliases.
*/
XMLPUBFUN int XMLCALL
xmlAddEncodingAlias (const char *name,
const char *alias);
XMLPUBFUN int XMLCALL
xmlDelEncodingAlias (const char *alias);
XMLPUBFUN const char * XMLCALL
xmlGetEncodingAlias (const char *alias);
XMLPUBFUN void XMLCALL
xmlCleanupEncodingAliases (void);
XMLPUBFUN xmlCharEncoding XMLCALL
xmlParseCharEncoding (const char *name);
XMLPUBFUN const char * XMLCALL
xmlGetCharEncodingName (xmlCharEncoding enc);
/*
* Interfaces directly used by the parsers.
*/
XMLPUBFUN xmlCharEncoding XMLCALL
xmlDetectCharEncoding (const unsigned char *in,
int len);
XMLPUBFUN int XMLCALL
xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncInFunc (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
xmlBufferPtr out,
xmlBufferPtr in);
XMLPUBFUN int XMLCALL
xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
/*
* Export a few useful functions
*/
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
UTF8Toisolat1 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
isolat1ToUTF8 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#ifdef __cplusplus
}
#endif
#endif /* __XML_CHAR_ENCODING_H__ */

View File

@ -0,0 +1,151 @@
/*
* Summary: interface for the XML entities handling
* Description: this module provides some of the entity API needed
* for the parser and applications.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_ENTITIES_H__
#define __XML_ENTITIES_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The different valid entity types.
*/
typedef enum {
XML_INTERNAL_GENERAL_ENTITY = 1,
XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
XML_INTERNAL_PARAMETER_ENTITY = 4,
XML_EXTERNAL_PARAMETER_ENTITY = 5,
XML_INTERNAL_PREDEFINED_ENTITY = 6
} xmlEntityType;
/*
* An unit of storage for an entity, contains the string, the value
* and the linkind data needed for the linking in the hash table.
*/
struct _xmlEntity {
void *_private; /* application data */
xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
const xmlChar *name; /* Entity name */
struct _xmlNode *children; /* First child link */
struct _xmlNode *last; /* Last child link */
struct _xmlDtd *parent; /* -> DTD */
struct _xmlNode *next; /* next sibling link */
struct _xmlNode *prev; /* previous sibling link */
struct _xmlDoc *doc; /* the containing document */
xmlChar *orig; /* content without ref substitution */
xmlChar *content; /* content or ndata if unparsed */
int length; /* the content length */
xmlEntityType etype; /* The entity type */
const xmlChar *ExternalID; /* External identifier for PUBLIC */
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
struct _xmlEntity *nexte; /* unused */
const xmlChar *URI; /* the full URI as computed */
int owner; /* does the entity own the childrens */
int checked; /* was the entity content checked */
/* this is also used to count entities
* references done from that entity
* and if it contains '<' */
};
/*
* All entities are stored in an hash table.
* There is 2 separate hash tables for global and parameter entities.
*/
typedef struct _xmlHashTable xmlEntitiesTable;
typedef xmlEntitiesTable *xmlEntitiesTablePtr;
/*
* External functions:
*/
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN void XMLCALL
xmlInitializePredefinedEntities (void);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlEntityPtr XMLCALL
xmlNewEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlAddDocEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlAddDtdEntity (xmlDocPtr doc,
const xmlChar *name,
int type,
const xmlChar *ExternalID,
const xmlChar *SystemID,
const xmlChar *content);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetPredefinedEntity (const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetDocEntity (const xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetDtdEntity (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlGetParameterEntity (xmlDocPtr doc,
const xmlChar *name);
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN const xmlChar * XMLCALL
xmlEncodeEntities (xmlDocPtr doc,
const xmlChar *input);
#endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN xmlChar * XMLCALL
xmlEncodeEntitiesReentrant(xmlDocPtr doc,
const xmlChar *input);
XMLPUBFUN xmlChar * XMLCALL
xmlEncodeSpecialChars (const xmlDoc *doc,
const xmlChar *input);
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
xmlCreateEntitiesTable (void);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlEntitiesTablePtr XMLCALL
xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpEntitiesTable (xmlBufferPtr buf,
xmlEntitiesTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpEntityDecl (xmlBufferPtr buf,
xmlEntityPtr ent);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_LEGACY_ENABLED
XMLPUBFUN void XMLCALL
xmlCleanupPredefinedEntities(void);
#endif /* LIBXML_LEGACY_ENABLED */
#ifdef __cplusplus
}
#endif
# endif /* __XML_ENTITIES_H__ */

View File

@ -0,0 +1,508 @@
/*
* Summary: interface for all global variables of the library
* Description: all the global variables and thread handling for
* those variables is handled by this module.
*
* The bottom of this file is automatically generated by build_glob.py
* based on the description file global.data
*
* Copy: See Copyright for the status of this software.
*
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>, Daniel Veillard
*/
#ifndef __XML_GLOBALS_H
#define __XML_GLOBALS_H
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/SAX2.h>
#include <libxml/xmlmemory.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL xmlInitGlobals(void);
XMLPUBFUN void XMLCALL xmlCleanupGlobals(void);
/**
* xmlParserInputBufferCreateFilenameFunc:
* @URI: the URI to read from
* @enc: the requested source encoding
*
* Signature for the function doing the lookup for a suitable input method
* corresponding to an URI.
*
* Returns the new xmlParserInputBufferPtr in case of success or NULL if no
* method was found.
*/
typedef xmlParserInputBufferPtr (*xmlParserInputBufferCreateFilenameFunc) (const char *URI,
xmlCharEncoding enc);
/**
* xmlOutputBufferCreateFilenameFunc:
* @URI: the URI to write to
* @enc: the requested target encoding
*
* Signature for the function doing the lookup for a suitable output method
* corresponding to an URI.
*
* Returns the new xmlOutputBufferPtr in case of success or NULL if no
* method was found.
*/
typedef xmlOutputBufferPtr (*xmlOutputBufferCreateFilenameFunc) (const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
XMLCALL xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
XMLCALL xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
/*
* Externally global symbols which need to be protected for backwards
* compatibility support.
*/
#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
#undef xmlDefaultBufferSize
#undef xmlDefaultSAXHandler
#undef xmlDefaultSAXLocator
#undef xmlDoValidityCheckingDefaultValue
#undef xmlFree
#undef xmlGenericError
#undef xmlStructuredError
#undef xmlGenericErrorContext
#undef xmlStructuredErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlTreeIndentString
#undef xmlKeepBlanksDefaultValue
#undef xmlLineNumbersDefaultValue
#undef xmlLoadExtDtdDefaultValue
#undef xmlMalloc
#undef xmlMallocAtomic
#undef xmlMemStrdup
#undef xmlParserDebugEntities
#undef xmlParserVersion
#undef xmlPedanticParserDefaultValue
#undef xmlRealloc
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
#undef xmlLastError
#undef xmlParserInputBufferCreateFilenameValue
#undef xmlOutputBufferCreateFilenameValue
/**
* xmlRegisterNodeFunc:
* @node: the current node
*
* Signature for the registration callback of a created node
*/
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
/**
* xmlDeregisterNodeFunc:
* @node: the current node
*
* Signature for the deregistration callback of a discarded node
*/
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr;
struct _xmlGlobalState
{
const char *xmlParserVersion;
xmlSAXLocator xmlDefaultSAXLocator;
xmlSAXHandlerV1 xmlDefaultSAXHandler;
xmlSAXHandlerV1 docbDefaultSAXHandler;
xmlSAXHandlerV1 htmlDefaultSAXHandler;
xmlFreeFunc xmlFree;
xmlMallocFunc xmlMalloc;
xmlStrdupFunc xmlMemStrdup;
xmlReallocFunc xmlRealloc;
xmlGenericErrorFunc xmlGenericError;
xmlStructuredErrorFunc xmlStructuredError;
void *xmlGenericErrorContext;
int oldXMLWDcompatibility;
xmlBufferAllocationScheme xmlBufferAllocScheme;
int xmlDefaultBufferSize;
int xmlSubstituteEntitiesDefaultValue;
int xmlDoValidityCheckingDefaultValue;
int xmlGetWarningsDefaultValue;
int xmlKeepBlanksDefaultValue;
int xmlLineNumbersDefaultValue;
int xmlLoadExtDtdDefaultValue;
int xmlParserDebugEntities;
int xmlPedanticParserDefaultValue;
int xmlSaveNoEmptyTags;
int xmlIndentTreeOutput;
const char *xmlTreeIndentString;
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
xmlMallocFunc xmlMallocAtomic;
xmlError xmlLastError;
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
void *xmlStructuredErrorContext;
};
#ifdef __cplusplus
}
#endif
#include <libxml/threads.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL xmlInitializeGlobalState(xmlGlobalStatePtr gs);
XMLPUBFUN void XMLCALL xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler);
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlRegisterNodeFunc XMLCALL xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlDeregisterNodeFunc XMLCALL xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLCALL
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func);
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLCALL
xmlThrDefParserInputBufferCreateFilenameDefault(
xmlParserInputBufferCreateFilenameFunc func);
/** DOC_DISABLE */
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
* - xmlMalloc
* - xmlMallocAtomic
* - xmlRealloc
* - xmlMemStrdup
* - xmlFree
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMalloc(void);
#define xmlMalloc \
(*(__xmlMalloc()))
#else
XMLPUBVAR xmlMallocFunc xmlMalloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlMallocFunc * XMLCALL __xmlMallocAtomic(void);
#define xmlMallocAtomic \
(*(__xmlMallocAtomic()))
#else
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlReallocFunc * XMLCALL __xmlRealloc(void);
#define xmlRealloc \
(*(__xmlRealloc()))
#else
XMLPUBVAR xmlReallocFunc xmlRealloc;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlFreeFunc * XMLCALL __xmlFree(void);
#define xmlFree \
(*(__xmlFree()))
#else
XMLPUBVAR xmlFreeFunc xmlFree;
#endif
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN xmlStrdupFunc * XMLCALL __xmlMemStrdup(void);
#define xmlMemStrdup \
(*(__xmlMemStrdup()))
#else
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif
#else /* !LIBXML_THREAD_ALLOC_ENABLED */
XMLPUBVAR xmlMallocFunc xmlMalloc;
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
XMLPUBVAR xmlReallocFunc xmlRealloc;
XMLPUBVAR xmlFreeFunc xmlFree;
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif /* LIBXML_THREAD_ALLOC_ENABLED */
#ifdef LIBXML_DOCB_ENABLED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __docbDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define docbDefaultSAXHandler \
(*(__docbDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 docbDefaultSAXHandler;
#endif
#endif
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __htmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define htmlDefaultSAXHandler \
(*(__htmlDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif
#endif
XMLPUBFUN xmlError * XMLCALL __xmlLastError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLastError \
(*(__xmlLastError()))
#else
XMLPUBVAR xmlError xmlLastError;
#endif
/*
* Everything starting from the line below is
* Automatically generated by build_glob.py.
* Do not modify the previous line.
*/
XMLPUBFUN int * XMLCALL __oldXMLWDcompatibility(void);
#ifdef LIBXML_THREAD_ENABLED
#define oldXMLWDcompatibility \
(*(__oldXMLWDcompatibility()))
#else
XMLPUBVAR int oldXMLWDcompatibility;
#endif
XMLPUBFUN xmlBufferAllocationScheme * XMLCALL __xmlBufferAllocScheme(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlBufferAllocScheme \
(*(__xmlBufferAllocScheme()))
#else
XMLPUBVAR xmlBufferAllocationScheme xmlBufferAllocScheme;
#endif
XMLPUBFUN xmlBufferAllocationScheme XMLCALL
xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v);
XMLPUBFUN int * XMLCALL __xmlDefaultBufferSize(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultBufferSize \
(*(__xmlDefaultBufferSize()))
#else
XMLPUBVAR int xmlDefaultBufferSize;
#endif
XMLPUBFUN int XMLCALL xmlThrDefDefaultBufferSize(int v);
XMLPUBFUN xmlSAXHandlerV1 * XMLCALL __xmlDefaultSAXHandler(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXHandler \
(*(__xmlDefaultSAXHandler()))
#else
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler;
#endif
XMLPUBFUN xmlSAXLocator * XMLCALL __xmlDefaultSAXLocator(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDefaultSAXLocator \
(*(__xmlDefaultSAXLocator()))
#else
XMLPUBVAR xmlSAXLocator xmlDefaultSAXLocator;
#endif
XMLPUBFUN int * XMLCALL __xmlDoValidityCheckingDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDoValidityCheckingDefaultValue \
(*(__xmlDoValidityCheckingDefaultValue()))
#else
XMLPUBVAR int xmlDoValidityCheckingDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefDoValidityCheckingDefaultValue(int v);
XMLPUBFUN xmlGenericErrorFunc * XMLCALL __xmlGenericError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericError \
(*(__xmlGenericError()))
#else
XMLPUBVAR xmlGenericErrorFunc xmlGenericError;
#endif
XMLPUBFUN xmlStructuredErrorFunc * XMLCALL __xmlStructuredError(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredError \
(*(__xmlStructuredError()))
#else
XMLPUBVAR xmlStructuredErrorFunc xmlStructuredError;
#endif
XMLPUBFUN void * * XMLCALL __xmlGenericErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGenericErrorContext \
(*(__xmlGenericErrorContext()))
#else
XMLPUBVAR void * xmlGenericErrorContext;
#endif
XMLPUBFUN void * * XMLCALL __xmlStructuredErrorContext(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlStructuredErrorContext \
(*(__xmlStructuredErrorContext()))
#else
XMLPUBVAR void * xmlStructuredErrorContext;
#endif
XMLPUBFUN int * XMLCALL __xmlGetWarningsDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlGetWarningsDefaultValue \
(*(__xmlGetWarningsDefaultValue()))
#else
XMLPUBVAR int xmlGetWarningsDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefGetWarningsDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlIndentTreeOutput(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlIndentTreeOutput \
(*(__xmlIndentTreeOutput()))
#else
XMLPUBVAR int xmlIndentTreeOutput;
#endif
XMLPUBFUN int XMLCALL xmlThrDefIndentTreeOutput(int v);
XMLPUBFUN const char * * XMLCALL __xmlTreeIndentString(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlTreeIndentString \
(*(__xmlTreeIndentString()))
#else
XMLPUBVAR const char * xmlTreeIndentString;
#endif
XMLPUBFUN const char * XMLCALL xmlThrDefTreeIndentString(const char * v);
XMLPUBFUN int * XMLCALL __xmlKeepBlanksDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlKeepBlanksDefaultValue \
(*(__xmlKeepBlanksDefaultValue()))
#else
XMLPUBVAR int xmlKeepBlanksDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefKeepBlanksDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLineNumbersDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLineNumbersDefaultValue \
(*(__xmlLineNumbersDefaultValue()))
#else
XMLPUBVAR int xmlLineNumbersDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefLineNumbersDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlLoadExtDtdDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlLoadExtDtdDefaultValue \
(*(__xmlLoadExtDtdDefaultValue()))
#else
XMLPUBVAR int xmlLoadExtDtdDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefLoadExtDtdDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlParserDebugEntities(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserDebugEntities \
(*(__xmlParserDebugEntities()))
#else
XMLPUBVAR int xmlParserDebugEntities;
#endif
XMLPUBFUN int XMLCALL xmlThrDefParserDebugEntities(int v);
XMLPUBFUN const char * * XMLCALL __xmlParserVersion(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserVersion \
(*(__xmlParserVersion()))
#else
XMLPUBVAR const char * xmlParserVersion;
#endif
XMLPUBFUN int * XMLCALL __xmlPedanticParserDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlPedanticParserDefaultValue \
(*(__xmlPedanticParserDefaultValue()))
#else
XMLPUBVAR int xmlPedanticParserDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefPedanticParserDefaultValue(int v);
XMLPUBFUN int * XMLCALL __xmlSaveNoEmptyTags(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSaveNoEmptyTags \
(*(__xmlSaveNoEmptyTags()))
#else
XMLPUBVAR int xmlSaveNoEmptyTags;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSaveNoEmptyTags(int v);
XMLPUBFUN int * XMLCALL __xmlSubstituteEntitiesDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlSubstituteEntitiesDefaultValue \
(*(__xmlSubstituteEntitiesDefaultValue()))
#else
XMLPUBVAR int xmlSubstituteEntitiesDefaultValue;
#endif
XMLPUBFUN int XMLCALL xmlThrDefSubstituteEntitiesDefaultValue(int v);
XMLPUBFUN xmlRegisterNodeFunc * XMLCALL __xmlRegisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlRegisterNodeDefaultValue \
(*(__xmlRegisterNodeDefaultValue()))
#else
XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue;
#endif
XMLPUBFUN xmlDeregisterNodeFunc * XMLCALL __xmlDeregisterNodeDefaultValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlDeregisterNodeDefaultValue \
(*(__xmlDeregisterNodeDefaultValue()))
#else
XMLPUBVAR xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue;
#endif
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc * XMLCALL \
__xmlParserInputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlParserInputBufferCreateFilenameValue \
(*(__xmlParserInputBufferCreateFilenameValue()))
#else
XMLPUBVAR xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue;
#endif
XMLPUBFUN xmlOutputBufferCreateFilenameFunc * XMLCALL __xmlOutputBufferCreateFilenameValue(void);
#ifdef LIBXML_THREAD_ENABLED
#define xmlOutputBufferCreateFilenameValue \
(*(__xmlOutputBufferCreateFilenameValue()))
#else
XMLPUBVAR xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue;
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_GLOBALS_H */

View File

@ -0,0 +1,236 @@
/*
* Summary: Chained hash tables
* Description: This module implements the hash table support used in
* various places in the library.
*
* Copy: See Copyright for the status of this software.
*
* Author: Bjorn Reese <bjorn.reese@systematic.dk>
*/
#ifndef __XML_HASH_H__
#define __XML_HASH_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* The hash table.
*/
typedef struct _xmlHashTable xmlHashTable;
typedef xmlHashTable *xmlHashTablePtr;
#ifdef __cplusplus
}
#endif
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Recent version of gcc produce a warning when a function pointer is assigned
* to an object pointer, or vice versa. The following macro is a dirty hack
* to allow suppression of the warning. If your architecture has function
* pointers which are a different size than a void pointer, there may be some
* serious trouble within the library.
*/
/**
* XML_CAST_FPTR:
* @fptr: pointer to a function
*
* Macro to do a casting from an object pointer to a
* function pointer without encountering a warning from
* gcc
*
* #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
* This macro violated ISO C aliasing rules (gcc4 on s390 broke)
* so it is disabled now
*/
#define XML_CAST_FPTR(fptr) fptr
/*
* function types:
*/
/**
* xmlHashDeallocator:
* @payload: the data in the hash
* @name: the name associated
*
* Callback to free data from a hash.
*/
typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
/**
* xmlHashCopier:
* @payload: the data in the hash
* @name: the name associated
*
* Callback to copy data from a hash.
*
* Returns a copy of the data or NULL in case of error.
*/
typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name);
/**
* xmlHashScanner:
* @payload: the data in the hash
* @data: extra scannner data
* @name: the name associated
*
* Callback when scanning data in a hash with the simple scanner.
*/
typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name);
/**
* xmlHashScannerFull:
* @payload: the data in the hash
* @data: extra scannner data
* @name: the name associated
* @name2: the second name associated
* @name3: the third name associated
*
* Callback when scanning data in a hash with the full scanner.
*/
typedef void (*xmlHashScannerFull)(void *payload, void *data,
const xmlChar *name, const xmlChar *name2,
const xmlChar *name3);
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCreate (int size);
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCreateDict(int size,
xmlDictPtr dict);
XMLPUBFUN void XMLCALL
xmlHashFree (xmlHashTablePtr table,
xmlHashDeallocator f);
XMLPUBFUN void XMLCALL
xmlHashDefaultDeallocator(void *entry,
const xmlChar *name);
/*
* Add a new entry to the hash table.
*/
XMLPUBFUN int XMLCALL
xmlHashAddEntry (xmlHashTablePtr table,
const xmlChar *name,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry(xmlHashTablePtr table,
const xmlChar *name,
void *userdata,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashAddEntry2(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry2(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
void *userdata,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashAddEntry3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata);
XMLPUBFUN int XMLCALL
xmlHashUpdateEntry3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata,
xmlHashDeallocator f);
/*
* Remove an entry from the hash table.
*/
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, xmlHashDeallocator f);
XMLPUBFUN int XMLCALL
xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3,
xmlHashDeallocator f);
/*
* Retrieve the userdata.
*/
XMLPUBFUN void * XMLCALL
xmlHashLookup (xmlHashTablePtr table,
const xmlChar *name);
XMLPUBFUN void * XMLCALL
xmlHashLookup2 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2);
XMLPUBFUN void * XMLCALL
xmlHashLookup3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3);
XMLPUBFUN void * XMLCALL
xmlHashQLookup (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN void * XMLCALL
xmlHashQLookup2 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix,
const xmlChar *name2,
const xmlChar *prefix2);
XMLPUBFUN void * XMLCALL
xmlHashQLookup3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *prefix,
const xmlChar *name2,
const xmlChar *prefix2,
const xmlChar *name3,
const xmlChar *prefix3);
/*
* Helpers.
*/
XMLPUBFUN xmlHashTablePtr XMLCALL
xmlHashCopy (xmlHashTablePtr table,
xmlHashCopier f);
XMLPUBFUN int XMLCALL
xmlHashSize (xmlHashTablePtr table);
XMLPUBFUN void XMLCALL
xmlHashScan (xmlHashTablePtr table,
xmlHashScanner f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScan3 (xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScanner f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScanFull (xmlHashTablePtr table,
xmlHashScannerFull f,
void *data);
XMLPUBFUN void XMLCALL
xmlHashScanFull3(xmlHashTablePtr table,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScannerFull f,
void *data);
#ifdef __cplusplus
}
#endif
#endif /* ! __XML_HASH_H__ */

View File

@ -0,0 +1,137 @@
/*
* Summary: lists interfaces
* Description: this module implement the list support used in
* various place in the library.
*
* Copy: See Copyright for the status of this software.
*
* Author: Gary Pennington <Gary.Pennington@uk.sun.com>
*/
#ifndef __XML_LINK_INCLUDE__
#define __XML_LINK_INCLUDE__
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlLink xmlLink;
typedef xmlLink *xmlLinkPtr;
typedef struct _xmlList xmlList;
typedef xmlList *xmlListPtr;
/**
* xmlListDeallocator:
* @lk: the data to deallocate
*
* Callback function used to free data from a list.
*/
typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
/**
* xmlListDataCompare:
* @data0: the first data
* @data1: the second data
*
* Callback function used to compare 2 data.
*
* Returns 0 is equality, -1 or 1 otherwise depending on the ordering.
*/
typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
/**
* xmlListWalker:
* @data: the data found in the list
* @user: extra user provided data to the walker
*
* Callback function used when walking a list with xmlListWalk().
*
* Returns 0 to stop walking the list, 1 otherwise.
*/
typedef int (*xmlListWalker) (const void *data, void *user);
/* Creation/Deletion */
XMLPUBFUN xmlListPtr XMLCALL
xmlListCreate (xmlListDeallocator deallocator,
xmlListDataCompare compare);
XMLPUBFUN void XMLCALL
xmlListDelete (xmlListPtr l);
/* Basic Operators */
XMLPUBFUN void * XMLCALL
xmlListSearch (xmlListPtr l,
void *data);
XMLPUBFUN void * XMLCALL
xmlListReverseSearch (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListInsert (xmlListPtr l,
void *data) ;
XMLPUBFUN int XMLCALL
xmlListAppend (xmlListPtr l,
void *data) ;
XMLPUBFUN int XMLCALL
xmlListRemoveFirst (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListRemoveLast (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListRemoveAll (xmlListPtr l,
void *data);
XMLPUBFUN void XMLCALL
xmlListClear (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListEmpty (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL
xmlListFront (xmlListPtr l);
XMLPUBFUN xmlLinkPtr XMLCALL
xmlListEnd (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListSize (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListPopFront (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListPopBack (xmlListPtr l);
XMLPUBFUN int XMLCALL
xmlListPushFront (xmlListPtr l,
void *data);
XMLPUBFUN int XMLCALL
xmlListPushBack (xmlListPtr l,
void *data);
/* Advanced Operators */
XMLPUBFUN void XMLCALL
xmlListReverse (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListSort (xmlListPtr l);
XMLPUBFUN void XMLCALL
xmlListWalk (xmlListPtr l,
xmlListWalker walker,
void *user);
XMLPUBFUN void XMLCALL
xmlListReverseWalk (xmlListPtr l,
xmlListWalker walker,
void *user);
XMLPUBFUN void XMLCALL
xmlListMerge (xmlListPtr l1,
xmlListPtr l2);
XMLPUBFUN xmlListPtr XMLCALL
xmlListDup (const xmlListPtr old);
XMLPUBFUN int XMLCALL
xmlListCopy (xmlListPtr cur,
const xmlListPtr old);
/* Link operators */
XMLPUBFUN void * XMLCALL
xmlLinkGetData (xmlLinkPtr lk);
/* xmlListUnique() */
/* xmlListSwap */
#ifdef __cplusplus
}
#endif
#endif /* __XML_LINK_INCLUDE__ */

View File

@ -0,0 +1,163 @@
/*
* Summary: minimal FTP implementation
* Description: minimal FTP implementation allowing to fetch resources
* like external subset.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __NANO_FTP_H__
#define __NANO_FTP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_FTP_ENABLED
/* Needed for portability to Windows 64 bits */
#if defined(_WIN32) && !defined(__CYGWIN__)
#include <winsock2.h>
#else
/**
* SOCKET:
*
* macro used to provide portability of code to windows sockets
*/
#define SOCKET int
/**
* INVALID_SOCKET:
*
* macro used to provide portability of code to windows sockets
* the value to be used when the socket is not valid
*/
#undef INVALID_SOCKET
#define INVALID_SOCKET (-1)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* ftpListCallback:
* @userData: user provided data for the callback
* @filename: the file name (including "->" when links are shown)
* @attrib: the attribute string
* @owner: the owner string
* @group: the group string
* @size: the file size
* @links: the link count
* @year: the year
* @month: the month
* @day: the day
* @hour: the hour
* @minute: the minute
*
* A callback for the xmlNanoFTPList command.
* Note that only one of year and day:minute are specified.
*/
typedef void (*ftpListCallback) (void *userData,
const char *filename, const char *attrib,
const char *owner, const char *group,
unsigned long size, int links, int year,
const char *month, int day, int hour,
int minute);
/**
* ftpDataCallback:
* @userData: the user provided context
* @data: the data received
* @len: its size in bytes
*
* A callback for the xmlNanoFTPGet command.
*/
typedef void (*ftpDataCallback) (void *userData,
const char *data,
int len);
/*
* Init
*/
XMLPUBFUN void XMLCALL
xmlNanoFTPInit (void);
XMLPUBFUN void XMLCALL
xmlNanoFTPCleanup (void);
/*
* Creating/freeing contexts.
*/
XMLPUBFUN void * XMLCALL
xmlNanoFTPNewCtxt (const char *URL);
XMLPUBFUN void XMLCALL
xmlNanoFTPFreeCtxt (void * ctx);
XMLPUBFUN void * XMLCALL
xmlNanoFTPConnectTo (const char *server,
int port);
/*
* Opening/closing session connections.
*/
XMLPUBFUN void * XMLCALL
xmlNanoFTPOpen (const char *URL);
XMLPUBFUN int XMLCALL
xmlNanoFTPConnect (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPClose (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPQuit (void *ctx);
XMLPUBFUN void XMLCALL
xmlNanoFTPScanProxy (const char *URL);
XMLPUBFUN void XMLCALL
xmlNanoFTPProxy (const char *host,
int port,
const char *user,
const char *passwd,
int type);
XMLPUBFUN int XMLCALL
xmlNanoFTPUpdateURL (void *ctx,
const char *URL);
/*
* Rather internal commands.
*/
XMLPUBFUN int XMLCALL
xmlNanoFTPGetResponse (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPCheckResponse (void *ctx);
/*
* CD/DIR/GET handlers.
*/
XMLPUBFUN int XMLCALL
xmlNanoFTPCwd (void *ctx,
const char *directory);
XMLPUBFUN int XMLCALL
xmlNanoFTPDele (void *ctx,
const char *file);
XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetConnection (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPCloseConnection(void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoFTPList (void *ctx,
ftpListCallback callback,
void *userData,
const char *filename);
XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetSocket (void *ctx,
const char *filename);
XMLPUBFUN int XMLCALL
xmlNanoFTPGet (void *ctx,
ftpDataCallback callback,
void *userData,
const char *filename);
XMLPUBFUN int XMLCALL
xmlNanoFTPRead (void *ctx,
void *dest,
int len);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_FTP_ENABLED */
#endif /* __NANO_FTP_H__ */

View File

@ -0,0 +1,81 @@
/*
* Summary: minimal HTTP implementation
* Description: minimal HTTP implementation allowing to fetch resources
* like external subset.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __NANO_HTTP_H__
#define __NANO_HTTP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_HTTP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void XMLCALL
xmlNanoHTTPInit (void);
XMLPUBFUN void XMLCALL
xmlNanoHTTPCleanup (void);
XMLPUBFUN void XMLCALL
xmlNanoHTTPScanProxy (const char *URL);
XMLPUBFUN int XMLCALL
xmlNanoHTTPFetch (const char *URL,
const char *filename,
char **contentType);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPMethod (const char *URL,
const char *method,
const char *input,
char **contentType,
const char *headers,
int ilen);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPMethodRedir (const char *URL,
const char *method,
const char *input,
char **contentType,
char **redir,
const char *headers,
int ilen);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPOpen (const char *URL,
char **contentType);
XMLPUBFUN void * XMLCALL
xmlNanoHTTPOpenRedir (const char *URL,
char **contentType,
char **redir);
XMLPUBFUN int XMLCALL
xmlNanoHTTPReturnCode (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPAuthHeader (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPRedir (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoHTTPContentLength( void * ctx );
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPEncoding (void *ctx);
XMLPUBFUN const char * XMLCALL
xmlNanoHTTPMimeType (void *ctx);
XMLPUBFUN int XMLCALL
xmlNanoHTTPRead (void *ctx,
void *dest,
int len);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int XMLCALL
xmlNanoHTTPSave (void *ctxt,
const char *filename);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN void XMLCALL
xmlNanoHTTPClose (void *ctx);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTTP_ENABLED */
#endif /* __NANO_HTTP_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,644 @@
/*
* Summary: internals routines and limits exported by the parser.
* Description: this module exports a number of internal parsing routines
* they are not really all intended for applications but
* can prove useful doing low level processing.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_PARSER_INTERNALS_H__
#define __XML_PARSER_INTERNALS_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/HTMLparser.h>
#include <libxml/chvalid.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlParserMaxDepth:
*
* arbitrary depth limit for the XML documents that we allow to
* process. This is not a limitation of the parser but a safety
* boundary feature, use XML_PARSE_HUGE option to override it.
*/
XMLPUBVAR unsigned int xmlParserMaxDepth;
/**
* XML_MAX_TEXT_LENGTH:
*
* Maximum size allowed for a single text node when building a tree.
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Introduced in 2.9.0
*/
#define XML_MAX_TEXT_LENGTH 10000000
/**
* XML_MAX_NAME_LENGTH:
*
* Maximum size allowed for a markup identitier
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Note that with the use of parsing dictionaries overriding the limit
* may result in more runtime memory usage in face of "unfriendly' content
* Introduced in 2.9.0
*/
#define XML_MAX_NAME_LENGTH 50000
/**
* XML_MAX_DICTIONARY_LIMIT:
*
* Maximum size allowed by the parser for a dictionary by default
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Introduced in 2.9.0
*/
#define XML_MAX_DICTIONARY_LIMIT 10000000
/**
* XML_MAX_LOOKUP_LIMIT:
*
* Maximum size allowed by the parser for ahead lookup
* This is an upper boundary enforced by the parser to avoid bad
* behaviour on "unfriendly' content
* Introduced in 2.9.0
*/
#define XML_MAX_LOOKUP_LIMIT 10000000
/**
* XML_MAX_NAMELEN:
*
* Identifiers can be longer, but this will be more costly
* at runtime.
*/
#define XML_MAX_NAMELEN 100
/**
* INPUT_CHUNK:
*
* The parser tries to always have that amount of input ready.
* One of the point is providing context when reporting errors.
*/
#define INPUT_CHUNK 250
/************************************************************************
* *
* UNICODE version of the macros. *
* *
************************************************************************/
/**
* IS_BYTE_CHAR:
* @c: an byte value (int)
*
* Macro to check the following production in the XML spec:
*
* [2] Char ::= #x9 | #xA | #xD | [#x20...]
* any byte character in the accepted range
*/
#define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
/**
* IS_CHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
* | [#x10000-#x10FFFF]
* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
*/
#define IS_CHAR(c) xmlIsCharQ(c)
/**
* IS_CHAR_CH:
* @c: an xmlChar (usually an unsigned char)
*
* Behaves like IS_CHAR on single-byte value
*/
#define IS_CHAR_CH(c) xmlIsChar_ch(c)
/**
* IS_BLANK:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [3] S ::= (#x20 | #x9 | #xD | #xA)+
*/
#define IS_BLANK(c) xmlIsBlankQ(c)
/**
* IS_BLANK_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Behaviour same as IS_BLANK
*/
#define IS_BLANK_CH(c) xmlIsBlank_ch(c)
/**
* IS_BASECHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [85] BaseChar ::= ... long list see REC ...
*/
#define IS_BASECHAR(c) xmlIsBaseCharQ(c)
/**
* IS_DIGIT:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [88] Digit ::= ... long list see REC ...
*/
#define IS_DIGIT(c) xmlIsDigitQ(c)
/**
* IS_DIGIT_CH:
* @c: an xmlChar value (usually an unsigned char)
*
* Behaves like IS_DIGIT but with a single byte argument
*/
#define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
/**
* IS_COMBINING:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
* [87] CombiningChar ::= ... long list see REC ...
*/
#define IS_COMBINING(c) xmlIsCombiningQ(c)
/**
* IS_COMBINING_CH:
* @c: an xmlChar (usually an unsigned char)
*
* Always false (all combining chars > 0xff)
*/
#define IS_COMBINING_CH(c) 0
/**
* IS_EXTENDER:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
* #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
* [#x309D-#x309E] | [#x30FC-#x30FE]
*/
#define IS_EXTENDER(c) xmlIsExtenderQ(c)
/**
* IS_EXTENDER_CH:
* @c: an xmlChar value (usually an unsigned char)
*
* Behaves like IS_EXTENDER but with a single-byte argument
*/
#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
/**
* IS_IDEOGRAPHIC:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
*/
#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
/**
* IS_LETTER:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [84] Letter ::= BaseChar | Ideographic
*/
#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
/**
* IS_LETTER_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Macro behaves like IS_LETTER, but only check base chars
*
*/
#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
/**
* IS_ASCII_LETTER:
* @c: an xmlChar value
*
* Macro to check [a-zA-Z]
*
*/
#define IS_ASCII_LETTER(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a)))
/**
* IS_ASCII_DIGIT:
* @c: an xmlChar value
*
* Macro to check [0-9]
*
*/
#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
/**
* IS_PUBIDCHAR:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
*/
#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
/**
* IS_PUBIDCHAR_CH:
* @c: an xmlChar value (normally unsigned char)
*
* Same as IS_PUBIDCHAR but for single-byte value
*/
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
/**
* SKIP_EOL:
* @p: and UTF8 string pointer
*
* Skips the end of line chars.
*/
#define SKIP_EOL(p) \
if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
/**
* MOVETO_ENDTAG:
* @p: and UTF8 string pointer
*
* Skips to the next '>' char.
*/
#define MOVETO_ENDTAG(p) \
while ((*p) && (*(p) != '>')) (p)++
/**
* MOVETO_STARTTAG:
* @p: and UTF8 string pointer
*
* Skips to the next '<' char.
*/
#define MOVETO_STARTTAG(p) \
while ((*p) && (*(p) != '<')) (p)++
/**
* Global variables used for predefined strings.
*/
XMLPUBVAR const xmlChar xmlStringText[];
XMLPUBVAR const xmlChar xmlStringTextNoenc[];
XMLPUBVAR const xmlChar xmlStringComment[];
/*
* Function to finish the work of the macros where needed.
*/
XMLPUBFUN int XMLCALL xmlIsLetter (int c);
/**
* Parser context.
*/
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateFileParserCtxt (const char *filename);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateURLParserCtxt (const char *filename,
int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlCreateEntityParserCtxt(const xmlChar *URL,
const xmlChar *ID,
const xmlChar *base);
XMLPUBFUN int XMLCALL
xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
xmlCharEncodingHandlerPtr handler);
XMLPUBFUN int XMLCALL
xmlSwitchInputEncoding (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input,
xmlCharEncodingHandlerPtr handler);
#ifdef IN_LIBXML
/* internal error reporting */
XMLPUBFUN void XMLCALL
__xmlErrEncoding (xmlParserCtxtPtr ctxt,
xmlParserErrors xmlerr,
const char *msg,
const xmlChar * str1,
const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0);
#endif
/**
* Input Streams.
*/
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewStringInputStream (xmlParserCtxtPtr ctxt,
const xmlChar *buffer);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
XMLPUBFUN int XMLCALL
xmlPushInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr input);
XMLPUBFUN xmlChar XMLCALL
xmlPopInput (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlFreeInputStream (xmlParserInputPtr input);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
const char *filename);
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNewInputStream (xmlParserCtxtPtr ctxt);
/**
* Namespaces.
*/
XMLPUBFUN xmlChar * XMLCALL
xmlSplitQName (xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlChar **prefix);
/**
* Generic production rules.
*/
XMLPUBFUN const xmlChar * XMLCALL
xmlParseName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseNmtoken (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseEntityValue (xmlParserCtxtPtr ctxt,
xmlChar **orig);
XMLPUBFUN xmlChar * XMLCALL
xmlParseAttValue (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseCharData (xmlParserCtxtPtr ctxt,
int cdata);
XMLPUBFUN xmlChar * XMLCALL
xmlParseExternalID (xmlParserCtxtPtr ctxt,
xmlChar **publicID,
int strict);
XMLPUBFUN void XMLCALL
xmlParseComment (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL
xmlParsePITarget (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParsePI (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
xmlChar **value);
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseNotationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
XMLPUBFUN int XMLCALL
xmlParseAttributeType (xmlParserCtxtPtr ctxt,
xmlEnumerationPtr *tree);
XMLPUBFUN void XMLCALL
xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementMixedContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlParseElementChildrenContentDecl
(xmlParserCtxtPtr ctxt,
int inputchk);
XMLPUBFUN int XMLCALL
xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
const xmlChar *name,
xmlElementContentPtr *result);
XMLPUBFUN int XMLCALL
xmlParseElementDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseCharRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlEntityPtr XMLCALL
xmlParseEntityRef (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParsePEReference (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
#ifdef LIBXML_SAX1_ENABLED
XMLPUBFUN const xmlChar * XMLCALL
xmlParseAttribute (xmlParserCtxtPtr ctxt,
xmlChar **value);
XMLPUBFUN const xmlChar * XMLCALL
xmlParseStartTag (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseEndTag (xmlParserCtxtPtr ctxt);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN void XMLCALL
xmlParseCDSect (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseContent (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseElement (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionNum (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlParseEncName (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL
xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlParseSDDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseTextDecl (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseMisc (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
const xmlChar *ExternalID,
const xmlChar *SystemID);
/**
* XML_SUBSTITUTE_NONE:
*
* If no entities need to be substituted.
*/
#define XML_SUBSTITUTE_NONE 0
/**
* XML_SUBSTITUTE_REF:
*
* Whether general entities need to be substituted.
*/
#define XML_SUBSTITUTE_REF 1
/**
* XML_SUBSTITUTE_PEREF:
*
* Whether parameter entities need to be substituted.
*/
#define XML_SUBSTITUTE_PEREF 2
/**
* XML_SUBSTITUTE_BOTH:
*
* Both general and parameter entities need to be substituted.
*/
#define XML_SUBSTITUTE_BOTH 3
XMLPUBFUN xmlChar * XMLCALL
xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
XMLPUBFUN xmlChar * XMLCALL
xmlStringLenDecodeEntities (xmlParserCtxtPtr ctxt,
const xmlChar *str,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
/*
* Generated by MACROS on top of parser.c c.f. PUSH_AND_POP.
*/
XMLPUBFUN int XMLCALL nodePush (xmlParserCtxtPtr ctxt,
xmlNodePtr value);
XMLPUBFUN xmlNodePtr XMLCALL nodePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL inputPush (xmlParserCtxtPtr ctxt,
xmlParserInputPtr value);
XMLPUBFUN xmlParserInputPtr XMLCALL inputPop (xmlParserCtxtPtr ctxt);
XMLPUBFUN const xmlChar * XMLCALL namePop (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL namePush (xmlParserCtxtPtr ctxt,
const xmlChar *value);
/*
* other commodities shared between parser.c and parserInternals.
*/
XMLPUBFUN int XMLCALL xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
const xmlChar *cur,
int *len);
XMLPUBFUN void XMLCALL xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN int XMLCALL xmlCheckLanguageID (const xmlChar *lang);
/*
* Really core function shared with HTML parser.
*/
XMLPUBFUN int XMLCALL xmlCurrentChar (xmlParserCtxtPtr ctxt,
int *len);
XMLPUBFUN int XMLCALL xmlCopyCharMultiByte (xmlChar *out,
int val);
XMLPUBFUN int XMLCALL xmlCopyChar (int len,
xmlChar *out,
int val);
XMLPUBFUN void XMLCALL xmlNextChar (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in);
#ifdef LIBXML_HTML_ENABLED
/*
* Actually comes from the HTML parser but launched from the init stuff.
*/
XMLPUBFUN void XMLCALL htmlInitAutoClose (void);
XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename,
const char *encoding);
#endif
/*
* Specific function to keep track of entities references
* and used by the XSLT debugger.
*/
#ifdef LIBXML_LEGACY_ENABLED
/**
* xmlEntityReferenceFunc:
* @ent: the entity
* @firstNode: the fist node in the chunk
* @lastNode: the last nod in the chunk
*
* Callback function used when one needs to be able to track back the
* provenance of a chunk of nodes inherited from an entity replacement.
*/
typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent,
xmlNodePtr firstNode,
xmlNodePtr lastNode);
XMLPUBFUN void XMLCALL xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func);
XMLPUBFUN xmlChar * XMLCALL
xmlParseQuotedString (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlParseNamespace (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlScanName (xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL xmlParserHandleReference(xmlParserCtxtPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
xmlChar **prefix);
/**
* Entities
*/
XMLPUBFUN xmlChar * XMLCALL
xmlDecodeEntities (xmlParserCtxtPtr ctxt,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
XMLPUBFUN void XMLCALL
xmlHandleEntity (xmlParserCtxtPtr ctxt,
xmlEntityPtr entity);
#endif /* LIBXML_LEGACY_ENABLED */
#ifdef IN_LIBXML
/*
* internal only
*/
XMLPUBFUN void XMLCALL
xmlErrMemory (xmlParserCtxtPtr ctxt,
const char *extra);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_PARSER_INTERNALS_H__ */

View File

@ -0,0 +1,100 @@
/*
* Summary: pattern expression handling
* Description: allows to compile and test pattern expressions for nodes
* either in a tree or based on a parser state.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_PATTERN_H__
#define __XML_PATTERN_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/dict.h>
#ifdef LIBXML_PATTERN_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlPattern:
*
* A compiled (XPath based) pattern to select nodes
*/
typedef struct _xmlPattern xmlPattern;
typedef xmlPattern *xmlPatternPtr;
/**
* xmlPatternFlags:
*
* This is the set of options affecting the behaviour of pattern
* matching with this module
*
*/
typedef enum {
XML_PATTERN_DEFAULT = 0, /* simple pattern match */
XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */
XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
} xmlPatternFlags;
XMLPUBFUN void XMLCALL
xmlFreePattern (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL
xmlFreePatternList (xmlPatternPtr comp);
XMLPUBFUN xmlPatternPtr XMLCALL
xmlPatterncompile (const xmlChar *pattern,
xmlDict *dict,
int flags,
const xmlChar **namespaces);
XMLPUBFUN int XMLCALL
xmlPatternMatch (xmlPatternPtr comp,
xmlNodePtr node);
/* streaming interfaces */
typedef struct _xmlStreamCtxt xmlStreamCtxt;
typedef xmlStreamCtxt *xmlStreamCtxtPtr;
XMLPUBFUN int XMLCALL
xmlPatternStreamable (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternMaxDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternMinDepth (xmlPatternPtr comp);
XMLPUBFUN int XMLCALL
xmlPatternFromRoot (xmlPatternPtr comp);
XMLPUBFUN xmlStreamCtxtPtr XMLCALL
xmlPatternGetStreamCtxt (xmlPatternPtr comp);
XMLPUBFUN void XMLCALL
xmlFreeStreamCtxt (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL
xmlStreamPushNode (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns,
int nodeType);
XMLPUBFUN int XMLCALL
xmlStreamPush (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlStreamPushAttr (xmlStreamCtxtPtr stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlStreamPop (xmlStreamCtxtPtr stream);
XMLPUBFUN int XMLCALL
xmlStreamWantsAnyNode (xmlStreamCtxtPtr stream);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_PATTERN_ENABLED */
#endif /* __XML_PATTERN_H__ */

View File

@ -0,0 +1,217 @@
/*
* Summary: implementation of the Relax-NG validation
* Description: implementation of the Relax-NG validation
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_RELAX_NG__
#define __XML_RELAX_NG__
#include <libxml/xmlversion.h>
#include <libxml/hash.h>
#include <libxml/xmlstring.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlRelaxNG xmlRelaxNG;
typedef xmlRelaxNG *xmlRelaxNGPtr;
/**
* xmlRelaxNGValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from a Relax-NG validation
*/
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlRelaxNGValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from a Relax-NG validation
*/
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* A schemas validation context
*/
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr;
/*
* xmlRelaxNGValidErr:
*
* List of possible Relax NG validation errors
*/
typedef enum {
XML_RELAXNG_OK = 0,
XML_RELAXNG_ERR_MEMORY,
XML_RELAXNG_ERR_TYPE,
XML_RELAXNG_ERR_TYPEVAL,
XML_RELAXNG_ERR_DUPID,
XML_RELAXNG_ERR_TYPECMP,
XML_RELAXNG_ERR_NOSTATE,
XML_RELAXNG_ERR_NODEFINE,
XML_RELAXNG_ERR_LISTEXTRA,
XML_RELAXNG_ERR_LISTEMPTY,
XML_RELAXNG_ERR_INTERNODATA,
XML_RELAXNG_ERR_INTERSEQ,
XML_RELAXNG_ERR_INTEREXTRA,
XML_RELAXNG_ERR_ELEMNAME,
XML_RELAXNG_ERR_ATTRNAME,
XML_RELAXNG_ERR_ELEMNONS,
XML_RELAXNG_ERR_ATTRNONS,
XML_RELAXNG_ERR_ELEMWRONGNS,
XML_RELAXNG_ERR_ATTRWRONGNS,
XML_RELAXNG_ERR_ELEMEXTRANS,
XML_RELAXNG_ERR_ATTREXTRANS,
XML_RELAXNG_ERR_ELEMNOTEMPTY,
XML_RELAXNG_ERR_NOELEM,
XML_RELAXNG_ERR_NOTELEM,
XML_RELAXNG_ERR_ATTRVALID,
XML_RELAXNG_ERR_CONTENTVALID,
XML_RELAXNG_ERR_EXTRACONTENT,
XML_RELAXNG_ERR_INVALIDATTR,
XML_RELAXNG_ERR_DATAELEM,
XML_RELAXNG_ERR_VALELEM,
XML_RELAXNG_ERR_LISTELEM,
XML_RELAXNG_ERR_DATATYPE,
XML_RELAXNG_ERR_VALUE,
XML_RELAXNG_ERR_LIST,
XML_RELAXNG_ERR_NOGRAMMAR,
XML_RELAXNG_ERR_EXTRADATA,
XML_RELAXNG_ERR_LACKDATA,
XML_RELAXNG_ERR_INTERNAL,
XML_RELAXNG_ERR_ELEMWRONG,
XML_RELAXNG_ERR_TEXTWRONG
} xmlRelaxNGValidErr;
/*
* xmlRelaxNGParserFlags:
*
* List of possible Relax NG Parser flags
*/
typedef enum {
XML_RELAXNGP_NONE = 0,
XML_RELAXNGP_FREE_DOC = 1,
XML_RELAXNGP_CRNG = 2
} xmlRelaxNGParserFlag;
XMLPUBFUN int XMLCALL
xmlRelaxNGInitTypes (void);
XMLPUBFUN void XMLCALL
xmlRelaxNGCleanupTypes (void);
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewParserCtxt (const char *URL);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt,
int flag);
XMLPUBFUN void XMLCALL
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetParserStructuredErrors(
xmlRelaxNGParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN xmlRelaxNGPtr XMLCALL
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlRelaxNGFree (xmlRelaxNGPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlRelaxNGDump (FILE *output,
xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
xmlRelaxNGDumpTree (FILE * output,
xmlRelaxNGPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void XMLCALL
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror, void *ctx);
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
XMLPUBFUN void XMLCALL
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc);
/*
* Interfaces for progressive validation when possible
*/
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_RELAX_NG__ */

View File

@ -0,0 +1,958 @@
/*
* Summary: internal interfaces for XML Schemas
* Description: internal interfaces for the XML Schemas handling
* and schema validity checking
* The Schemas development is a Work In Progress.
* Some of those interfaces are not guaranteed to be API or ABI stable !
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_INTERNALS_H__
#define __XML_SCHEMA_INTERNALS_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/xmlregexp.h>
#include <libxml/hash.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMAS_UNKNOWN = 0,
XML_SCHEMAS_STRING = 1,
XML_SCHEMAS_NORMSTRING = 2,
XML_SCHEMAS_DECIMAL = 3,
XML_SCHEMAS_TIME = 4,
XML_SCHEMAS_GDAY = 5,
XML_SCHEMAS_GMONTH = 6,
XML_SCHEMAS_GMONTHDAY = 7,
XML_SCHEMAS_GYEAR = 8,
XML_SCHEMAS_GYEARMONTH = 9,
XML_SCHEMAS_DATE = 10,
XML_SCHEMAS_DATETIME = 11,
XML_SCHEMAS_DURATION = 12,
XML_SCHEMAS_FLOAT = 13,
XML_SCHEMAS_DOUBLE = 14,
XML_SCHEMAS_BOOLEAN = 15,
XML_SCHEMAS_TOKEN = 16,
XML_SCHEMAS_LANGUAGE = 17,
XML_SCHEMAS_NMTOKEN = 18,
XML_SCHEMAS_NMTOKENS = 19,
XML_SCHEMAS_NAME = 20,
XML_SCHEMAS_QNAME = 21,
XML_SCHEMAS_NCNAME = 22,
XML_SCHEMAS_ID = 23,
XML_SCHEMAS_IDREF = 24,
XML_SCHEMAS_IDREFS = 25,
XML_SCHEMAS_ENTITY = 26,
XML_SCHEMAS_ENTITIES = 27,
XML_SCHEMAS_NOTATION = 28,
XML_SCHEMAS_ANYURI = 29,
XML_SCHEMAS_INTEGER = 30,
XML_SCHEMAS_NPINTEGER = 31,
XML_SCHEMAS_NINTEGER = 32,
XML_SCHEMAS_NNINTEGER = 33,
XML_SCHEMAS_PINTEGER = 34,
XML_SCHEMAS_INT = 35,
XML_SCHEMAS_UINT = 36,
XML_SCHEMAS_LONG = 37,
XML_SCHEMAS_ULONG = 38,
XML_SCHEMAS_SHORT = 39,
XML_SCHEMAS_USHORT = 40,
XML_SCHEMAS_BYTE = 41,
XML_SCHEMAS_UBYTE = 42,
XML_SCHEMAS_HEXBINARY = 43,
XML_SCHEMAS_BASE64BINARY = 44,
XML_SCHEMAS_ANYTYPE = 45,
XML_SCHEMAS_ANYSIMPLETYPE = 46
} xmlSchemaValType;
/*
* XML Schemas defines multiple type of types.
*/
typedef enum {
XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */
XML_SCHEMA_TYPE_ANY,
XML_SCHEMA_TYPE_FACET,
XML_SCHEMA_TYPE_SIMPLE,
XML_SCHEMA_TYPE_COMPLEX,
XML_SCHEMA_TYPE_SEQUENCE = 6,
XML_SCHEMA_TYPE_CHOICE,
XML_SCHEMA_TYPE_ALL,
XML_SCHEMA_TYPE_SIMPLE_CONTENT,
XML_SCHEMA_TYPE_COMPLEX_CONTENT,
XML_SCHEMA_TYPE_UR,
XML_SCHEMA_TYPE_RESTRICTION,
XML_SCHEMA_TYPE_EXTENSION,
XML_SCHEMA_TYPE_ELEMENT,
XML_SCHEMA_TYPE_ATTRIBUTE,
XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
XML_SCHEMA_TYPE_GROUP,
XML_SCHEMA_TYPE_NOTATION,
XML_SCHEMA_TYPE_LIST,
XML_SCHEMA_TYPE_UNION,
XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
XML_SCHEMA_TYPE_IDC_UNIQUE,
XML_SCHEMA_TYPE_IDC_KEY,
XML_SCHEMA_TYPE_IDC_KEYREF,
XML_SCHEMA_TYPE_PARTICLE = 25,
XML_SCHEMA_TYPE_ATTRIBUTE_USE,
XML_SCHEMA_FACET_MININCLUSIVE = 1000,
XML_SCHEMA_FACET_MINEXCLUSIVE,
XML_SCHEMA_FACET_MAXINCLUSIVE,
XML_SCHEMA_FACET_MAXEXCLUSIVE,
XML_SCHEMA_FACET_TOTALDIGITS,
XML_SCHEMA_FACET_FRACTIONDIGITS,
XML_SCHEMA_FACET_PATTERN,
XML_SCHEMA_FACET_ENUMERATION,
XML_SCHEMA_FACET_WHITESPACE,
XML_SCHEMA_FACET_LENGTH,
XML_SCHEMA_FACET_MAXLENGTH,
XML_SCHEMA_FACET_MINLENGTH,
XML_SCHEMA_EXTRA_QNAMEREF = 2000,
XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
} xmlSchemaTypeType;
typedef enum {
XML_SCHEMA_CONTENT_UNKNOWN = 0,
XML_SCHEMA_CONTENT_EMPTY = 1,
XML_SCHEMA_CONTENT_ELEMENTS,
XML_SCHEMA_CONTENT_MIXED,
XML_SCHEMA_CONTENT_SIMPLE,
XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */
XML_SCHEMA_CONTENT_BASIC,
XML_SCHEMA_CONTENT_ANY
} xmlSchemaContentType;
typedef struct _xmlSchemaVal xmlSchemaVal;
typedef xmlSchemaVal *xmlSchemaValPtr;
typedef struct _xmlSchemaType xmlSchemaType;
typedef xmlSchemaType *xmlSchemaTypePtr;
typedef struct _xmlSchemaFacet xmlSchemaFacet;
typedef xmlSchemaFacet *xmlSchemaFacetPtr;
/**
* Annotation
*/
typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
struct _xmlSchemaAnnot {
struct _xmlSchemaAnnot *next;
xmlNodePtr content; /* the annotation */
};
/**
* XML_SCHEMAS_ANYATTR_SKIP:
*
* Skip unknown attribute from validation
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_SKIP 1
/**
* XML_SCHEMAS_ANYATTR_LAX:
*
* Ignore validation non definition on attributes
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_LAX 2
/**
* XML_SCHEMAS_ANYATTR_STRICT:
*
* Apply strict validation rules on attributes
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_STRICT 3
/**
* XML_SCHEMAS_ANY_SKIP:
*
* Skip unknown attribute from validation
*/
#define XML_SCHEMAS_ANY_SKIP 1
/**
* XML_SCHEMAS_ANY_LAX:
*
* Used by wildcards.
* Validate if type found, don't worry if not found
*/
#define XML_SCHEMAS_ANY_LAX 2
/**
* XML_SCHEMAS_ANY_STRICT:
*
* Used by wildcards.
* Apply strict validation rules
*/
#define XML_SCHEMAS_ANY_STRICT 3
/**
* XML_SCHEMAS_ATTR_USE_PROHIBITED:
*
* Used by wildcards.
* The attribute is prohibited.
*/
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
/**
* XML_SCHEMAS_ATTR_USE_REQUIRED:
*
* The attribute is required.
*/
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
/**
* XML_SCHEMAS_ATTR_USE_OPTIONAL:
*
* The attribute is optional.
*/
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
/**
* XML_SCHEMAS_ATTR_GLOBAL:
*
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
/**
* XML_SCHEMAS_ATTR_NSDEFAULT:
*
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
/**
* XML_SCHEMAS_ATTR_INTERNAL_RESOLVED:
*
* this is set when the "type" and "ref" references
* have been resolved.
*/
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8
/**
* XML_SCHEMAS_ATTR_FIXED:
*
* the attribute has a fixed value
*/
#define XML_SCHEMAS_ATTR_FIXED 1 << 9
/**
* xmlSchemaAttribute:
* An attribute definition.
*/
typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
struct _xmlSchemaAttribute {
xmlSchemaTypeType type;
struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */
const xmlChar *name; /* the name of the declaration */
const xmlChar *id; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
const xmlChar *typeName; /* the local name of the type definition */
const xmlChar *typeNs; /* the ns URI of the type definition */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr base; /* Deprecated; not used */
int occurs; /* Deprecated; not used */
const xmlChar *defValue; /* The initial value of the value constraint */
xmlSchemaTypePtr subtypes; /* the type definition */
xmlNodePtr node;
const xmlChar *targetNamespace;
int flags;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaValPtr defVal; /* The compiled value constraint */
xmlSchemaAttributePtr refDecl; /* Deprecated; not used */
};
/**
* xmlSchemaAttributeLink:
* Used to build a list of attribute uses on complexType definitions.
* WARNING: Deprecated; not used.
*/
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
struct _xmlSchemaAttributeLink {
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
struct _xmlSchemaAttribute *attr;/* the linked attribute */
};
/**
* XML_SCHEMAS_WILDCARD_COMPLETE:
*
* If the wildcard is complete.
*/
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
/**
* xmlSchemaCharValueLink:
* Used to build a list of namespaces on wildcards.
*/
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
struct _xmlSchemaWildcardNs {
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
const xmlChar *value;/* the value */
};
/**
* xmlSchemaWildcard.
* A wildcard.
*/
typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
struct _xmlSchemaWildcard {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *id; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int processContents;
int any; /* Indicates if the ns constraint is of ##any */
xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */
xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */
int flags;
};
/**
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
*
* The attribute wildcard has been already builded.
*/
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
/**
* XML_SCHEMAS_ATTRGROUP_GLOBAL:
*
* The attribute wildcard has been already builded.
*/
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
/**
* XML_SCHEMAS_ATTRGROUP_MARKED:
*
* Marks the attr group as marked; used for circular checks.
*/
#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
/**
* XML_SCHEMAS_ATTRGROUP_REDEFINED:
*
* The attr group was redefined.
*/
#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
/**
* XML_SCHEMAS_ATTRGROUP_HAS_REFS:
*
* Whether this attr. group contains attr. group references.
*/
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
/**
* An attribute group definition.
*
* xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
* must be kept similar
*/
typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
struct _xmlSchemaAttributeGroup {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
const xmlChar *name;
const xmlChar *id;
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
xmlNodePtr node;
int flags;
xmlSchemaWildcardPtr attributeWildcard;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */
const xmlChar *targetNamespace;
void *attrUses;
};
/**
* xmlSchemaTypeLink:
* Used to build a list of types (e.g. member types of
* simpleType with variety "union").
*/
typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
struct _xmlSchemaTypeLink {
struct _xmlSchemaTypeLink *next;/* the next type link ... */
xmlSchemaTypePtr type;/* the linked type */
};
/**
* xmlSchemaFacetLink:
* Used to build a list of facets.
*/
typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
struct _xmlSchemaFacetLink {
struct _xmlSchemaFacetLink *next;/* the next facet link ... */
xmlSchemaFacetPtr facet;/* the linked facet */
};
/**
* XML_SCHEMAS_TYPE_MIXED:
*
* the element content type is mixed
*/
#define XML_SCHEMAS_TYPE_MIXED 1 << 0
/**
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION:
*
* the simple or complex type has a derivation method of "extension".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
/**
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION:
*
* the simple or complex type has a derivation method of "restriction".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
/**
* XML_SCHEMAS_TYPE_GLOBAL:
*
* the type is global
*/
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
/**
* XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD:
*
* the complexType owns an attribute wildcard, i.e.
* it can be freed by the complexType
*/
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */
/**
* XML_SCHEMAS_TYPE_VARIETY_ABSENT:
*
* the simpleType has a variety of "absent".
* TODO: Actually not necessary :-/, since if
* none of the variety flags occur then it's
* automatically absent.
*/
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5
/**
* XML_SCHEMAS_TYPE_VARIETY_LIST:
*
* the simpleType has a variety of "list".
*/
#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6
/**
* XML_SCHEMAS_TYPE_VARIETY_UNION:
*
* the simpleType has a variety of "union".
*/
#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7
/**
* XML_SCHEMAS_TYPE_VARIETY_ATOMIC:
*
* the simpleType has a variety of "union".
*/
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8
/**
* XML_SCHEMAS_TYPE_FINAL_EXTENSION:
*
* the complexType has a final of "extension".
*/
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9
/**
* XML_SCHEMAS_TYPE_FINAL_RESTRICTION:
*
* the simpleType/complexType has a final of "restriction".
*/
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10
/**
* XML_SCHEMAS_TYPE_FINAL_LIST:
*
* the simpleType has a final of "list".
*/
#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11
/**
* XML_SCHEMAS_TYPE_FINAL_UNION:
*
* the simpleType has a final of "union".
*/
#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12
/**
* XML_SCHEMAS_TYPE_FINAL_DEFAULT:
*
* the simpleType has a final of "default".
*/
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13
/**
* XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE:
*
* Marks the item as a builtin primitive.
*/
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14
/**
* XML_SCHEMAS_TYPE_MARKED:
*
* Marks the item as marked; used for circular checks.
*/
#define XML_SCHEMAS_TYPE_MARKED 1 << 16
/**
* XML_SCHEMAS_TYPE_BLOCK_DEFAULT:
*
* the complexType did not specify 'block' so use the default of the
* <schema> item.
*/
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17
/**
* XML_SCHEMAS_TYPE_BLOCK_EXTENSION:
*
* the complexType has a 'block' of "extension".
*/
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18
/**
* XML_SCHEMAS_TYPE_BLOCK_RESTRICTION:
*
* the complexType has a 'block' of "restriction".
*/
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19
/**
* XML_SCHEMAS_TYPE_ABSTRACT:
*
* the simple/complexType is abstract.
*/
#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20
/**
* XML_SCHEMAS_TYPE_FACETSNEEDVALUE:
*
* indicates if the facets need a computed value
*/
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21
/**
* XML_SCHEMAS_TYPE_INTERNAL_RESOLVED:
*
* indicates that the type was typefixed
*/
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22
/**
* XML_SCHEMAS_TYPE_INTERNAL_INVALID:
*
* indicates that the type is invalid
*/
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23
/**
* XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE:
*
* a whitespace-facet value of "preserve"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24
/**
* XML_SCHEMAS_TYPE_WHITESPACE_REPLACE:
*
* a whitespace-facet value of "replace"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25
/**
* XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE:
*
* a whitespace-facet value of "collapse"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26
/**
* XML_SCHEMAS_TYPE_HAS_FACETS:
*
* has facets
*/
#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27
/**
* XML_SCHEMAS_TYPE_NORMVALUENEEDED:
*
* indicates if the facets (pattern) need a normalized value
*/
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28
/**
* XML_SCHEMAS_TYPE_FIXUP_1:
*
* First stage of fixup was done.
*/
#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29
/**
* XML_SCHEMAS_TYPE_REDEFINED:
*
* The type was redefined.
*/
#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30
/**
* XML_SCHEMAS_TYPE_REDEFINING:
*
* The type redefines an other type.
*/
/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */
/**
* _xmlSchemaType:
*
* Schemas type definition.
*/
struct _xmlSchemaType {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next; /* the next type if in a sequence ... */
const xmlChar *name;
const xmlChar *id ; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr subtypes;
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int flags;
xmlSchemaContentType contentType;
const xmlChar *base; /* Base type's local name */
const xmlChar *baseNs; /* Base type's target namespace */
xmlSchemaTypePtr baseType; /* The base type component */
xmlSchemaFacetPtr facets; /* Local facets */
struct _xmlSchemaType *redef; /* Deprecated; not used */
int recurse; /* Obsolete */
xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */
xmlSchemaWildcardPtr attributeWildcard;
int builtInType; /* Type of built-in types. */
xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */
xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types.
Could we use @subtypes for this? */
xmlRegexpPtr contModel; /* Holds the automaton of the content model */
const xmlChar *targetNamespace;
void *attrUses;
};
/*
* xmlSchemaElement:
* An element definition.
*
* xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
* structures must be kept similar
*/
/**
* XML_SCHEMAS_ELEM_NILLABLE:
*
* the element is nillable
*/
#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
/**
* XML_SCHEMAS_ELEM_GLOBAL:
*
* the element is global
*/
#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
/**
* XML_SCHEMAS_ELEM_DEFAULT:
*
* the element has a default value
*/
#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
/**
* XML_SCHEMAS_ELEM_FIXED:
*
* the element has a fixed value
*/
#define XML_SCHEMAS_ELEM_FIXED 1 << 3
/**
* XML_SCHEMAS_ELEM_ABSTRACT:
*
* the element is abstract
*/
#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
/**
* XML_SCHEMAS_ELEM_TOPLEVEL:
*
* the element is top level
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
*/
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
/**
* XML_SCHEMAS_ELEM_REF:
*
* the element is a reference to a type
*/
#define XML_SCHEMAS_ELEM_REF 1 << 6
/**
* XML_SCHEMAS_ELEM_NSDEFAULT:
*
* allow elements in no namespace
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
/**
* XML_SCHEMAS_ELEM_INTERNAL_RESOLVED:
*
* this is set when "type", "ref", "substitutionGroup"
* references have been resolved.
*/
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
/**
* XML_SCHEMAS_ELEM_CIRCULAR:
*
* a helper flag for the search of circular references.
*/
#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
/**
* XML_SCHEMAS_ELEM_BLOCK_ABSENT:
*
* the "block" attribute is absent
*/
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
/**
* XML_SCHEMAS_ELEM_BLOCK_EXTENSION:
*
* disallowed substitutions are absent
*/
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
/**
* XML_SCHEMAS_ELEM_BLOCK_RESTRICTION:
*
* disallowed substitutions: "restriction"
*/
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
/**
* XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
*
* disallowed substitutions: "substituion"
*/
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
/**
* XML_SCHEMAS_ELEM_FINAL_ABSENT:
*
* substitution group exclusions are absent
*/
#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
/**
* XML_SCHEMAS_ELEM_FINAL_EXTENSION:
*
* substitution group exclusions: "extension"
*/
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
/**
* XML_SCHEMAS_ELEM_FINAL_RESTRICTION:
*
* substitution group exclusions: "restriction"
*/
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
/**
* XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD:
*
* the declaration is a substitution group head
*/
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17
/**
* XML_SCHEMAS_ELEM_INTERNAL_CHECKED:
*
* this is set when the elem decl has been checked against
* all constraints
*/
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18
typedef struct _xmlSchemaElement xmlSchemaElement;
typedef xmlSchemaElement *xmlSchemaElementPtr;
struct _xmlSchemaElement {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next; /* Not used? */
const xmlChar *name;
const xmlChar *id; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnotPtr annot;
xmlSchemaTypePtr subtypes; /* the type definition */
xmlSchemaAttributePtr attributes;
xmlNodePtr node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int flags;
const xmlChar *targetNamespace;
const xmlChar *namedType;
const xmlChar *namedTypeNs;
const xmlChar *substGroup;
const xmlChar *substGroupNs;
const xmlChar *scope;
const xmlChar *value; /* The original value of the value constraint. */
struct _xmlSchemaElement *refDecl; /* This will now be used for the
substitution group affiliation */
xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */
xmlSchemaContentType contentType;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaValPtr defVal; /* The compiled value contraint. */
void *idcs; /* The identity-constraint defs */
};
/*
* XML_SCHEMAS_FACET_UNKNOWN:
*
* unknown facet handling
*/
#define XML_SCHEMAS_FACET_UNKNOWN 0
/*
* XML_SCHEMAS_FACET_PRESERVE:
*
* preserve the type of the facet
*/
#define XML_SCHEMAS_FACET_PRESERVE 1
/*
* XML_SCHEMAS_FACET_REPLACE:
*
* replace the type of the facet
*/
#define XML_SCHEMAS_FACET_REPLACE 2
/*
* XML_SCHEMAS_FACET_COLLAPSE:
*
* collapse the types of the facet
*/
#define XML_SCHEMAS_FACET_COLLAPSE 3
/**
* A facet definition.
*/
struct _xmlSchemaFacet {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
const xmlChar *value; /* The original value */
const xmlChar *id; /* Obsolete */
xmlSchemaAnnotPtr annot;
xmlNodePtr node;
int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
int whitespace;
xmlSchemaValPtr val; /* The compiled value */
xmlRegexpPtr regexp; /* The regex for patterns */
};
/**
* A notation definition.
*/
typedef struct _xmlSchemaNotation xmlSchemaNotation;
typedef xmlSchemaNotation *xmlSchemaNotationPtr;
struct _xmlSchemaNotation {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *name;
xmlSchemaAnnotPtr annot;
const xmlChar *identifier;
const xmlChar *targetNamespace;
};
/*
* TODO: Actually all those flags used for the schema should sit
* on the schema parser context, since they are used only
* during parsing an XML schema document, and not available
* on the component level as per spec.
*/
/**
* XML_SCHEMAS_QUALIF_ELEM:
*
* Reflects elementFormDefault == qualified in
* an XML schema document.
*/
#define XML_SCHEMAS_QUALIF_ELEM 1 << 0
/**
* XML_SCHEMAS_QUALIF_ATTR:
*
* Reflects attributeFormDefault == qualified in
* an XML schema document.
*/
#define XML_SCHEMAS_QUALIF_ATTR 1 << 1
/**
* XML_SCHEMAS_FINAL_DEFAULT_EXTENSION:
*
* the schema has "extension" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
/**
* XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION:
*
* the schema has "restriction" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
/**
* XML_SCHEMAS_FINAL_DEFAULT_LIST:
*
* the cshema has "list" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
/**
* XML_SCHEMAS_FINAL_DEFAULT_UNION:
*
* the schema has "union" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
/**
* XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION:
*
* the schema has "extension" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
/**
* XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION:
*
* the schema has "restriction" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
/**
* XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION:
*
* the schema has "substitution" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
/**
* XML_SCHEMAS_INCLUDING_CONVERT_NS:
*
* the schema is currently including an other schema with
* no target namespace.
*/
#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
/**
* _xmlSchema:
*
* A Schemas definition
*/
struct _xmlSchema {
const xmlChar *name; /* schema name */
const xmlChar *targetNamespace; /* the target namespace */
const xmlChar *version;
const xmlChar *id; /* Obsolete */
xmlDocPtr doc;
xmlSchemaAnnotPtr annot;
int flags;
xmlHashTablePtr typeDecl;
xmlHashTablePtr attrDecl;
xmlHashTablePtr attrgrpDecl;
xmlHashTablePtr elemDecl;
xmlHashTablePtr notaDecl;
xmlHashTablePtr schemasImports;
void *_private; /* unused by the library for users or bindings */
xmlHashTablePtr groupDecl;
xmlDictPtr dict;
void *includes; /* the includes, this is opaque for now */
int preserve; /* whether to free the document */
int counter; /* used to give ononymous components unique names */
xmlHashTablePtr idcDef; /* All identity-constraint defs. */
void *volatiles; /* Obsolete */
};
XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_INTERNALS_H__ */

View File

@ -0,0 +1,142 @@
/*
* Summary: XML Schemastron implementation
* Description: interface to the XML Schematron validity checking.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMATRON_H__
#define __XML_SCHEMATRON_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMATRON_ENABLED
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMATRON_OUT_QUIET = 1 << 0, /* quiet no report */
XML_SCHEMATRON_OUT_TEXT = 1 << 1, /* build a textual report */
XML_SCHEMATRON_OUT_XML = 1 << 2, /* output SVRL */
XML_SCHEMATRON_OUT_ERROR = 1 << 3, /* output via xmlStructuredErrorFunc */
XML_SCHEMATRON_OUT_FILE = 1 << 8, /* output to a file descriptor */
XML_SCHEMATRON_OUT_BUFFER = 1 << 9, /* output to a buffer */
XML_SCHEMATRON_OUT_IO = 1 << 10 /* output to I/O mechanism */
} xmlSchematronValidOptions;
/**
* The schemas related types are kept internal
*/
typedef struct _xmlSchematron xmlSchematron;
typedef xmlSchematron *xmlSchematronPtr;
/**
* xmlSchematronValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from a Schematron validation
*/
typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
/**
* xmlSchematronValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from a Schematron validation
*/
typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
/**
* A schemas validation context
*/
typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewMemParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlSchematronParserCtxtPtr XMLCALL
xmlSchematronNewDocParserCtxt(xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlSchematronFreeParserCtxt (xmlSchematronParserCtxtPtr ctxt);
/*****
XMLPUBFUN void XMLCALL
xmlSchematronSetParserErrors(xmlSchematronParserCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchematronGetParserErrors(xmlSchematronParserCtxtPtr ctxt,
xmlSchematronValidityErrorFunc * err,
xmlSchematronValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchematronIsValid (xmlSchematronValidCtxtPtr ctxt);
*****/
XMLPUBFUN xmlSchematronPtr XMLCALL
xmlSchematronParse (xmlSchematronParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchematronFree (xmlSchematronPtr schema);
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlSchematronSetValidStructuredErrors(
xmlSchematronValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
/******
XMLPUBFUN void XMLCALL
xmlSchematronSetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchematronGetValidErrors (xmlSchematronValidCtxtPtr ctxt,
xmlSchematronValidityErrorFunc *err,
xmlSchematronValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchematronSetValidOptions(xmlSchematronValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchematronValidateOneElement (xmlSchematronValidCtxtPtr ctxt,
xmlNodePtr elem);
*******/
XMLPUBFUN xmlSchematronValidCtxtPtr XMLCALL
xmlSchematronNewValidCtxt (xmlSchematronPtr schema,
int options);
XMLPUBFUN void XMLCALL
xmlSchematronFreeValidCtxt (xmlSchematronValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchematronValidateDoc (xmlSchematronValidCtxtPtr ctxt,
xmlDocPtr instance);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMATRON_ENABLED */
#endif /* __XML_SCHEMATRON_H__ */

View File

@ -0,0 +1,89 @@
/**
* Summary: interfaces for thread handling
* Description: set of generic threading related routines
* should work with pthreads, Windows native or TLS threads
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_THREADS_H__
#define __XML_THREADS_H__
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* xmlMutex are a simple mutual exception locks.
*/
typedef struct _xmlMutex xmlMutex;
typedef xmlMutex *xmlMutexPtr;
/*
* xmlRMutex are reentrant mutual exception locks.
*/
typedef struct _xmlRMutex xmlRMutex;
typedef xmlRMutex *xmlRMutexPtr;
#ifdef __cplusplus
}
#endif
#include <libxml/globals.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN xmlMutexPtr XMLCALL
xmlNewMutex (void);
XMLPUBFUN void XMLCALL
xmlMutexLock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlMutexUnlock (xmlMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlFreeMutex (xmlMutexPtr tok);
XMLPUBFUN xmlRMutexPtr XMLCALL
xmlNewRMutex (void);
XMLPUBFUN void XMLCALL
xmlRMutexLock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlRMutexUnlock (xmlRMutexPtr tok);
XMLPUBFUN void XMLCALL
xmlFreeRMutex (xmlRMutexPtr tok);
/*
* Library wide APIs.
*/
XMLPUBFUN void XMLCALL
xmlInitThreads (void);
XMLPUBFUN void XMLCALL
xmlLockLibrary (void);
XMLPUBFUN void XMLCALL
xmlUnlockLibrary(void);
XMLPUBFUN int XMLCALL
xmlGetThreadId (void);
XMLPUBFUN int XMLCALL
xmlIsMainThread (void);
XMLPUBFUN void XMLCALL
xmlCleanupThreads(void);
XMLPUBFUN xmlGlobalStatePtr XMLCALL
xmlGetGlobalState(void);
#ifdef HAVE_PTHREAD_H
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
int XMLCALL
xmlDllMain(void *hinstDLL, unsigned long fdwReason,
void *lpvReserved);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_THREADS_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
/**
* Summary: library of generic URI related routines
* Description: library of generic URI related routines
* Implements RFC 2396
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_URI_H__
#define __XML_URI_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlURI:
*
* A parsed URI reference. This is a struct containing the various fields
* as described in RFC 2396 but separated for further processing.
*
* Note: query is a deprecated field which is incorrectly unescaped.
* query_raw takes precedence over query if the former is set.
* See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127
*/
typedef struct _xmlURI xmlURI;
typedef xmlURI *xmlURIPtr;
struct _xmlURI {
char *scheme; /* the URI scheme */
char *opaque; /* opaque part */
char *authority; /* the authority part */
char *server; /* the server part */
char *user; /* the user part */
int port; /* the port number */
char *path; /* the path string */
char *query; /* the query string (deprecated - use with caution) */
char *fragment; /* the fragment identifier */
int cleanup; /* parsing potentially unclean URI */
char *query_raw; /* the query string (as it appears in the URI) */
};
/*
* This function is in tree.h:
* xmlChar * xmlNodeGetBase (xmlDocPtr doc,
* xmlNodePtr cur);
*/
XMLPUBFUN xmlURIPtr XMLCALL
xmlCreateURI (void);
XMLPUBFUN xmlChar * XMLCALL
xmlBuildURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlChar * XMLCALL
xmlBuildRelativeURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlURIPtr XMLCALL
xmlParseURI (const char *str);
XMLPUBFUN xmlURIPtr XMLCALL
xmlParseURIRaw (const char *str,
int raw);
XMLPUBFUN int XMLCALL
xmlParseURIReference (xmlURIPtr uri,
const char *str);
XMLPUBFUN xmlChar * XMLCALL
xmlSaveUri (xmlURIPtr uri);
XMLPUBFUN void XMLCALL
xmlPrintURI (FILE *stream,
xmlURIPtr uri);
XMLPUBFUN xmlChar * XMLCALL
xmlURIEscapeStr (const xmlChar *str,
const xmlChar *list);
XMLPUBFUN char * XMLCALL
xmlURIUnescapeString (const char *str,
int len,
char *target);
XMLPUBFUN int XMLCALL
xmlNormalizeURIPath (char *path);
XMLPUBFUN xmlChar * XMLCALL
xmlURIEscape (const xmlChar *str);
XMLPUBFUN void XMLCALL
xmlFreeURI (xmlURIPtr uri);
XMLPUBFUN xmlChar* XMLCALL
xmlCanonicPath (const xmlChar *path);
XMLPUBFUN xmlChar* XMLCALL
xmlPathToURI (const xmlChar *path);
#ifdef __cplusplus
}
#endif
#endif /* __XML_URI_H__ */

View File

@ -0,0 +1,458 @@
/*
* Summary: The DTD validation
* Description: API for the DTD handling and the validity checking
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_VALID_H__
#define __XML_VALID_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/list.h>
#include <libxml/xmlautomata.h>
#include <libxml/xmlregexp.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Validation state added for non-determinist content model.
*/
typedef struct _xmlValidState xmlValidState;
typedef xmlValidState *xmlValidStatePtr;
/**
* xmlValidityErrorFunc:
* @ctx: usually an xmlValidCtxtPtr to a validity error context,
* but comes from ctxt->userData (which normally contains such
* a pointer); ctxt->userData can be changed by the user.
* @msg: the string to format *printf like vararg
* @...: remaining arguments to the format
*
* Callback called when a validity error is found. This is a message
* oriented function similar to an *printf function.
*/
typedef void (XMLCDECL *xmlValidityErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlValidityWarningFunc:
* @ctx: usually an xmlValidCtxtPtr to a validity error context,
* but comes from ctxt->userData (which normally contains such
* a pointer); ctxt->userData can be changed by the user.
* @msg: the string to format *printf like vararg
* @...: remaining arguments to the format
*
* Callback called when a validity warning is found. This is a message
* oriented function similar to an *printf function.
*/
typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
#ifdef IN_LIBXML
/**
* XML_CTXT_FINISH_DTD_0:
*
* Special value for finishDtd field when embedded in an xmlParserCtxt
*/
#define XML_CTXT_FINISH_DTD_0 0xabcd1234
/**
* XML_CTXT_FINISH_DTD_1:
*
* Special value for finishDtd field when embedded in an xmlParserCtxt
*/
#define XML_CTXT_FINISH_DTD_1 0xabcd1235
#endif
/*
* xmlValidCtxt:
* An xmlValidCtxt is used for error reporting when validating.
*/
typedef struct _xmlValidCtxt xmlValidCtxt;
typedef xmlValidCtxt *xmlValidCtxtPtr;
struct _xmlValidCtxt {
void *userData; /* user specific data block */
xmlValidityErrorFunc error; /* the callback in case of errors */
xmlValidityWarningFunc warning; /* the callback in case of warning */
/* Node analysis stack used when validating within entities */
xmlNodePtr node; /* Current parsed Node */
int nodeNr; /* Depth of the parsing stack */
int nodeMax; /* Max depth of the parsing stack */
xmlNodePtr *nodeTab; /* array of nodes */
unsigned int finishDtd; /* finished validating the Dtd ? */
xmlDocPtr doc; /* the document */
int valid; /* temporary validity check result */
/* state state used for non-determinist content validation */
xmlValidState *vstate; /* current state */
int vstateNr; /* Depth of the validation stack */
int vstateMax; /* Max depth of the validation stack */
xmlValidState *vstateTab; /* array of validation states */
#ifdef LIBXML_REGEXP_ENABLED
xmlAutomataPtr am; /* the automata */
xmlAutomataStatePtr state; /* used to build the automata */
#else
void *am;
void *state;
#endif
};
/*
* ALL notation declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlNotationTable;
typedef xmlNotationTable *xmlNotationTablePtr;
/*
* ALL element declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlElementTable;
typedef xmlElementTable *xmlElementTablePtr;
/*
* ALL attribute declarations are stored in a table.
* There is one table per DTD.
*/
typedef struct _xmlHashTable xmlAttributeTable;
typedef xmlAttributeTable *xmlAttributeTablePtr;
/*
* ALL IDs attributes are stored in a table.
* There is one table per document.
*/
typedef struct _xmlHashTable xmlIDTable;
typedef xmlIDTable *xmlIDTablePtr;
/*
* ALL Refs attributes are stored in a table.
* There is one table per document.
*/
typedef struct _xmlHashTable xmlRefTable;
typedef xmlRefTable *xmlRefTablePtr;
/* Notation */
XMLPUBFUN xmlNotationPtr XMLCALL
xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *PublicID,
const xmlChar *SystemID);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlNotationTablePtr XMLCALL
xmlCopyNotationTable (xmlNotationTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeNotationTable (xmlNotationTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpNotationDecl (xmlBufferPtr buf,
xmlNotationPtr nota);
XMLPUBFUN void XMLCALL
xmlDumpNotationTable (xmlBufferPtr buf,
xmlNotationTablePtr table);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Element Content */
/* the non Doc version are being deprecated */
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlNewElementContent (const xmlChar *name,
xmlElementContentType type);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlCopyElementContent (xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlFreeElementContent (xmlElementContentPtr cur);
/* the new versions with doc argument */
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlNewDocElementContent (xmlDocPtr doc,
const xmlChar *name,
xmlElementContentType type);
XMLPUBFUN xmlElementContentPtr XMLCALL
xmlCopyDocElementContent(xmlDocPtr doc,
xmlElementContentPtr content);
XMLPUBFUN void XMLCALL
xmlFreeDocElementContent(xmlDocPtr doc,
xmlElementContentPtr cur);
XMLPUBFUN void XMLCALL
xmlSnprintfElementContent(char *buf,
int size,
xmlElementContentPtr content,
int englob);
#ifdef LIBXML_OUTPUT_ENABLED
/* DEPRECATED */
XMLPUBFUN void XMLCALL
xmlSprintfElementContent(char *buf,
xmlElementContentPtr content,
int englob);
#endif /* LIBXML_OUTPUT_ENABLED */
/* DEPRECATED */
/* Element */
XMLPUBFUN xmlElementPtr XMLCALL
xmlAddElementDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *name,
xmlElementTypeVal type,
xmlElementContentPtr content);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlElementTablePtr XMLCALL
xmlCopyElementTable (xmlElementTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeElementTable (xmlElementTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpElementTable (xmlBufferPtr buf,
xmlElementTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpElementDecl (xmlBufferPtr buf,
xmlElementPtr elem);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Enumeration */
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlCreateEnumeration (const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlFreeEnumeration (xmlEnumerationPtr cur);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlEnumerationPtr XMLCALL
xmlCopyEnumeration (xmlEnumerationPtr cur);
#endif /* LIBXML_TREE_ENABLED */
/* Attribute */
XMLPUBFUN xmlAttributePtr XMLCALL
xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *ns,
xmlAttributeType type,
xmlAttributeDefault def,
const xmlChar *defaultValue,
xmlEnumerationPtr tree);
#ifdef LIBXML_TREE_ENABLED
XMLPUBFUN xmlAttributeTablePtr XMLCALL
xmlCopyAttributeTable (xmlAttributeTablePtr table);
#endif /* LIBXML_TREE_ENABLED */
XMLPUBFUN void XMLCALL
xmlFreeAttributeTable (xmlAttributeTablePtr table);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlDumpAttributeTable (xmlBufferPtr buf,
xmlAttributeTablePtr table);
XMLPUBFUN void XMLCALL
xmlDumpAttributeDecl (xmlBufferPtr buf,
xmlAttributePtr attr);
#endif /* LIBXML_OUTPUT_ENABLED */
/* IDs */
XMLPUBFUN xmlIDPtr XMLCALL
xmlAddID (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XMLPUBFUN void XMLCALL
xmlFreeIDTable (xmlIDTablePtr table);
XMLPUBFUN xmlAttrPtr XMLCALL
xmlGetID (xmlDocPtr doc,
const xmlChar *ID);
XMLPUBFUN int XMLCALL
xmlIsID (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XMLPUBFUN int XMLCALL
xmlRemoveID (xmlDocPtr doc,
xmlAttrPtr attr);
/* IDREFs */
XMLPUBFUN xmlRefPtr XMLCALL
xmlAddRef (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XMLPUBFUN void XMLCALL
xmlFreeRefTable (xmlRefTablePtr table);
XMLPUBFUN int XMLCALL
xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XMLPUBFUN int XMLCALL
xmlRemoveRef (xmlDocPtr doc,
xmlAttrPtr attr);
XMLPUBFUN xmlListPtr XMLCALL
xmlGetRefs (xmlDocPtr doc,
const xmlChar *ID);
/**
* The public function calls related to validity checking.
*/
#ifdef LIBXML_VALID_ENABLED
/* Allocate/Release Validation Contexts */
XMLPUBFUN xmlValidCtxtPtr XMLCALL
xmlNewValidCtxt(void);
XMLPUBFUN void XMLCALL
xmlFreeValidCtxt(xmlValidCtxtPtr);
XMLPUBFUN int XMLCALL
xmlValidateRoot (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlElementPtr elem);
XMLPUBFUN xmlChar * XMLCALL
xmlValidNormalizeAttributeValue(xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *name,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlAttributePtr attr);
XMLPUBFUN int XMLCALL
xmlValidateAttributeValue(xmlAttributeType type,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNotationPtr nota);
XMLPUBFUN int XMLCALL
xmlValidateDtd (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlDtdPtr dtd);
XMLPUBFUN int XMLCALL
xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateDocument (xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlValidateElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlValidateOneElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateOneNamespace (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *prefix,
xmlNsPtr ns,
const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
xmlDocPtr doc);
#endif /* LIBXML_VALID_ENABLED */
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN int XMLCALL
xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *notationName);
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
XMLPUBFUN int XMLCALL
xmlIsMixedElement (xmlDocPtr doc,
const xmlChar *name);
XMLPUBFUN xmlAttributePtr XMLCALL
xmlGetDtdAttrDesc (xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name);
XMLPUBFUN xmlAttributePtr XMLCALL
xmlGetDtdQAttrDesc (xmlDtdPtr dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlNotationPtr XMLCALL
xmlGetDtdNotationDesc (xmlDtdPtr dtd,
const xmlChar *name);
XMLPUBFUN xmlElementPtr XMLCALL
xmlGetDtdQElementDesc (xmlDtdPtr dtd,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlElementPtr XMLCALL
xmlGetDtdElementDesc (xmlDtdPtr dtd,
const xmlChar *name);
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int XMLCALL
xmlValidGetPotentialChildren(xmlElementContent *ctree,
const xmlChar **names,
int *len,
int max);
XMLPUBFUN int XMLCALL
xmlValidGetValidElements(xmlNode *prev,
xmlNode *next,
const xmlChar **names,
int max);
XMLPUBFUN int XMLCALL
xmlValidateNameValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNamesValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNmtokenValue (const xmlChar *value);
XMLPUBFUN int XMLCALL
xmlValidateNmtokensValue(const xmlChar *value);
#ifdef LIBXML_REGEXP_ENABLED
/*
* Validation based on the regexp support
*/
XMLPUBFUN int XMLCALL
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
xmlElementPtr elem);
XMLPUBFUN int XMLCALL
xmlValidatePushElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
XMLPUBFUN int XMLCALL
xmlValidatePushCData (xmlValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
xmlValidatePopElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* LIBXML_VALID_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_VALID_H__ */

View File

@ -0,0 +1,129 @@
/*
* Summary: implementation of XInclude
* Description: API to handle XInclude processing,
* implements the
* World Wide Web Consortium Last Call Working Draft 10 November 2003
* http://www.w3.org/TR/2003/WD-xinclude-20031110
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XINCLUDE_H__
#define __XML_XINCLUDE_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_XINCLUDE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* XINCLUDE_NS:
*
* Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
*/
#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude"
/**
* XINCLUDE_OLD_NS:
*
* Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
*/
#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
/**
* XINCLUDE_NODE:
*
* Macro defining "include"
*/
#define XINCLUDE_NODE (const xmlChar *) "include"
/**
* XINCLUDE_FALLBACK:
*
* Macro defining "fallback"
*/
#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
/**
* XINCLUDE_HREF:
*
* Macro defining "href"
*/
#define XINCLUDE_HREF (const xmlChar *) "href"
/**
* XINCLUDE_PARSE:
*
* Macro defining "parse"
*/
#define XINCLUDE_PARSE (const xmlChar *) "parse"
/**
* XINCLUDE_PARSE_XML:
*
* Macro defining "xml"
*/
#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
/**
* XINCLUDE_PARSE_TEXT:
*
* Macro defining "text"
*/
#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
/**
* XINCLUDE_PARSE_ENCODING:
*
* Macro defining "encoding"
*/
#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
/**
* XINCLUDE_PARSE_XPOINTER:
*
* Macro defining "xpointer"
*/
#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer"
typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
/*
* standalone processing
*/
XMLPUBFUN int XMLCALL
xmlXIncludeProcess (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessFlags (xmlDocPtr doc,
int flags);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessFlagsData(xmlDocPtr doc,
int flags,
void *data);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
int flags,
void *data);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTree (xmlNodePtr tree);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
int flags);
/*
* contextual processing
*/
XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL
xmlXIncludeNewContext (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
int flags);
XMLPUBFUN void XMLCALL
xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
xmlNodePtr tree);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XINCLUDE_ENABLED */
#endif /* __XML_XINCLUDE_H__ */

View File

@ -0,0 +1,189 @@
/*
* Summary: unfinished XLink detection module
* Description: unfinished XLink detection module
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XLINK_H__
#define __XML_XLINK_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_XPTR_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* Various defines for the various Link properties.
*
* NOTE: the link detection layer will try to resolve QName expansion
* of namespaces. If "foo" is the prefix for "http://foo.com/"
* then the link detection layer will expand role="foo:myrole"
* to "http://foo.com/:myrole".
* NOTE: the link detection layer will expand URI-Refences found on
* href attributes by using the base mechanism if found.
*/
typedef xmlChar *xlinkHRef;
typedef xmlChar *xlinkRole;
typedef xmlChar *xlinkTitle;
typedef enum {
XLINK_TYPE_NONE = 0,
XLINK_TYPE_SIMPLE,
XLINK_TYPE_EXTENDED,
XLINK_TYPE_EXTENDED_SET
} xlinkType;
typedef enum {
XLINK_SHOW_NONE = 0,
XLINK_SHOW_NEW,
XLINK_SHOW_EMBED,
XLINK_SHOW_REPLACE
} xlinkShow;
typedef enum {
XLINK_ACTUATE_NONE = 0,
XLINK_ACTUATE_AUTO,
XLINK_ACTUATE_ONREQUEST
} xlinkActuate;
/**
* xlinkNodeDetectFunc:
* @ctx: user data pointer
* @node: the node to check
*
* This is the prototype for the link detection routine.
* It calls the default link detection callbacks upon link detection.
*/
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
/*
* The link detection module interact with the upper layers using
* a set of callback registered at parsing time.
*/
/**
* xlinkSimpleLinkFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @href: the target of the link
* @role: the role string
* @title: the link title
*
* This is the prototype for a simple link detection callback.
*/
typedef void
(*xlinkSimpleLinkFunk) (void *ctx,
xmlNodePtr node,
const xlinkHRef href,
const xlinkRole role,
const xlinkTitle title);
/**
* xlinkExtendedLinkFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @nbLocators: the number of locators detected on the link
* @hrefs: pointer to the array of locator hrefs
* @roles: pointer to the array of locator roles
* @nbArcs: the number of arcs detected on the link
* @from: pointer to the array of source roles found on the arcs
* @to: pointer to the array of target roles found on the arcs
* @show: array of values for the show attributes found on the arcs
* @actuate: array of values for the actuate attributes found on the arcs
* @nbTitles: the number of titles detected on the link
* @title: array of titles detected on the link
* @langs: array of xml:lang values for the titles
*
* This is the prototype for a extended link detection callback.
*/
typedef void
(*xlinkExtendedLinkFunk)(void *ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef *hrefs,
const xlinkRole *roles,
int nbArcs,
const xlinkRole *from,
const xlinkRole *to,
xlinkShow *show,
xlinkActuate *actuate,
int nbTitles,
const xlinkTitle *titles,
const xmlChar **langs);
/**
* xlinkExtendedLinkSetFunk:
* @ctx: user data pointer
* @node: the node carrying the link
* @nbLocators: the number of locators detected on the link
* @hrefs: pointer to the array of locator hrefs
* @roles: pointer to the array of locator roles
* @nbTitles: the number of titles detected on the link
* @title: array of titles detected on the link
* @langs: array of xml:lang values for the titles
*
* This is the prototype for a extended link set detection callback.
*/
typedef void
(*xlinkExtendedLinkSetFunk) (void *ctx,
xmlNodePtr node,
int nbLocators,
const xlinkHRef *hrefs,
const xlinkRole *roles,
int nbTitles,
const xlinkTitle *titles,
const xmlChar **langs);
/**
* This is the structure containing a set of Links detection callbacks.
*
* There is no default xlink callbacks, if one want to get link
* recognition activated, those call backs must be provided before parsing.
*/
typedef struct _xlinkHandler xlinkHandler;
typedef xlinkHandler *xlinkHandlerPtr;
struct _xlinkHandler {
xlinkSimpleLinkFunk simple;
xlinkExtendedLinkFunk extended;
xlinkExtendedLinkSetFunk set;
};
/*
* The default detection routine, can be overridden, they call the default
* detection callbacks.
*/
XMLPUBFUN xlinkNodeDetectFunc XMLCALL
xlinkGetDefaultDetect (void);
XMLPUBFUN void XMLCALL
xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
/*
* Routines to set/get the default handlers.
*/
XMLPUBFUN xlinkHandlerPtr XMLCALL
xlinkGetDefaultHandler (void);
XMLPUBFUN void XMLCALL
xlinkSetDefaultHandler (xlinkHandlerPtr handler);
/*
* Link detection module itself.
*/
XMLPUBFUN xlinkType XMLCALL
xlinkIsLink (xmlDocPtr doc,
xmlNodePtr node);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPTR_ENABLED */
#endif /* __XML_XLINK_H__ */

View File

@ -0,0 +1,366 @@
/*
* Summary: interface for the I/O interfaces used by the parser
* Description: interface for the I/O interfaces used by the parser
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_IO_H__
#define __XML_IO_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Those are the functions and datatypes for the parser input
* I/O structures.
*/
/**
* xmlInputMatchCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Input API to detect if the current handler
* can provide input fonctionnalities for this resource.
*
* Returns 1 if yes and 0 if another Input module should be used
*/
typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
/**
* xmlInputOpenCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Input API to open the resource
*
* Returns an Input context or NULL in case or error
*/
typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
/**
* xmlInputReadCallback:
* @context: an Input context
* @buffer: the buffer to store data read
* @len: the length of the buffer in bytes
*
* Callback used in the I/O Input API to read the resource
*
* Returns the number of bytes read or -1 in case of error
*/
typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
/**
* xmlInputCloseCallback:
* @context: an Input context
*
* Callback used in the I/O Input API to close the resource
*
* Returns 0 or -1 in case of error
*/
typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Those are the functions and datatypes for the library output
* I/O structures.
*/
/**
* xmlOutputMatchCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Output API to detect if the current handler
* can provide output fonctionnalities for this resource.
*
* Returns 1 if yes and 0 if another Output module should be used
*/
typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
/**
* xmlOutputOpenCallback:
* @filename: the filename or URI
*
* Callback used in the I/O Output API to open the resource
*
* Returns an Output context or NULL in case or error
*/
typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
/**
* xmlOutputWriteCallback:
* @context: an Output context
* @buffer: the buffer of data to write
* @len: the length of the buffer in bytes
*
* Callback used in the I/O Output API to write to the resource
*
* Returns the number of bytes written or -1 in case of error
*/
typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
int len);
/**
* xmlOutputCloseCallback:
* @context: an Output context
*
* Callback used in the I/O Output API to close the resource
*
* Returns 0 or -1 in case of error
*/
typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef __cplusplus
}
#endif
#include <libxml/globals.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/encoding.h>
#ifdef __cplusplus
extern "C" {
#endif
struct _xmlParserInputBuffer {
void* context;
xmlInputReadCallback readcallback;
xmlInputCloseCallback closecallback;
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */
xmlBufPtr raw; /* if encoder != NULL buffer for raw input */
int compressed; /* -1=unknown, 0=not compressed, 1=compressed */
int error;
unsigned long rawconsumed;/* amount consumed from raw */
};
#ifdef LIBXML_OUTPUT_ENABLED
struct _xmlOutputBuffer {
void* context;
xmlOutputWriteCallback writecallback;
xmlOutputCloseCallback closecallback;
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
xmlBufPtr conv; /* if encoder != NULL buffer for output */
int written; /* total number of byte written */
int error;
};
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for input
*/
XMLPUBFUN void XMLCALL
xmlCleanupInputCallbacks (void);
XMLPUBFUN int XMLCALL
xmlPopInputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultInputCallbacks (void);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlAllocParserInputBuffer (xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFilename (const char *URI,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFile (FILE *file,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateFd (int fd,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateMem (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateStatic (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
xmlCharEncoding enc);
XMLPUBFUN int XMLCALL
xmlParserInputBufferRead (xmlParserInputBufferPtr in,
int len);
XMLPUBFUN int XMLCALL
xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
int len);
XMLPUBFUN int XMLCALL
xmlParserInputBufferPush (xmlParserInputBufferPtr in,
int len,
const char *buf);
XMLPUBFUN void XMLCALL
xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
XMLPUBFUN char * XMLCALL
xmlParserGetDirectory (const char *filename);
XMLPUBFUN int XMLCALL
xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc);
xmlParserInputBufferPtr
__xmlParserInputBufferCreateFilename(const char *URI,
xmlCharEncoding enc);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Interfaces for output
*/
XMLPUBFUN void XMLCALL
xmlCleanupOutputCallbacks (void);
XMLPUBFUN void XMLCALL
xmlRegisterDefaultOutputCallbacks(void);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFilename (const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFile (FILE *file,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateFd (int fd,
xmlCharEncodingHandlerPtr encoder);
XMLPUBFUN xmlOutputBufferPtr XMLCALL
xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
xmlCharEncodingHandlerPtr encoder);
/* Couple of APIs to get the output without digging into the buffers */
XMLPUBFUN const xmlChar * XMLCALL
xmlOutputBufferGetContent (xmlOutputBufferPtr out);
XMLPUBFUN size_t XMLCALL
xmlOutputBufferGetSize (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
xmlOutputBufferWrite (xmlOutputBufferPtr out,
int len,
const char *buf);
XMLPUBFUN int XMLCALL
xmlOutputBufferWriteString (xmlOutputBufferPtr out,
const char *str);
XMLPUBFUN int XMLCALL
xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
const xmlChar *str,
xmlCharEncodingOutputFunc escaping);
XMLPUBFUN int XMLCALL
xmlOutputBufferFlush (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
xmlOutputBufferClose (xmlOutputBufferPtr out);
XMLPUBFUN int XMLCALL
xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc);
xmlOutputBufferPtr
__xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandlerPtr encoder,
int compression);
#ifdef LIBXML_HTTP_ENABLED
/* This function only exists if HTTP support built into the library */
XMLPUBFUN void XMLCALL
xmlRegisterHTTPPostCallbacks (void );
#endif /* LIBXML_HTTP_ENABLED */
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
xmlParserInputPtr ret);
/*
* A predefined entity loader disabling network accesses
*/
XMLPUBFUN xmlParserInputPtr XMLCALL
xmlNoNetExternalEntityLoader (const char *URL,
const char *ID,
xmlParserCtxtPtr ctxt);
/*
* xmlNormalizeWindowsPath is obsolete, don't use it.
* Check xmlCanonicPath in uri.h for a better alternative.
*/
XMLPUBFUN xmlChar * XMLCALL
xmlNormalizeWindowsPath (const xmlChar *path);
XMLPUBFUN int XMLCALL
xmlCheckFilename (const char *path);
/**
* Default 'file://' protocol callbacks
*/
XMLPUBFUN int XMLCALL
xmlFileMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlFileOpen (const char *filename);
XMLPUBFUN int XMLCALL
xmlFileRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlFileClose (void * context);
/**
* Default 'http://' protocol callbacks
*/
#ifdef LIBXML_HTTP_ENABLED
XMLPUBFUN int XMLCALL
xmlIOHTTPMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlIOHTTPOpen (const char *filename);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void * XMLCALL
xmlIOHTTPOpenW (const char * post_uri,
int compression );
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int XMLCALL
xmlIOHTTPRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlIOHTTPClose (void * context);
#endif /* LIBXML_HTTP_ENABLED */
/**
* Default 'ftp://' protocol callbacks
*/
#ifdef LIBXML_FTP_ENABLED
XMLPUBFUN int XMLCALL
xmlIOFTPMatch (const char *filename);
XMLPUBFUN void * XMLCALL
xmlIOFTPOpen (const char *filename);
XMLPUBFUN int XMLCALL
xmlIOFTPRead (void * context,
char * buffer,
int len);
XMLPUBFUN int XMLCALL
xmlIOFTPClose (void * context);
#endif /* LIBXML_FTP_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_IO_H__ */

View File

@ -0,0 +1,146 @@
/*
* Summary: API to build regexp automata
* Description: the API to build regexp automata
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_AUTOMATA_H__
#define __XML_AUTOMATA_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef LIBXML_AUTOMATA_ENABLED
#include <libxml/xmlregexp.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlAutomataPtr:
*
* A libxml automata description, It can be compiled into a regexp
*/
typedef struct _xmlAutomata xmlAutomata;
typedef xmlAutomata *xmlAutomataPtr;
/**
* xmlAutomataStatePtr:
*
* A state int the automata description,
*/
typedef struct _xmlAutomataState xmlAutomataState;
typedef xmlAutomataState *xmlAutomataStatePtr;
/*
* Building API
*/
XMLPUBFUN xmlAutomataPtr XMLCALL
xmlNewAutomata (void);
XMLPUBFUN void XMLCALL
xmlFreeAutomata (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataGetInitState (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
xmlAutomataSetFinalState (xmlAutomataPtr am,
xmlAutomataStatePtr state);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewState (xmlAutomataPtr am);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewTransition (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewTransition2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewNegTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewOnceTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewOnceTrans2 (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
const xmlChar *token,
const xmlChar *token2,
int min,
int max,
void *data);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewAllTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int lax);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewEpsilon (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountedTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter);
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCounterTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
xmlAutomataStatePtr to,
int counter);
XMLPUBFUN int XMLCALL
xmlAutomataNewCounter (xmlAutomataPtr am,
int min,
int max);
XMLPUBFUN xmlRegexpPtr XMLCALL
xmlAutomataCompile (xmlAutomataPtr am);
XMLPUBFUN int XMLCALL
xmlAutomataIsDeterminist (xmlAutomataPtr am);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_AUTOMATA_ENABLED */
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* __XML_AUTOMATA_H__ */

View File

@ -0,0 +1,945 @@
/*
* Summary: error handling
* Description: the API used to report errors
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#include <libxml/parser.h>
#ifndef __XML_ERROR_H__
#define __XML_ERROR_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlErrorLevel:
*
* Indicates the level of an error
*/
typedef enum {
XML_ERR_NONE = 0,
XML_ERR_WARNING = 1, /* A simple warning */
XML_ERR_ERROR = 2, /* A recoverable error */
XML_ERR_FATAL = 3 /* A fatal error */
} xmlErrorLevel;
/**
* xmlErrorDomain:
*
* Indicates where an error may have come from
*/
typedef enum {
XML_FROM_NONE = 0,
XML_FROM_PARSER, /* The XML parser */
XML_FROM_TREE, /* The tree module */
XML_FROM_NAMESPACE, /* The XML Namespace module */
XML_FROM_DTD, /* The XML DTD validation with parser context*/
XML_FROM_HTML, /* The HTML parser */
XML_FROM_MEMORY, /* The memory allocator */
XML_FROM_OUTPUT, /* The serialization code */
XML_FROM_IO, /* The Input/Output stack */
XML_FROM_FTP, /* The FTP module */
XML_FROM_HTTP, /* The HTTP module */
XML_FROM_XINCLUDE, /* The XInclude processing */
XML_FROM_XPATH, /* The XPath module */
XML_FROM_XPOINTER, /* The XPointer module */
XML_FROM_REGEXP, /* The regular expressions module */
XML_FROM_DATATYPE, /* The W3C XML Schemas Datatype module */
XML_FROM_SCHEMASP, /* The W3C XML Schemas parser module */
XML_FROM_SCHEMASV, /* The W3C XML Schemas validation module */
XML_FROM_RELAXNGP, /* The Relax-NG parser module */
XML_FROM_RELAXNGV, /* The Relax-NG validator module */
XML_FROM_CATALOG, /* The Catalog module */
XML_FROM_C14N, /* The Canonicalization module */
XML_FROM_XSLT, /* The XSLT engine from libxslt */
XML_FROM_VALID, /* The XML DTD validation with valid context */
XML_FROM_CHECK, /* The error checking module */
XML_FROM_WRITER, /* The xmlwriter module */
XML_FROM_MODULE, /* The dynamically loaded module module*/
XML_FROM_I18N, /* The module handling character conversion */
XML_FROM_SCHEMATRONV,/* The Schematron validator module */
XML_FROM_BUFFER, /* The buffers module */
XML_FROM_URI /* The URI module */
} xmlErrorDomain;
/**
* xmlError:
*
* An XML Error instance.
*/
typedef struct _xmlError xmlError;
typedef xmlError *xmlErrorPtr;
struct _xmlError {
int domain; /* What part of the library raised this error */
int code; /* The error code, e.g. an xmlParserError */
char *message;/* human-readable informative error message */
xmlErrorLevel level;/* how consequent is the error */
char *file; /* the filename */
int line; /* the line number if available */
char *str1; /* extra string information */
char *str2; /* extra string information */
char *str3; /* extra string information */
int int1; /* extra number information */
int int2; /* error column # or 0 if N/A (todo: rename field when we would brk ABI) */
void *ctxt; /* the parser context if available */
void *node; /* the node in the tree */
};
/**
* xmlParserError:
*
* This is an error that the XML (or HTML) parser can generate
*/
typedef enum {
XML_ERR_OK = 0,
XML_ERR_INTERNAL_ERROR, /* 1 */
XML_ERR_NO_MEMORY, /* 2 */
XML_ERR_DOCUMENT_START, /* 3 */
XML_ERR_DOCUMENT_EMPTY, /* 4 */
XML_ERR_DOCUMENT_END, /* 5 */
XML_ERR_INVALID_HEX_CHARREF, /* 6 */
XML_ERR_INVALID_DEC_CHARREF, /* 7 */
XML_ERR_INVALID_CHARREF, /* 8 */
XML_ERR_INVALID_CHAR, /* 9 */
XML_ERR_CHARREF_AT_EOF, /* 10 */
XML_ERR_CHARREF_IN_PROLOG, /* 11 */
XML_ERR_CHARREF_IN_EPILOG, /* 12 */
XML_ERR_CHARREF_IN_DTD, /* 13 */
XML_ERR_ENTITYREF_AT_EOF, /* 14 */
XML_ERR_ENTITYREF_IN_PROLOG, /* 15 */
XML_ERR_ENTITYREF_IN_EPILOG, /* 16 */
XML_ERR_ENTITYREF_IN_DTD, /* 17 */
XML_ERR_PEREF_AT_EOF, /* 18 */
XML_ERR_PEREF_IN_PROLOG, /* 19 */
XML_ERR_PEREF_IN_EPILOG, /* 20 */
XML_ERR_PEREF_IN_INT_SUBSET, /* 21 */
XML_ERR_ENTITYREF_NO_NAME, /* 22 */
XML_ERR_ENTITYREF_SEMICOL_MISSING, /* 23 */
XML_ERR_PEREF_NO_NAME, /* 24 */
XML_ERR_PEREF_SEMICOL_MISSING, /* 25 */
XML_ERR_UNDECLARED_ENTITY, /* 26 */
XML_WAR_UNDECLARED_ENTITY, /* 27 */
XML_ERR_UNPARSED_ENTITY, /* 28 */
XML_ERR_ENTITY_IS_EXTERNAL, /* 29 */
XML_ERR_ENTITY_IS_PARAMETER, /* 30 */
XML_ERR_UNKNOWN_ENCODING, /* 31 */
XML_ERR_UNSUPPORTED_ENCODING, /* 32 */
XML_ERR_STRING_NOT_STARTED, /* 33 */
XML_ERR_STRING_NOT_CLOSED, /* 34 */
XML_ERR_NS_DECL_ERROR, /* 35 */
XML_ERR_ENTITY_NOT_STARTED, /* 36 */
XML_ERR_ENTITY_NOT_FINISHED, /* 37 */
XML_ERR_LT_IN_ATTRIBUTE, /* 38 */
XML_ERR_ATTRIBUTE_NOT_STARTED, /* 39 */
XML_ERR_ATTRIBUTE_NOT_FINISHED, /* 40 */
XML_ERR_ATTRIBUTE_WITHOUT_VALUE, /* 41 */
XML_ERR_ATTRIBUTE_REDEFINED, /* 42 */
XML_ERR_LITERAL_NOT_STARTED, /* 43 */
XML_ERR_LITERAL_NOT_FINISHED, /* 44 */
XML_ERR_COMMENT_NOT_FINISHED, /* 45 */
XML_ERR_PI_NOT_STARTED, /* 46 */
XML_ERR_PI_NOT_FINISHED, /* 47 */
XML_ERR_NOTATION_NOT_STARTED, /* 48 */
XML_ERR_NOTATION_NOT_FINISHED, /* 49 */
XML_ERR_ATTLIST_NOT_STARTED, /* 50 */
XML_ERR_ATTLIST_NOT_FINISHED, /* 51 */
XML_ERR_MIXED_NOT_STARTED, /* 52 */
XML_ERR_MIXED_NOT_FINISHED, /* 53 */
XML_ERR_ELEMCONTENT_NOT_STARTED, /* 54 */
XML_ERR_ELEMCONTENT_NOT_FINISHED, /* 55 */
XML_ERR_XMLDECL_NOT_STARTED, /* 56 */
XML_ERR_XMLDECL_NOT_FINISHED, /* 57 */
XML_ERR_CONDSEC_NOT_STARTED, /* 58 */
XML_ERR_CONDSEC_NOT_FINISHED, /* 59 */
XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 60 */
XML_ERR_DOCTYPE_NOT_FINISHED, /* 61 */
XML_ERR_MISPLACED_CDATA_END, /* 62 */
XML_ERR_CDATA_NOT_FINISHED, /* 63 */
XML_ERR_RESERVED_XML_NAME, /* 64 */
XML_ERR_SPACE_REQUIRED, /* 65 */
XML_ERR_SEPARATOR_REQUIRED, /* 66 */
XML_ERR_NMTOKEN_REQUIRED, /* 67 */
XML_ERR_NAME_REQUIRED, /* 68 */
XML_ERR_PCDATA_REQUIRED, /* 69 */
XML_ERR_URI_REQUIRED, /* 70 */
XML_ERR_PUBID_REQUIRED, /* 71 */
XML_ERR_LT_REQUIRED, /* 72 */
XML_ERR_GT_REQUIRED, /* 73 */
XML_ERR_LTSLASH_REQUIRED, /* 74 */
XML_ERR_EQUAL_REQUIRED, /* 75 */
XML_ERR_TAG_NAME_MISMATCH, /* 76 */
XML_ERR_TAG_NOT_FINISHED, /* 77 */
XML_ERR_STANDALONE_VALUE, /* 78 */
XML_ERR_ENCODING_NAME, /* 79 */
XML_ERR_HYPHEN_IN_COMMENT, /* 80 */
XML_ERR_INVALID_ENCODING, /* 81 */
XML_ERR_EXT_ENTITY_STANDALONE, /* 82 */
XML_ERR_CONDSEC_INVALID, /* 83 */
XML_ERR_VALUE_REQUIRED, /* 84 */
XML_ERR_NOT_WELL_BALANCED, /* 85 */
XML_ERR_EXTRA_CONTENT, /* 86 */
XML_ERR_ENTITY_CHAR_ERROR, /* 87 */
XML_ERR_ENTITY_PE_INTERNAL, /* 88 */
XML_ERR_ENTITY_LOOP, /* 89 */
XML_ERR_ENTITY_BOUNDARY, /* 90 */
XML_ERR_INVALID_URI, /* 91 */
XML_ERR_URI_FRAGMENT, /* 92 */
XML_WAR_CATALOG_PI, /* 93 */
XML_ERR_NO_DTD, /* 94 */
XML_ERR_CONDSEC_INVALID_KEYWORD, /* 95 */
XML_ERR_VERSION_MISSING, /* 96 */
XML_WAR_UNKNOWN_VERSION, /* 97 */
XML_WAR_LANG_VALUE, /* 98 */
XML_WAR_NS_URI, /* 99 */
XML_WAR_NS_URI_RELATIVE, /* 100 */
XML_ERR_MISSING_ENCODING, /* 101 */
XML_WAR_SPACE_VALUE, /* 102 */
XML_ERR_NOT_STANDALONE, /* 103 */
XML_ERR_ENTITY_PROCESSING, /* 104 */
XML_ERR_NOTATION_PROCESSING, /* 105 */
XML_WAR_NS_COLUMN, /* 106 */
XML_WAR_ENTITY_REDEFINED, /* 107 */
XML_ERR_UNKNOWN_VERSION, /* 108 */
XML_ERR_VERSION_MISMATCH, /* 109 */
XML_ERR_NAME_TOO_LONG, /* 110 */
XML_ERR_USER_STOP, /* 111 */
XML_NS_ERR_XML_NAMESPACE = 200,
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
XML_NS_ERR_QNAME, /* 202 */
XML_NS_ERR_ATTRIBUTE_REDEFINED, /* 203 */
XML_NS_ERR_EMPTY, /* 204 */
XML_NS_ERR_COLON, /* 205 */
XML_DTD_ATTRIBUTE_DEFAULT = 500,
XML_DTD_ATTRIBUTE_REDEFINED, /* 501 */
XML_DTD_ATTRIBUTE_VALUE, /* 502 */
XML_DTD_CONTENT_ERROR, /* 503 */
XML_DTD_CONTENT_MODEL, /* 504 */
XML_DTD_CONTENT_NOT_DETERMINIST, /* 505 */
XML_DTD_DIFFERENT_PREFIX, /* 506 */
XML_DTD_ELEM_DEFAULT_NAMESPACE, /* 507 */
XML_DTD_ELEM_NAMESPACE, /* 508 */
XML_DTD_ELEM_REDEFINED, /* 509 */
XML_DTD_EMPTY_NOTATION, /* 510 */
XML_DTD_ENTITY_TYPE, /* 511 */
XML_DTD_ID_FIXED, /* 512 */
XML_DTD_ID_REDEFINED, /* 513 */
XML_DTD_ID_SUBSET, /* 514 */
XML_DTD_INVALID_CHILD, /* 515 */
XML_DTD_INVALID_DEFAULT, /* 516 */
XML_DTD_LOAD_ERROR, /* 517 */
XML_DTD_MISSING_ATTRIBUTE, /* 518 */
XML_DTD_MIXED_CORRUPT, /* 519 */
XML_DTD_MULTIPLE_ID, /* 520 */
XML_DTD_NO_DOC, /* 521 */
XML_DTD_NO_DTD, /* 522 */
XML_DTD_NO_ELEM_NAME, /* 523 */
XML_DTD_NO_PREFIX, /* 524 */
XML_DTD_NO_ROOT, /* 525 */
XML_DTD_NOTATION_REDEFINED, /* 526 */
XML_DTD_NOTATION_VALUE, /* 527 */
XML_DTD_NOT_EMPTY, /* 528 */
XML_DTD_NOT_PCDATA, /* 529 */
XML_DTD_NOT_STANDALONE, /* 530 */
XML_DTD_ROOT_NAME, /* 531 */
XML_DTD_STANDALONE_WHITE_SPACE, /* 532 */
XML_DTD_UNKNOWN_ATTRIBUTE, /* 533 */
XML_DTD_UNKNOWN_ELEM, /* 534 */
XML_DTD_UNKNOWN_ENTITY, /* 535 */
XML_DTD_UNKNOWN_ID, /* 536 */
XML_DTD_UNKNOWN_NOTATION, /* 537 */
XML_DTD_STANDALONE_DEFAULTED, /* 538 */
XML_DTD_XMLID_VALUE, /* 539 */
XML_DTD_XMLID_TYPE, /* 540 */
XML_DTD_DUP_TOKEN, /* 541 */
XML_HTML_STRUCURE_ERROR = 800,
XML_HTML_UNKNOWN_TAG, /* 801 */
XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000,
XML_RNGP_ATTR_CONFLICT, /* 1001 */
XML_RNGP_ATTRIBUTE_CHILDREN, /* 1002 */
XML_RNGP_ATTRIBUTE_CONTENT, /* 1003 */
XML_RNGP_ATTRIBUTE_EMPTY, /* 1004 */
XML_RNGP_ATTRIBUTE_NOOP, /* 1005 */
XML_RNGP_CHOICE_CONTENT, /* 1006 */
XML_RNGP_CHOICE_EMPTY, /* 1007 */
XML_RNGP_CREATE_FAILURE, /* 1008 */
XML_RNGP_DATA_CONTENT, /* 1009 */
XML_RNGP_DEF_CHOICE_AND_INTERLEAVE, /* 1010 */
XML_RNGP_DEFINE_CREATE_FAILED, /* 1011 */
XML_RNGP_DEFINE_EMPTY, /* 1012 */
XML_RNGP_DEFINE_MISSING, /* 1013 */
XML_RNGP_DEFINE_NAME_MISSING, /* 1014 */
XML_RNGP_ELEM_CONTENT_EMPTY, /* 1015 */
XML_RNGP_ELEM_CONTENT_ERROR, /* 1016 */
XML_RNGP_ELEMENT_EMPTY, /* 1017 */
XML_RNGP_ELEMENT_CONTENT, /* 1018 */
XML_RNGP_ELEMENT_NAME, /* 1019 */
XML_RNGP_ELEMENT_NO_CONTENT, /* 1020 */
XML_RNGP_ELEM_TEXT_CONFLICT, /* 1021 */
XML_RNGP_EMPTY, /* 1022 */
XML_RNGP_EMPTY_CONSTRUCT, /* 1023 */
XML_RNGP_EMPTY_CONTENT, /* 1024 */
XML_RNGP_EMPTY_NOT_EMPTY, /* 1025 */
XML_RNGP_ERROR_TYPE_LIB, /* 1026 */
XML_RNGP_EXCEPT_EMPTY, /* 1027 */
XML_RNGP_EXCEPT_MISSING, /* 1028 */
XML_RNGP_EXCEPT_MULTIPLE, /* 1029 */
XML_RNGP_EXCEPT_NO_CONTENT, /* 1030 */
XML_RNGP_EXTERNALREF_EMTPY, /* 1031 */
XML_RNGP_EXTERNAL_REF_FAILURE, /* 1032 */
XML_RNGP_EXTERNALREF_RECURSE, /* 1033 */
XML_RNGP_FORBIDDEN_ATTRIBUTE, /* 1034 */
XML_RNGP_FOREIGN_ELEMENT, /* 1035 */
XML_RNGP_GRAMMAR_CONTENT, /* 1036 */
XML_RNGP_GRAMMAR_EMPTY, /* 1037 */
XML_RNGP_GRAMMAR_MISSING, /* 1038 */
XML_RNGP_GRAMMAR_NO_START, /* 1039 */
XML_RNGP_GROUP_ATTR_CONFLICT, /* 1040 */
XML_RNGP_HREF_ERROR, /* 1041 */
XML_RNGP_INCLUDE_EMPTY, /* 1042 */
XML_RNGP_INCLUDE_FAILURE, /* 1043 */
XML_RNGP_INCLUDE_RECURSE, /* 1044 */
XML_RNGP_INTERLEAVE_ADD, /* 1045 */
XML_RNGP_INTERLEAVE_CREATE_FAILED, /* 1046 */
XML_RNGP_INTERLEAVE_EMPTY, /* 1047 */
XML_RNGP_INTERLEAVE_NO_CONTENT, /* 1048 */
XML_RNGP_INVALID_DEFINE_NAME, /* 1049 */
XML_RNGP_INVALID_URI, /* 1050 */
XML_RNGP_INVALID_VALUE, /* 1051 */
XML_RNGP_MISSING_HREF, /* 1052 */
XML_RNGP_NAME_MISSING, /* 1053 */
XML_RNGP_NEED_COMBINE, /* 1054 */
XML_RNGP_NOTALLOWED_NOT_EMPTY, /* 1055 */
XML_RNGP_NSNAME_ATTR_ANCESTOR, /* 1056 */
XML_RNGP_NSNAME_NO_NS, /* 1057 */
XML_RNGP_PARAM_FORBIDDEN, /* 1058 */
XML_RNGP_PARAM_NAME_MISSING, /* 1059 */
XML_RNGP_PARENTREF_CREATE_FAILED, /* 1060 */
XML_RNGP_PARENTREF_NAME_INVALID, /* 1061 */
XML_RNGP_PARENTREF_NO_NAME, /* 1062 */
XML_RNGP_PARENTREF_NO_PARENT, /* 1063 */
XML_RNGP_PARENTREF_NOT_EMPTY, /* 1064 */
XML_RNGP_PARSE_ERROR, /* 1065 */
XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME, /* 1066 */
XML_RNGP_PAT_ATTR_ATTR, /* 1067 */
XML_RNGP_PAT_ATTR_ELEM, /* 1068 */
XML_RNGP_PAT_DATA_EXCEPT_ATTR, /* 1069 */
XML_RNGP_PAT_DATA_EXCEPT_ELEM, /* 1070 */
XML_RNGP_PAT_DATA_EXCEPT_EMPTY, /* 1071 */
XML_RNGP_PAT_DATA_EXCEPT_GROUP, /* 1072 */
XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE, /* 1073 */
XML_RNGP_PAT_DATA_EXCEPT_LIST, /* 1074 */
XML_RNGP_PAT_DATA_EXCEPT_ONEMORE, /* 1075 */
XML_RNGP_PAT_DATA_EXCEPT_REF, /* 1076 */
XML_RNGP_PAT_DATA_EXCEPT_TEXT, /* 1077 */
XML_RNGP_PAT_LIST_ATTR, /* 1078 */
XML_RNGP_PAT_LIST_ELEM, /* 1079 */
XML_RNGP_PAT_LIST_INTERLEAVE, /* 1080 */
XML_RNGP_PAT_LIST_LIST, /* 1081 */
XML_RNGP_PAT_LIST_REF, /* 1082 */
XML_RNGP_PAT_LIST_TEXT, /* 1083 */
XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME, /* 1084 */
XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME, /* 1085 */
XML_RNGP_PAT_ONEMORE_GROUP_ATTR, /* 1086 */
XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR, /* 1087 */
XML_RNGP_PAT_START_ATTR, /* 1088 */
XML_RNGP_PAT_START_DATA, /* 1089 */
XML_RNGP_PAT_START_EMPTY, /* 1090 */
XML_RNGP_PAT_START_GROUP, /* 1091 */
XML_RNGP_PAT_START_INTERLEAVE, /* 1092 */
XML_RNGP_PAT_START_LIST, /* 1093 */
XML_RNGP_PAT_START_ONEMORE, /* 1094 */
XML_RNGP_PAT_START_TEXT, /* 1095 */
XML_RNGP_PAT_START_VALUE, /* 1096 */
XML_RNGP_PREFIX_UNDEFINED, /* 1097 */
XML_RNGP_REF_CREATE_FAILED, /* 1098 */
XML_RNGP_REF_CYCLE, /* 1099 */
XML_RNGP_REF_NAME_INVALID, /* 1100 */
XML_RNGP_REF_NO_DEF, /* 1101 */
XML_RNGP_REF_NO_NAME, /* 1102 */
XML_RNGP_REF_NOT_EMPTY, /* 1103 */
XML_RNGP_START_CHOICE_AND_INTERLEAVE, /* 1104 */
XML_RNGP_START_CONTENT, /* 1105 */
XML_RNGP_START_EMPTY, /* 1106 */
XML_RNGP_START_MISSING, /* 1107 */
XML_RNGP_TEXT_EXPECTED, /* 1108 */
XML_RNGP_TEXT_HAS_CHILD, /* 1109 */
XML_RNGP_TYPE_MISSING, /* 1110 */
XML_RNGP_TYPE_NOT_FOUND, /* 1111 */
XML_RNGP_TYPE_VALUE, /* 1112 */
XML_RNGP_UNKNOWN_ATTRIBUTE, /* 1113 */
XML_RNGP_UNKNOWN_COMBINE, /* 1114 */
XML_RNGP_UNKNOWN_CONSTRUCT, /* 1115 */
XML_RNGP_UNKNOWN_TYPE_LIB, /* 1116 */
XML_RNGP_URI_FRAGMENT, /* 1117 */
XML_RNGP_URI_NOT_ABSOLUTE, /* 1118 */
XML_RNGP_VALUE_EMPTY, /* 1119 */
XML_RNGP_VALUE_NO_CONTENT, /* 1120 */
XML_RNGP_XMLNS_NAME, /* 1121 */
XML_RNGP_XML_NS, /* 1122 */
XML_XPATH_EXPRESSION_OK = 1200,
XML_XPATH_NUMBER_ERROR, /* 1201 */
XML_XPATH_UNFINISHED_LITERAL_ERROR, /* 1202 */
XML_XPATH_START_LITERAL_ERROR, /* 1203 */
XML_XPATH_VARIABLE_REF_ERROR, /* 1204 */
XML_XPATH_UNDEF_VARIABLE_ERROR, /* 1205 */
XML_XPATH_INVALID_PREDICATE_ERROR, /* 1206 */
XML_XPATH_EXPR_ERROR, /* 1207 */
XML_XPATH_UNCLOSED_ERROR, /* 1208 */
XML_XPATH_UNKNOWN_FUNC_ERROR, /* 1209 */
XML_XPATH_INVALID_OPERAND, /* 1210 */
XML_XPATH_INVALID_TYPE, /* 1211 */
XML_XPATH_INVALID_ARITY, /* 1212 */
XML_XPATH_INVALID_CTXT_SIZE, /* 1213 */
XML_XPATH_INVALID_CTXT_POSITION, /* 1214 */
XML_XPATH_MEMORY_ERROR, /* 1215 */
XML_XPTR_SYNTAX_ERROR, /* 1216 */
XML_XPTR_RESOURCE_ERROR, /* 1217 */
XML_XPTR_SUB_RESOURCE_ERROR, /* 1218 */
XML_XPATH_UNDEF_PREFIX_ERROR, /* 1219 */
XML_XPATH_ENCODING_ERROR, /* 1220 */
XML_XPATH_INVALID_CHAR_ERROR, /* 1221 */
XML_TREE_INVALID_HEX = 1300,
XML_TREE_INVALID_DEC, /* 1301 */
XML_TREE_UNTERMINATED_ENTITY, /* 1302 */
XML_TREE_NOT_UTF8, /* 1303 */
XML_SAVE_NOT_UTF8 = 1400,
XML_SAVE_CHAR_INVALID, /* 1401 */
XML_SAVE_NO_DOCTYPE, /* 1402 */
XML_SAVE_UNKNOWN_ENCODING, /* 1403 */
XML_REGEXP_COMPILE_ERROR = 1450,
XML_IO_UNKNOWN = 1500,
XML_IO_EACCES, /* 1501 */
XML_IO_EAGAIN, /* 1502 */
XML_IO_EBADF, /* 1503 */
XML_IO_EBADMSG, /* 1504 */
XML_IO_EBUSY, /* 1505 */
XML_IO_ECANCELED, /* 1506 */
XML_IO_ECHILD, /* 1507 */
XML_IO_EDEADLK, /* 1508 */
XML_IO_EDOM, /* 1509 */
XML_IO_EEXIST, /* 1510 */
XML_IO_EFAULT, /* 1511 */
XML_IO_EFBIG, /* 1512 */
XML_IO_EINPROGRESS, /* 1513 */
XML_IO_EINTR, /* 1514 */
XML_IO_EINVAL, /* 1515 */
XML_IO_EIO, /* 1516 */
XML_IO_EISDIR, /* 1517 */
XML_IO_EMFILE, /* 1518 */
XML_IO_EMLINK, /* 1519 */
XML_IO_EMSGSIZE, /* 1520 */
XML_IO_ENAMETOOLONG, /* 1521 */
XML_IO_ENFILE, /* 1522 */
XML_IO_ENODEV, /* 1523 */
XML_IO_ENOENT, /* 1524 */
XML_IO_ENOEXEC, /* 1525 */
XML_IO_ENOLCK, /* 1526 */
XML_IO_ENOMEM, /* 1527 */
XML_IO_ENOSPC, /* 1528 */
XML_IO_ENOSYS, /* 1529 */
XML_IO_ENOTDIR, /* 1530 */
XML_IO_ENOTEMPTY, /* 1531 */
XML_IO_ENOTSUP, /* 1532 */
XML_IO_ENOTTY, /* 1533 */
XML_IO_ENXIO, /* 1534 */
XML_IO_EPERM, /* 1535 */
XML_IO_EPIPE, /* 1536 */
XML_IO_ERANGE, /* 1537 */
XML_IO_EROFS, /* 1538 */
XML_IO_ESPIPE, /* 1539 */
XML_IO_ESRCH, /* 1540 */
XML_IO_ETIMEDOUT, /* 1541 */
XML_IO_EXDEV, /* 1542 */
XML_IO_NETWORK_ATTEMPT, /* 1543 */
XML_IO_ENCODER, /* 1544 */
XML_IO_FLUSH, /* 1545 */
XML_IO_WRITE, /* 1546 */
XML_IO_NO_INPUT, /* 1547 */
XML_IO_BUFFER_FULL, /* 1548 */
XML_IO_LOAD_ERROR, /* 1549 */
XML_IO_ENOTSOCK, /* 1550 */
XML_IO_EISCONN, /* 1551 */
XML_IO_ECONNREFUSED, /* 1552 */
XML_IO_ENETUNREACH, /* 1553 */
XML_IO_EADDRINUSE, /* 1554 */
XML_IO_EALREADY, /* 1555 */
XML_IO_EAFNOSUPPORT, /* 1556 */
XML_XINCLUDE_RECURSION=1600,
XML_XINCLUDE_PARSE_VALUE, /* 1601 */
XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */
XML_XINCLUDE_NO_HREF, /* 1603 */
XML_XINCLUDE_NO_FALLBACK, /* 1604 */
XML_XINCLUDE_HREF_URI, /* 1605 */
XML_XINCLUDE_TEXT_FRAGMENT, /* 1606 */
XML_XINCLUDE_TEXT_DOCUMENT, /* 1607 */
XML_XINCLUDE_INVALID_CHAR, /* 1608 */
XML_XINCLUDE_BUILD_FAILED, /* 1609 */
XML_XINCLUDE_UNKNOWN_ENCODING, /* 1610 */
XML_XINCLUDE_MULTIPLE_ROOT, /* 1611 */
XML_XINCLUDE_XPTR_FAILED, /* 1612 */
XML_XINCLUDE_XPTR_RESULT, /* 1613 */
XML_XINCLUDE_INCLUDE_IN_INCLUDE, /* 1614 */
XML_XINCLUDE_FALLBACKS_IN_INCLUDE, /* 1615 */
XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE, /* 1616 */
XML_XINCLUDE_DEPRECATED_NS, /* 1617 */
XML_XINCLUDE_FRAGMENT_ID, /* 1618 */
XML_CATALOG_MISSING_ATTR = 1650,
XML_CATALOG_ENTRY_BROKEN, /* 1651 */
XML_CATALOG_PREFER_VALUE, /* 1652 */
XML_CATALOG_NOT_CATALOG, /* 1653 */
XML_CATALOG_RECURSION, /* 1654 */
XML_SCHEMAP_PREFIX_UNDEFINED = 1700,
XML_SCHEMAP_ATTRFORMDEFAULT_VALUE, /* 1701 */
XML_SCHEMAP_ATTRGRP_NONAME_NOREF, /* 1702 */
XML_SCHEMAP_ATTR_NONAME_NOREF, /* 1703 */
XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF, /* 1704 */
XML_SCHEMAP_ELEMFORMDEFAULT_VALUE, /* 1705 */
XML_SCHEMAP_ELEM_NONAME_NOREF, /* 1706 */
XML_SCHEMAP_EXTENSION_NO_BASE, /* 1707 */
XML_SCHEMAP_FACET_NO_VALUE, /* 1708 */
XML_SCHEMAP_FAILED_BUILD_IMPORT, /* 1709 */
XML_SCHEMAP_GROUP_NONAME_NOREF, /* 1710 */
XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI, /* 1711 */
XML_SCHEMAP_IMPORT_REDEFINE_NSNAME, /* 1712 */
XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI, /* 1713 */
XML_SCHEMAP_INVALID_BOOLEAN, /* 1714 */
XML_SCHEMAP_INVALID_ENUM, /* 1715 */
XML_SCHEMAP_INVALID_FACET, /* 1716 */
XML_SCHEMAP_INVALID_FACET_VALUE, /* 1717 */
XML_SCHEMAP_INVALID_MAXOCCURS, /* 1718 */
XML_SCHEMAP_INVALID_MINOCCURS, /* 1719 */
XML_SCHEMAP_INVALID_REF_AND_SUBTYPE, /* 1720 */
XML_SCHEMAP_INVALID_WHITE_SPACE, /* 1721 */
XML_SCHEMAP_NOATTR_NOREF, /* 1722 */
XML_SCHEMAP_NOTATION_NO_NAME, /* 1723 */
XML_SCHEMAP_NOTYPE_NOREF, /* 1724 */
XML_SCHEMAP_REF_AND_SUBTYPE, /* 1725 */
XML_SCHEMAP_RESTRICTION_NONAME_NOREF, /* 1726 */
XML_SCHEMAP_SIMPLETYPE_NONAME, /* 1727 */
XML_SCHEMAP_TYPE_AND_SUBTYPE, /* 1728 */
XML_SCHEMAP_UNKNOWN_ALL_CHILD, /* 1729 */
XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD, /* 1730 */
XML_SCHEMAP_UNKNOWN_ATTR_CHILD, /* 1731 */
XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD, /* 1732 */
XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP, /* 1733 */
XML_SCHEMAP_UNKNOWN_BASE_TYPE, /* 1734 */
XML_SCHEMAP_UNKNOWN_CHOICE_CHILD, /* 1735 */
XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD, /* 1736 */
XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD, /* 1737 */
XML_SCHEMAP_UNKNOWN_ELEM_CHILD, /* 1738 */
XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD, /* 1739 */
XML_SCHEMAP_UNKNOWN_FACET_CHILD, /* 1740 */
XML_SCHEMAP_UNKNOWN_FACET_TYPE, /* 1741 */
XML_SCHEMAP_UNKNOWN_GROUP_CHILD, /* 1742 */
XML_SCHEMAP_UNKNOWN_IMPORT_CHILD, /* 1743 */
XML_SCHEMAP_UNKNOWN_LIST_CHILD, /* 1744 */
XML_SCHEMAP_UNKNOWN_NOTATION_CHILD, /* 1745 */
XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD, /* 1746 */
XML_SCHEMAP_UNKNOWN_REF, /* 1747 */
XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD, /* 1748 */
XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD, /* 1749 */
XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD, /* 1750 */
XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD, /* 1751 */
XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD, /* 1752 */
XML_SCHEMAP_UNKNOWN_TYPE, /* 1753 */
XML_SCHEMAP_UNKNOWN_UNION_CHILD, /* 1754 */
XML_SCHEMAP_ELEM_DEFAULT_FIXED, /* 1755 */
XML_SCHEMAP_REGEXP_INVALID, /* 1756 */
XML_SCHEMAP_FAILED_LOAD, /* 1757 */
XML_SCHEMAP_NOTHING_TO_PARSE, /* 1758 */
XML_SCHEMAP_NOROOT, /* 1759 */
XML_SCHEMAP_REDEFINED_GROUP, /* 1760 */
XML_SCHEMAP_REDEFINED_TYPE, /* 1761 */
XML_SCHEMAP_REDEFINED_ELEMENT, /* 1762 */
XML_SCHEMAP_REDEFINED_ATTRGROUP, /* 1763 */
XML_SCHEMAP_REDEFINED_ATTR, /* 1764 */
XML_SCHEMAP_REDEFINED_NOTATION, /* 1765 */
XML_SCHEMAP_FAILED_PARSE, /* 1766 */
XML_SCHEMAP_UNKNOWN_PREFIX, /* 1767 */
XML_SCHEMAP_DEF_AND_PREFIX, /* 1768 */
XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD, /* 1769 */
XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI, /* 1770 */
XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI, /* 1771 */
XML_SCHEMAP_NOT_SCHEMA, /* 1772 */
XML_SCHEMAP_UNKNOWN_MEMBER_TYPE, /* 1773 */
XML_SCHEMAP_INVALID_ATTR_USE, /* 1774 */
XML_SCHEMAP_RECURSIVE, /* 1775 */
XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE, /* 1776 */
XML_SCHEMAP_INVALID_ATTR_COMBINATION, /* 1777 */
XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION, /* 1778 */
XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD, /* 1779 */
XML_SCHEMAP_INVALID_ATTR_NAME, /* 1780 */
XML_SCHEMAP_REF_AND_CONTENT, /* 1781 */
XML_SCHEMAP_CT_PROPS_CORRECT_1, /* 1782 */
XML_SCHEMAP_CT_PROPS_CORRECT_2, /* 1783 */
XML_SCHEMAP_CT_PROPS_CORRECT_3, /* 1784 */
XML_SCHEMAP_CT_PROPS_CORRECT_4, /* 1785 */
XML_SCHEMAP_CT_PROPS_CORRECT_5, /* 1786 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1, /* 1787 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1, /* 1788 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2, /* 1789 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2, /* 1790 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3, /* 1791 */
XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER, /* 1792 */
XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE, /* 1793 */
XML_SCHEMAP_UNION_NOT_EXPRESSIBLE, /* 1794 */
XML_SCHEMAP_SRC_IMPORT_3_1, /* 1795 */
XML_SCHEMAP_SRC_IMPORT_3_2, /* 1796 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1, /* 1797 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2, /* 1798 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3, /* 1799 */
XML_SCHEMAP_COS_CT_EXTENDS_1_3, /* 1800 */
XML_SCHEMAV_NOROOT = 1801,
XML_SCHEMAV_UNDECLAREDELEM, /* 1802 */
XML_SCHEMAV_NOTTOPLEVEL, /* 1803 */
XML_SCHEMAV_MISSING, /* 1804 */
XML_SCHEMAV_WRONGELEM, /* 1805 */
XML_SCHEMAV_NOTYPE, /* 1806 */
XML_SCHEMAV_NOROLLBACK, /* 1807 */
XML_SCHEMAV_ISABSTRACT, /* 1808 */
XML_SCHEMAV_NOTEMPTY, /* 1809 */
XML_SCHEMAV_ELEMCONT, /* 1810 */
XML_SCHEMAV_HAVEDEFAULT, /* 1811 */
XML_SCHEMAV_NOTNILLABLE, /* 1812 */
XML_SCHEMAV_EXTRACONTENT, /* 1813 */
XML_SCHEMAV_INVALIDATTR, /* 1814 */
XML_SCHEMAV_INVALIDELEM, /* 1815 */
XML_SCHEMAV_NOTDETERMINIST, /* 1816 */
XML_SCHEMAV_CONSTRUCT, /* 1817 */
XML_SCHEMAV_INTERNAL, /* 1818 */
XML_SCHEMAV_NOTSIMPLE, /* 1819 */
XML_SCHEMAV_ATTRUNKNOWN, /* 1820 */
XML_SCHEMAV_ATTRINVALID, /* 1821 */
XML_SCHEMAV_VALUE, /* 1822 */
XML_SCHEMAV_FACET, /* 1823 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1, /* 1824 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2, /* 1825 */
XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3, /* 1826 */
XML_SCHEMAV_CVC_TYPE_3_1_1, /* 1827 */
XML_SCHEMAV_CVC_TYPE_3_1_2, /* 1828 */
XML_SCHEMAV_CVC_FACET_VALID, /* 1829 */
XML_SCHEMAV_CVC_LENGTH_VALID, /* 1830 */
XML_SCHEMAV_CVC_MINLENGTH_VALID, /* 1831 */
XML_SCHEMAV_CVC_MAXLENGTH_VALID, /* 1832 */
XML_SCHEMAV_CVC_MININCLUSIVE_VALID, /* 1833 */
XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID, /* 1834 */
XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID, /* 1835 */
XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID, /* 1836 */
XML_SCHEMAV_CVC_TOTALDIGITS_VALID, /* 1837 */
XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID, /* 1838 */
XML_SCHEMAV_CVC_PATTERN_VALID, /* 1839 */
XML_SCHEMAV_CVC_ENUMERATION_VALID, /* 1840 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1, /* 1841 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2, /* 1842 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3, /* 1843 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4, /* 1844 */
XML_SCHEMAV_CVC_ELT_1, /* 1845 */
XML_SCHEMAV_CVC_ELT_2, /* 1846 */
XML_SCHEMAV_CVC_ELT_3_1, /* 1847 */
XML_SCHEMAV_CVC_ELT_3_2_1, /* 1848 */
XML_SCHEMAV_CVC_ELT_3_2_2, /* 1849 */
XML_SCHEMAV_CVC_ELT_4_1, /* 1850 */
XML_SCHEMAV_CVC_ELT_4_2, /* 1851 */
XML_SCHEMAV_CVC_ELT_4_3, /* 1852 */
XML_SCHEMAV_CVC_ELT_5_1_1, /* 1853 */
XML_SCHEMAV_CVC_ELT_5_1_2, /* 1854 */
XML_SCHEMAV_CVC_ELT_5_2_1, /* 1855 */
XML_SCHEMAV_CVC_ELT_5_2_2_1, /* 1856 */
XML_SCHEMAV_CVC_ELT_5_2_2_2_1, /* 1857 */
XML_SCHEMAV_CVC_ELT_5_2_2_2_2, /* 1858 */
XML_SCHEMAV_CVC_ELT_6, /* 1859 */
XML_SCHEMAV_CVC_ELT_7, /* 1860 */
XML_SCHEMAV_CVC_ATTRIBUTE_1, /* 1861 */
XML_SCHEMAV_CVC_ATTRIBUTE_2, /* 1862 */
XML_SCHEMAV_CVC_ATTRIBUTE_3, /* 1863 */
XML_SCHEMAV_CVC_ATTRIBUTE_4, /* 1864 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1, /* 1865 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1, /* 1866 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2, /* 1867 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_4, /* 1868 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1, /* 1869 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2, /* 1870 */
XML_SCHEMAV_ELEMENT_CONTENT, /* 1871 */
XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING, /* 1872 */
XML_SCHEMAV_CVC_COMPLEX_TYPE_1, /* 1873 */
XML_SCHEMAV_CVC_AU, /* 1874 */
XML_SCHEMAV_CVC_TYPE_1, /* 1875 */
XML_SCHEMAV_CVC_TYPE_2, /* 1876 */
XML_SCHEMAV_CVC_IDC, /* 1877 */
XML_SCHEMAV_CVC_WILDCARD, /* 1878 */
XML_SCHEMAV_MISC, /* 1879 */
XML_XPTR_UNKNOWN_SCHEME = 1900,
XML_XPTR_CHILDSEQ_START, /* 1901 */
XML_XPTR_EVAL_FAILED, /* 1902 */
XML_XPTR_EXTRA_OBJECTS, /* 1903 */
XML_C14N_CREATE_CTXT = 1950,
XML_C14N_REQUIRES_UTF8, /* 1951 */
XML_C14N_CREATE_STACK, /* 1952 */
XML_C14N_INVALID_NODE, /* 1953 */
XML_C14N_UNKNOW_NODE, /* 1954 */
XML_C14N_RELATIVE_NAMESPACE, /* 1955 */
XML_FTP_PASV_ANSWER = 2000,
XML_FTP_EPSV_ANSWER, /* 2001 */
XML_FTP_ACCNT, /* 2002 */
XML_FTP_URL_SYNTAX, /* 2003 */
XML_HTTP_URL_SYNTAX = 2020,
XML_HTTP_USE_IP, /* 2021 */
XML_HTTP_UNKNOWN_HOST, /* 2022 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000,
XML_SCHEMAP_SRC_SIMPLE_TYPE_2, /* 3001 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_3, /* 3002 */
XML_SCHEMAP_SRC_SIMPLE_TYPE_4, /* 3003 */
XML_SCHEMAP_SRC_RESOLVE, /* 3004 */
XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE, /* 3005 */
XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE, /* 3006 */
XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES, /* 3007 */
XML_SCHEMAP_ST_PROPS_CORRECT_1, /* 3008 */
XML_SCHEMAP_ST_PROPS_CORRECT_2, /* 3009 */
XML_SCHEMAP_ST_PROPS_CORRECT_3, /* 3010 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_1, /* 3011 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_2, /* 3012 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1, /* 3013 */
XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2, /* 3014 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_1, /* 3015 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1, /* 3016 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2, /* 3017 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1, /* 3018 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2, /* 3019 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3, /* 3020 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4, /* 3021 */
XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5, /* 3022 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_1, /* 3023 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1, /* 3024 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2, /* 3025 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2, /* 3026 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1, /* 3027 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3, /* 3028 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4, /* 3029 */
XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5, /* 3030 */
XML_SCHEMAP_COS_ST_DERIVED_OK_2_1, /* 3031 */
XML_SCHEMAP_COS_ST_DERIVED_OK_2_2, /* 3032 */
XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED, /* 3033 */
XML_SCHEMAP_S4S_ELEM_MISSING, /* 3034 */
XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED, /* 3035 */
XML_SCHEMAP_S4S_ATTR_MISSING, /* 3036 */
XML_SCHEMAP_S4S_ATTR_INVALID_VALUE, /* 3037 */
XML_SCHEMAP_SRC_ELEMENT_1, /* 3038 */
XML_SCHEMAP_SRC_ELEMENT_2_1, /* 3039 */
XML_SCHEMAP_SRC_ELEMENT_2_2, /* 3040 */
XML_SCHEMAP_SRC_ELEMENT_3, /* 3041 */
XML_SCHEMAP_P_PROPS_CORRECT_1, /* 3042 */
XML_SCHEMAP_P_PROPS_CORRECT_2_1, /* 3043 */
XML_SCHEMAP_P_PROPS_CORRECT_2_2, /* 3044 */
XML_SCHEMAP_E_PROPS_CORRECT_2, /* 3045 */
XML_SCHEMAP_E_PROPS_CORRECT_3, /* 3046 */
XML_SCHEMAP_E_PROPS_CORRECT_4, /* 3047 */
XML_SCHEMAP_E_PROPS_CORRECT_5, /* 3048 */
XML_SCHEMAP_E_PROPS_CORRECT_6, /* 3049 */
XML_SCHEMAP_SRC_INCLUDE, /* 3050 */
XML_SCHEMAP_SRC_ATTRIBUTE_1, /* 3051 */
XML_SCHEMAP_SRC_ATTRIBUTE_2, /* 3052 */
XML_SCHEMAP_SRC_ATTRIBUTE_3_1, /* 3053 */
XML_SCHEMAP_SRC_ATTRIBUTE_3_2, /* 3054 */
XML_SCHEMAP_SRC_ATTRIBUTE_4, /* 3055 */
XML_SCHEMAP_NO_XMLNS, /* 3056 */
XML_SCHEMAP_NO_XSI, /* 3057 */
XML_SCHEMAP_COS_VALID_DEFAULT_1, /* 3058 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_1, /* 3059 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1, /* 3060 */
XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2, /* 3061 */
XML_SCHEMAP_CVC_SIMPLE_TYPE, /* 3062 */
XML_SCHEMAP_COS_CT_EXTENDS_1_1, /* 3063 */
XML_SCHEMAP_SRC_IMPORT_1_1, /* 3064 */
XML_SCHEMAP_SRC_IMPORT_1_2, /* 3065 */
XML_SCHEMAP_SRC_IMPORT_2, /* 3066 */
XML_SCHEMAP_SRC_IMPORT_2_1, /* 3067 */
XML_SCHEMAP_SRC_IMPORT_2_2, /* 3068 */
XML_SCHEMAP_INTERNAL, /* 3069 non-W3C */
XML_SCHEMAP_NOT_DETERMINISTIC, /* 3070 non-W3C */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1, /* 3071 */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2, /* 3072 */
XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3, /* 3073 */
XML_SCHEMAP_MG_PROPS_CORRECT_1, /* 3074 */
XML_SCHEMAP_MG_PROPS_CORRECT_2, /* 3075 */
XML_SCHEMAP_SRC_CT_1, /* 3076 */
XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3, /* 3077 */
XML_SCHEMAP_AU_PROPS_CORRECT_2, /* 3078 */
XML_SCHEMAP_A_PROPS_CORRECT_2, /* 3079 */
XML_SCHEMAP_C_PROPS_CORRECT, /* 3080 */
XML_SCHEMAP_SRC_REDEFINE, /* 3081 */
XML_SCHEMAP_SRC_IMPORT, /* 3082 */
XML_SCHEMAP_WARN_SKIP_SCHEMA, /* 3083 */
XML_SCHEMAP_WARN_UNLOCATED_SCHEMA, /* 3084 */
XML_SCHEMAP_WARN_ATTR_REDECL_PROH, /* 3085 */
XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH, /* 3085 */
XML_SCHEMAP_AG_PROPS_CORRECT, /* 3086 */
XML_SCHEMAP_COS_CT_EXTENDS_1_2, /* 3087 */
XML_SCHEMAP_AU_PROPS_CORRECT, /* 3088 */
XML_SCHEMAP_A_PROPS_CORRECT_3, /* 3089 */
XML_SCHEMAP_COS_ALL_LIMITED, /* 3090 */
XML_SCHEMATRONV_ASSERT = 4000, /* 4000 */
XML_SCHEMATRONV_REPORT,
XML_MODULE_OPEN = 4900, /* 4900 */
XML_MODULE_CLOSE, /* 4901 */
XML_CHECK_FOUND_ELEMENT = 5000,
XML_CHECK_FOUND_ATTRIBUTE, /* 5001 */
XML_CHECK_FOUND_TEXT, /* 5002 */
XML_CHECK_FOUND_CDATA, /* 5003 */
XML_CHECK_FOUND_ENTITYREF, /* 5004 */
XML_CHECK_FOUND_ENTITY, /* 5005 */
XML_CHECK_FOUND_PI, /* 5006 */
XML_CHECK_FOUND_COMMENT, /* 5007 */
XML_CHECK_FOUND_DOCTYPE, /* 5008 */
XML_CHECK_FOUND_FRAGMENT, /* 5009 */
XML_CHECK_FOUND_NOTATION, /* 5010 */
XML_CHECK_UNKNOWN_NODE, /* 5011 */
XML_CHECK_ENTITY_TYPE, /* 5012 */
XML_CHECK_NO_PARENT, /* 5013 */
XML_CHECK_NO_DOC, /* 5014 */
XML_CHECK_NO_NAME, /* 5015 */
XML_CHECK_NO_ELEM, /* 5016 */
XML_CHECK_WRONG_DOC, /* 5017 */
XML_CHECK_NO_PREV, /* 5018 */
XML_CHECK_WRONG_PREV, /* 5019 */
XML_CHECK_NO_NEXT, /* 5020 */
XML_CHECK_WRONG_NEXT, /* 5021 */
XML_CHECK_NOT_DTD, /* 5022 */
XML_CHECK_NOT_ATTR, /* 5023 */
XML_CHECK_NOT_ATTR_DECL, /* 5024 */
XML_CHECK_NOT_ELEM_DECL, /* 5025 */
XML_CHECK_NOT_ENTITY_DECL, /* 5026 */
XML_CHECK_NOT_NS_DECL, /* 5027 */
XML_CHECK_NO_HREF, /* 5028 */
XML_CHECK_WRONG_PARENT,/* 5029 */
XML_CHECK_NS_SCOPE, /* 5030 */
XML_CHECK_NS_ANCESTOR, /* 5031 */
XML_CHECK_NOT_UTF8, /* 5032 */
XML_CHECK_NO_DICT, /* 5033 */
XML_CHECK_NOT_NCNAME, /* 5034 */
XML_CHECK_OUTSIDE_DICT, /* 5035 */
XML_CHECK_WRONG_NAME, /* 5036 */
XML_CHECK_NAME_NOT_NULL, /* 5037 */
XML_I18N_NO_NAME = 6000,
XML_I18N_NO_HANDLER, /* 6001 */
XML_I18N_EXCESS_HANDLER, /* 6002 */
XML_I18N_CONV_FAILED, /* 6003 */
XML_I18N_NO_OUTPUT, /* 6004 */
XML_BUF_OVERFLOW = 7000
} xmlParserErrors;
/**
* xmlGenericErrorFunc:
* @ctx: a parsing context
* @msg: the message
* @...: the extra arguments of the varags to format the message
*
* Signature of the function to use when there is an error and
* no parsing or validity context available .
*/
typedef void (XMLCDECL *xmlGenericErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlStructuredErrorFunc:
* @userData: user provided data for the error callback
* @error: the error being raised.
*
* Signature of the function to use when there is an error and
* the module handles the new error reporting mechanism.
*/
typedef void (XMLCALL *xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error);
/*
* Use the following function to reset the two global variables
* xmlGenericError and xmlGenericErrorContext.
*/
XMLPUBFUN void XMLCALL
xmlSetGenericErrorFunc (void *ctx,
xmlGenericErrorFunc handler);
XMLPUBFUN void XMLCALL
initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler);
XMLPUBFUN void XMLCALL
xmlSetStructuredErrorFunc (void *ctx,
xmlStructuredErrorFunc handler);
/*
* Default message routines used by SAX and Valid context for error
* and warning reporting.
*/
XMLPUBFUN void XMLCDECL
xmlParserError (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserWarning (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserValidityError (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCDECL
xmlParserValidityWarning (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN void XMLCALL
xmlParserPrintFileInfo (xmlParserInputPtr input);
XMLPUBFUN void XMLCALL
xmlParserPrintFileContext (xmlParserInputPtr input);
/*
* Extended error information routines
*/
XMLPUBFUN xmlErrorPtr XMLCALL
xmlGetLastError (void);
XMLPUBFUN void XMLCALL
xmlResetLastError (void);
XMLPUBFUN xmlErrorPtr XMLCALL
xmlCtxtGetLastError (void *ctx);
XMLPUBFUN void XMLCALL
xmlCtxtResetLastError (void *ctx);
XMLPUBFUN void XMLCALL
xmlResetError (xmlErrorPtr err);
XMLPUBFUN int XMLCALL
xmlCopyError (xmlErrorPtr from,
xmlErrorPtr to);
#ifdef IN_LIBXML
/*
* Internal callback reporting routine
*/
XMLPUBFUN void XMLCALL
__xmlRaiseError (xmlStructuredErrorFunc schannel,
xmlGenericErrorFunc channel,
void *data,
void *ctx,
void *node,
int domain,
int code,
xmlErrorLevel level,
const char *file,
int line,
const char *str1,
const char *str2,
const char *str3,
int int1,
int col,
const char *msg,
...) LIBXML_ATTR_FORMAT(16,17);
XMLPUBFUN void XMLCALL
__xmlSimpleError (int domain,
int code,
xmlNodePtr node,
const char *msg,
const char *extra) LIBXML_ATTR_FORMAT(4,0);
#endif
#ifdef __cplusplus
}
#endif
#endif /* __XML_ERROR_H__ */

View File

@ -0,0 +1,162 @@
/*
* Summary: macros for marking symbols as exportable/importable.
* Description: macros for marking symbols as exportable/importable.
*
* Copy: See Copyright for the status of this software.
*
* Author: Igor Zlatovic <igor@zlatkovic.com>
*/
#ifndef __XML_EXPORTS_H__
#define __XML_EXPORTS_H__
/**
* XMLPUBFUN, XMLPUBVAR, XMLCALL
*
* Macros which declare an exportable function, an exportable variable and
* the calling convention used for functions.
*
* Please use an extra block for every platform/compiler combination when
* modifying this, rather than overlong #ifdef lines. This helps
* readability as well as the fact that different compilers on the same
* platform might need different definitions.
*/
/**
* XMLPUBFUN:
*
* Macros which declare an exportable function
*/
#define XMLPUBFUN
/**
* XMLPUBVAR:
*
* Macros which declare an exportable variable
*/
#define XMLPUBVAR extern
/**
* XMLCALL:
*
* Macros which declare the called convention for exported functions
*/
#define XMLCALL
/**
* XMLCDECL:
*
* Macro which declares the calling convention for exported functions that
* use '...'.
*/
#define XMLCDECL
/** DOC_DISABLE */
/* Windows platform with MS compiler */
#if defined(_WIN32) && defined(_MSC_VER)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#if defined(LIBXML_FASTCALL)
#define XMLCALL __fastcall
#else
#define XMLCALL __cdecl
#endif
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Windows platform with Borland compiler */
#if defined(_WIN32) && defined(__BORLANDC__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport) extern
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Windows platform with GNU compiler (Mingw) */
#if defined(_WIN32) && defined(__MINGW32__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
/*
* if defined(IN_LIBXML) this raises problems on mingw with msys
* _imp__xmlFree listed as missing. Try to workaround the problem
* by also making that declaration when compiling client code.
*/
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport) extern
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#if !defined _REENTRANT
#define _REENTRANT
#endif
#endif
/* Cygwin platform (does not define _WIN32), GNU compiler */
#if defined(__CYGWIN__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport)
#else
#define XMLPUBFUN
#if !defined(LIBXML_STATIC)
#define XMLPUBVAR __declspec(dllimport) extern
#else
#define XMLPUBVAR extern
#endif
#endif
#define XMLCALL __cdecl
#define XMLCDECL __cdecl
#endif
/* Compatibility */
#if !defined(LIBXML_DLL_IMPORT)
#define LIBXML_DLL_IMPORT XMLPUBVAR
#endif
#endif /* __XML_EXPORTS_H__ */

View File

@ -0,0 +1,224 @@
/*
* Summary: interface for the memory allocator
* Description: provides interfaces for the memory allocator,
* including debugging capabilities.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __DEBUG_MEMORY_ALLOC__
#define __DEBUG_MEMORY_ALLOC__
#include <stdio.h>
#include <libxml/xmlversion.h>
/**
* DEBUG_MEMORY:
*
* DEBUG_MEMORY replaces the allocator with a collect and debug
* shell to the libc allocator.
* DEBUG_MEMORY should only be activated when debugging
* libxml i.e. if libxml has been configured with --with-debug-mem too.
*/
/* #define DEBUG_MEMORY_FREED */
/* #define DEBUG_MEMORY_LOCATION */
#ifdef DEBUG
#ifndef DEBUG_MEMORY
#define DEBUG_MEMORY
#endif
#endif
/**
* DEBUG_MEMORY_LOCATION:
*
* DEBUG_MEMORY_LOCATION should be activated only when debugging
* libxml i.e. if libxml has been configured with --with-debug-mem too.
*/
#ifdef DEBUG_MEMORY_LOCATION
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* The XML memory wrapper support 4 basic overloadable functions.
*/
/**
* xmlFreeFunc:
* @mem: an already allocated block of memory
*
* Signature for a free() implementation.
*/
typedef void (XMLCALL *xmlFreeFunc)(void *mem);
/**
* xmlMallocFunc:
* @size: the size requested in bytes
*
* Signature for a malloc() implementation.
*
* Returns a pointer to the newly allocated block or NULL in case of error.
*/
typedef void *(LIBXML_ATTR_ALLOC_SIZE(1) XMLCALL *xmlMallocFunc)(size_t size);
/**
* xmlReallocFunc:
* @mem: an already allocated block of memory
* @size: the new size requested in bytes
*
* Signature for a realloc() implementation.
*
* Returns a pointer to the newly reallocated block or NULL in case of error.
*/
typedef void *(XMLCALL *xmlReallocFunc)(void *mem, size_t size);
/**
* xmlStrdupFunc:
* @str: a zero terminated string
*
* Signature for an strdup() implementation.
*
* Returns the copy of the string or NULL in case of error.
*/
typedef char *(XMLCALL *xmlStrdupFunc)(const char *str);
/*
* The 4 interfaces used for all memory handling within libxml.
LIBXML_DLL_IMPORT xmlFreeFunc xmlFree;
LIBXML_DLL_IMPORT xmlMallocFunc xmlMalloc;
LIBXML_DLL_IMPORT xmlMallocFunc xmlMallocAtomic;
LIBXML_DLL_IMPORT xmlReallocFunc xmlRealloc;
LIBXML_DLL_IMPORT xmlStrdupFunc xmlMemStrdup;
*/
/*
* The way to overload the existing functions.
* The xmlGc function have an extra entry for atomic block
* allocations useful for garbage collected memory allocators
*/
XMLPUBFUN int XMLCALL
xmlMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int XMLCALL
xmlMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
XMLPUBFUN int XMLCALL
xmlGcMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int XMLCALL
xmlGcMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlMallocFunc *mallocAtomicFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
/*
* Initialization of the memory layer.
*/
XMLPUBFUN int XMLCALL
xmlInitMemory (void);
/*
* Cleanup of the memory layer.
*/
XMLPUBFUN void XMLCALL
xmlCleanupMemory (void);
/*
* These are specific to the XML debug memory wrapper.
*/
XMLPUBFUN int XMLCALL
xmlMemUsed (void);
XMLPUBFUN int XMLCALL
xmlMemBlocks (void);
XMLPUBFUN void XMLCALL
xmlMemDisplay (FILE *fp);
XMLPUBFUN void XMLCALL
xmlMemDisplayLast(FILE *fp, long nbBytes);
XMLPUBFUN void XMLCALL
xmlMemShow (FILE *fp, int nr);
XMLPUBFUN void XMLCALL
xmlMemoryDump (void);
XMLPUBFUN void * XMLCALL
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
xmlMemRealloc (void *ptr,size_t size);
XMLPUBFUN void XMLCALL
xmlMemFree (void *ptr);
XMLPUBFUN char * XMLCALL
xmlMemoryStrdup (const char *str);
XMLPUBFUN void * XMLCALL
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void * XMLCALL
xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
XMLPUBFUN void * XMLCALL
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN char * XMLCALL
xmlMemStrdupLoc (const char *str, const char *file, int line);
#ifdef DEBUG_MEMORY_LOCATION
/**
* xmlMalloc:
* @size: number of bytes to allocate
*
* Wrapper for the malloc() function used in the XML library.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__)
/**
* xmlMallocAtomic:
* @size: number of bytes to allocate
*
* Wrapper for the malloc() function used in the XML library for allocation
* of block not containing pointers to other areas.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMallocAtomic(size) xmlMallocAtomicLoc((size), __FILE__, __LINE__)
/**
* xmlRealloc:
* @ptr: pointer to the existing allocated area
* @size: number of bytes to allocate
*
* Wrapper for the realloc() function used in the XML library.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__)
/**
* xmlMemStrdup:
* @str: pointer to the existing string
*
* Wrapper for the strdup() function, xmlStrdup() is usually preferred.
*
* Returns the pointer to the allocated area or NULL in case of error.
*/
#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__)
#endif /* DEBUG_MEMORY_LOCATION */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#ifndef __XML_GLOBALS_H
#ifndef __XML_THREADS_H__
#include <libxml/threads.h>
#include <libxml/globals.h>
#endif
#endif
#endif /* __DEBUG_MEMORY_ALLOC__ */

View File

@ -0,0 +1,57 @@
/*
* Summary: dynamic module loading
* Description: basic API for dynamic module loading, used by
* libexslt added in 2.6.17
*
* Copy: See Copyright for the status of this software.
*
* Author: Joel W. Reed
*/
#ifndef __XML_MODULE_H__
#define __XML_MODULE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_MODULES_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlModulePtr:
*
* A handle to a dynamically loaded module
*/
typedef struct _xmlModule xmlModule;
typedef xmlModule *xmlModulePtr;
/**
* xmlModuleOption:
*
* enumeration of options that can be passed down to xmlModuleOpen()
*/
typedef enum {
XML_MODULE_LAZY = 1, /* lazy binding */
XML_MODULE_LOCAL= 2 /* local binding */
} xmlModuleOption;
XMLPUBFUN xmlModulePtr XMLCALL xmlModuleOpen (const char *filename,
int options);
XMLPUBFUN int XMLCALL xmlModuleSymbol (xmlModulePtr module,
const char* name,
void **result);
XMLPUBFUN int XMLCALL xmlModuleClose (xmlModulePtr module);
XMLPUBFUN int XMLCALL xmlModuleFree (xmlModulePtr module);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_MODULES_ENABLED */
#endif /*__XML_MODULE_H__ */

View File

@ -0,0 +1,428 @@
/*
* Summary: the XMLReader implementation
* Description: API of the XML streaming API based on C# interfaces.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XMLREADER_H__
#define __XML_XMLREADER_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/xmlIO.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/relaxng.h>
#include <libxml/xmlschemas.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlParserSeverities:
*
* How severe an error callback is when the per-reader error callback API
* is used.
*/
typedef enum {
XML_PARSER_SEVERITY_VALIDITY_WARNING = 1,
XML_PARSER_SEVERITY_VALIDITY_ERROR = 2,
XML_PARSER_SEVERITY_WARNING = 3,
XML_PARSER_SEVERITY_ERROR = 4
} xmlParserSeverities;
#ifdef LIBXML_READER_ENABLED
/**
* xmlTextReaderMode:
*
* Internal state values for the reader.
*/
typedef enum {
XML_TEXTREADER_MODE_INITIAL = 0,
XML_TEXTREADER_MODE_INTERACTIVE = 1,
XML_TEXTREADER_MODE_ERROR = 2,
XML_TEXTREADER_MODE_EOF =3,
XML_TEXTREADER_MODE_CLOSED = 4,
XML_TEXTREADER_MODE_READING = 5
} xmlTextReaderMode;
/**
* xmlParserProperties:
*
* Some common options to use with xmlTextReaderSetParserProp, but it
* is better to use xmlParserOption and the xmlReaderNewxxx and
* xmlReaderForxxx APIs now.
*/
typedef enum {
XML_PARSER_LOADDTD = 1,
XML_PARSER_DEFAULTATTRS = 2,
XML_PARSER_VALIDATE = 3,
XML_PARSER_SUBST_ENTITIES = 4
} xmlParserProperties;
/**
* xmlReaderTypes:
*
* Predefined constants for the different types of nodes.
*/
typedef enum {
XML_READER_TYPE_NONE = 0,
XML_READER_TYPE_ELEMENT = 1,
XML_READER_TYPE_ATTRIBUTE = 2,
XML_READER_TYPE_TEXT = 3,
XML_READER_TYPE_CDATA = 4,
XML_READER_TYPE_ENTITY_REFERENCE = 5,
XML_READER_TYPE_ENTITY = 6,
XML_READER_TYPE_PROCESSING_INSTRUCTION = 7,
XML_READER_TYPE_COMMENT = 8,
XML_READER_TYPE_DOCUMENT = 9,
XML_READER_TYPE_DOCUMENT_TYPE = 10,
XML_READER_TYPE_DOCUMENT_FRAGMENT = 11,
XML_READER_TYPE_NOTATION = 12,
XML_READER_TYPE_WHITESPACE = 13,
XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,
XML_READER_TYPE_END_ELEMENT = 15,
XML_READER_TYPE_END_ENTITY = 16,
XML_READER_TYPE_XML_DECLARATION = 17
} xmlReaderTypes;
/**
* xmlTextReader:
*
* Structure for an xmlReader context.
*/
typedef struct _xmlTextReader xmlTextReader;
/**
* xmlTextReaderPtr:
*
* Pointer to an xmlReader context.
*/
typedef xmlTextReader *xmlTextReaderPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlNewTextReader (xmlParserInputBufferPtr input,
const char *URI);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlNewTextReaderFilename(const char *URI);
XMLPUBFUN void XMLCALL
xmlFreeTextReader (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderSetup(xmlTextReaderPtr reader,
xmlParserInputBufferPtr input, const char *URL,
const char *encoding, int options);
/*
* Iterators
*/
XMLPUBFUN int XMLCALL
xmlTextReaderRead (xmlTextReaderPtr reader);
#ifdef LIBXML_WRITER_ENABLED
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadInnerXml(xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadOuterXml(xmlTextReaderPtr reader);
#endif
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderReadString (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderReadAttributeValue(xmlTextReaderPtr reader);
/*
* Attributes of the node
*/
XMLPUBFUN int XMLCALL
xmlTextReaderAttributeCount(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderDepth (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderHasAttributes(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderHasValue(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsDefault (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsEmptyElement(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNodeType (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderQuoteChar (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderReadState (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsNamespaceDecl(xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstBaseUri (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstLocalName (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstName (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstNamespaceUri(xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstPrefix (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstXmlLang (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstString (xmlTextReaderPtr reader,
const xmlChar *str);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstValue (xmlTextReaderPtr reader);
/*
* use the Const version of the routine for
* better performance and simpler code
*/
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderBaseUri (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLocalName (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderName (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderNamespaceUri(xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderPrefix (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderXmlLang (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderValue (xmlTextReaderPtr reader);
/*
* Methods of the XmlTextReader
*/
XMLPUBFUN int XMLCALL
xmlTextReaderClose (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttributeNo (xmlTextReaderPtr reader,
int no);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttribute (xmlTextReaderPtr reader,
const xmlChar *name);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderGetAttributeNs (xmlTextReaderPtr reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
xmlTextReaderGetRemainder (xmlTextReaderPtr reader);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLookupNamespace(xmlTextReaderPtr reader,
const xmlChar *prefix);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttributeNo(xmlTextReaderPtr reader,
int no);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttribute(xmlTextReaderPtr reader,
const xmlChar *name);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToAttributeNs(xmlTextReaderPtr reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToFirstAttribute(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToNextAttribute(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderMoveToElement (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNormalization (xmlTextReaderPtr reader);
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstEncoding (xmlTextReaderPtr reader);
/*
* Extensions
*/
XMLPUBFUN int XMLCALL
xmlTextReaderSetParserProp (xmlTextReaderPtr reader,
int prop,
int value);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserProp (xmlTextReaderPtr reader,
int prop);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderCurrentNode (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserLineNumber(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderGetParserColumnNumber(xmlTextReaderPtr reader);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderPreserve (xmlTextReaderPtr reader);
#ifdef LIBXML_PATTERN_ENABLED
XMLPUBFUN int XMLCALL
xmlTextReaderPreservePattern(xmlTextReaderPtr reader,
const xmlChar *pattern,
const xmlChar **namespaces);
#endif /* LIBXML_PATTERN_ENABLED */
XMLPUBFUN xmlDocPtr XMLCALL
xmlTextReaderCurrentDoc (xmlTextReaderPtr reader);
XMLPUBFUN xmlNodePtr XMLCALL
xmlTextReaderExpand (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNext (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderNextSibling (xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderIsValid (xmlTextReaderPtr reader);
#ifdef LIBXML_SCHEMAS_ENABLED
XMLPUBFUN int XMLCALL
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
const char *rng);
XMLPUBFUN int XMLCALL
xmlTextReaderRelaxNGValidateCtxt(xmlTextReaderPtr reader,
xmlRelaxNGValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
xmlRelaxNGPtr schema);
XMLPUBFUN int XMLCALL
xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
const char *xsd);
XMLPUBFUN int XMLCALL
xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
xmlSchemaValidCtxtPtr ctxt,
int options);
XMLPUBFUN int XMLCALL
xmlTextReaderSetSchema (xmlTextReaderPtr reader,
xmlSchemaPtr schema);
#endif
XMLPUBFUN const xmlChar * XMLCALL
xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
XMLPUBFUN int XMLCALL
xmlTextReaderStandalone (xmlTextReaderPtr reader);
/*
* Index lookup
*/
XMLPUBFUN long XMLCALL
xmlTextReaderByteConsumed (xmlTextReaderPtr reader);
/*
* New more complete APIs for simpler creation and reuse of readers
*/
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderWalker (xmlDocPtr doc);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForDoc (const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForFile (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReaderPtr XMLCALL
xmlReaderForIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewWalker (xmlTextReaderPtr reader,
xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlReaderNewDoc (xmlTextReaderPtr reader,
const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewFile (xmlTextReaderPtr reader,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewMemory (xmlTextReaderPtr reader,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewFd (xmlTextReaderPtr reader,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int XMLCALL
xmlReaderNewIO (xmlTextReaderPtr reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/*
* Error handling extensions
*/
typedef void * xmlTextReaderLocatorPtr;
/**
* xmlTextReaderErrorFunc:
* @arg: the user argument
* @msg: the message
* @severity: the severity of the error
* @locator: a locator indicating where the error occurred
*
* Signature of an error callback from a reader parser
*/
typedef void (XMLCALL *xmlTextReaderErrorFunc)(void *arg,
const char *msg,
xmlParserSeverities severity,
xmlTextReaderLocatorPtr locator);
XMLPUBFUN int XMLCALL
xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
XMLPUBFUN xmlChar * XMLCALL
xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
XMLPUBFUN void XMLCALL
xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc f,
void *arg);
XMLPUBFUN void XMLCALL
xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
xmlStructuredErrorFunc f,
void *arg);
XMLPUBFUN void XMLCALL
xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader,
xmlTextReaderErrorFunc *f,
void **arg);
#endif /* LIBXML_READER_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_XMLREADER_H__ */

View File

@ -0,0 +1,222 @@
/*
* Summary: regular expressions handling
* Description: basic API for libxml regular expressions handling used
* for XML Schemas and validation.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_REGEXP_H__
#define __XML_REGEXP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlRegexpPtr:
*
* A libxml regular expression, they can actually be far more complex
* thank the POSIX regex expressions.
*/
typedef struct _xmlRegexp xmlRegexp;
typedef xmlRegexp *xmlRegexpPtr;
/**
* xmlRegExecCtxtPtr:
*
* A libxml progressive regular expression evaluation context
*/
typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
#ifdef __cplusplus
}
#endif
#include <libxml/tree.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The POSIX like API
*/
XMLPUBFUN xmlRegexpPtr XMLCALL
xmlRegexpCompile (const xmlChar *regexp);
XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
xmlRegexpExec (xmlRegexpPtr comp,
const xmlChar *value);
XMLPUBFUN void XMLCALL
xmlRegexpPrint (FILE *output,
xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
xmlRegexpIsDeterminist(xmlRegexpPtr comp);
/**
* xmlRegExecCallbacks:
* @exec: the regular expression context
* @token: the current token string
* @transdata: transition data
* @inputdata: input data
*
* Callback function when doing a transition in the automata
*/
typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
const xmlChar *token,
void *transdata,
void *inputdata);
/*
* The progressive API
*/
XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
xmlRegNewExecCtxt (xmlRegexpPtr comp,
xmlRegExecCallbacks callback,
void *data);
XMLPUBFUN void XMLCALL
xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
XMLPUBFUN int XMLCALL
xmlRegExecPushString(xmlRegExecCtxtPtr exec,
const xmlChar *value,
void *data);
XMLPUBFUN int XMLCALL
xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
const xmlChar *value,
const xmlChar *value2,
void *data);
XMLPUBFUN int XMLCALL
xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
XMLPUBFUN int XMLCALL
xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
const xmlChar **string,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
#ifdef LIBXML_EXPR_ENABLED
/*
* Formal regular expression handling
* Its goal is to do some formal work on content models
*/
/* expressions are used within a context */
typedef struct _xmlExpCtxt xmlExpCtxt;
typedef xmlExpCtxt *xmlExpCtxtPtr;
XMLPUBFUN void XMLCALL
xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
XMLPUBFUN xmlExpCtxtPtr XMLCALL
xmlExpNewCtxt (int maxNodes,
xmlDictPtr dict);
XMLPUBFUN int XMLCALL
xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
/* Expressions are trees but the tree is opaque */
typedef struct _xmlExpNode xmlExpNode;
typedef xmlExpNode *xmlExpNodePtr;
typedef enum {
XML_EXP_EMPTY = 0,
XML_EXP_FORBID = 1,
XML_EXP_ATOM = 2,
XML_EXP_SEQ = 3,
XML_EXP_OR = 4,
XML_EXP_COUNT = 5
} xmlExpNodeType;
/*
* 2 core expressions shared by all for the empty language set
* and for the set with just the empty token
*/
XMLPUBVAR xmlExpNodePtr forbiddenExp;
XMLPUBVAR xmlExpNodePtr emptyExp;
/*
* Expressions are reference counted internally
*/
XMLPUBFUN void XMLCALL
xmlExpFree (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr);
XMLPUBFUN void XMLCALL
xmlExpRef (xmlExpNodePtr expr);
/*
* constructors can be either manual or from a string
*/
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpParse (xmlExpCtxtPtr ctxt,
const char *expr);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewAtom (xmlExpCtxtPtr ctxt,
const xmlChar *name,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewOr (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewSeq (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewRange (xmlExpCtxtPtr ctxt,
xmlExpNodePtr subset,
int min,
int max);
/*
* The really interesting APIs
*/
XMLPUBFUN int XMLCALL
xmlExpIsNillable(xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
xmlExpMaxToken (xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**langList,
int len);
XMLPUBFUN int XMLCALL
xmlExpGetStart (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**tokList,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpStringDerive(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar *str,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpExpDerive (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN int XMLCALL
xmlExpSubsume (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN void XMLCALL
xmlExpDump (xmlBufferPtr buf,
xmlExpNodePtr expr);
#endif /* LIBXML_EXPR_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_REGEXP_ENABLED */
#endif /*__XML_REGEXP_H__ */

View File

@ -0,0 +1,88 @@
/*
* Summary: the XML document serializer
* Description: API to save document or subtree of document
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XMLSAVE_H__
#define __XML_XMLSAVE_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/encoding.h>
#include <libxml/xmlIO.h>
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlSaveOption:
*
* This is the set of XML save options that can be passed down
* to the xmlSaveToFd() and similar calls.
*/
typedef enum {
XML_SAVE_FORMAT = 1<<0, /* format save output */
XML_SAVE_NO_DECL = 1<<1, /* drop the xml declaration */
XML_SAVE_NO_EMPTY = 1<<2, /* no empty tags */
XML_SAVE_NO_XHTML = 1<<3, /* disable XHTML1 specific rules */
XML_SAVE_XHTML = 1<<4, /* force XHTML1 specific rules */
XML_SAVE_AS_XML = 1<<5, /* force XML serialization on HTML doc */
XML_SAVE_AS_HTML = 1<<6, /* force HTML serialization on XML doc */
XML_SAVE_WSNONSIG = 1<<7 /* format with non-significant whitespace */
} xmlSaveOption;
typedef struct _xmlSaveCtxt xmlSaveCtxt;
typedef xmlSaveCtxt *xmlSaveCtxtPtr;
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToFd (int fd,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToFilename (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToBuffer (xmlBufferPtr buffer,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxtPtr XMLCALL
xmlSaveToIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
const char *encoding,
int options);
XMLPUBFUN long XMLCALL
xmlSaveDoc (xmlSaveCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN long XMLCALL
xmlSaveTree (xmlSaveCtxtPtr ctxt,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSaveFlush (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSaveClose (xmlSaveCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSaveSetEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape);
XMLPUBFUN int XMLCALL
xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt,
xmlCharEncodingOutputFunc escape);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* __XML_XMLSAVE_H__ */

View File

@ -0,0 +1,246 @@
/*
* Summary: incomplete XML Schemas structure implementation
* Description: interface to the XML Schemas handling and schema validity
* checking, it is incomplete right now.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_H__
#define __XML_SCHEMA_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* This error codes are obsolete; not used any more.
*/
typedef enum {
XML_SCHEMAS_ERR_OK = 0,
XML_SCHEMAS_ERR_NOROOT = 1,
XML_SCHEMAS_ERR_UNDECLAREDELEM,
XML_SCHEMAS_ERR_NOTTOPLEVEL,
XML_SCHEMAS_ERR_MISSING,
XML_SCHEMAS_ERR_WRONGELEM,
XML_SCHEMAS_ERR_NOTYPE,
XML_SCHEMAS_ERR_NOROLLBACK,
XML_SCHEMAS_ERR_ISABSTRACT,
XML_SCHEMAS_ERR_NOTEMPTY,
XML_SCHEMAS_ERR_ELEMCONT,
XML_SCHEMAS_ERR_HAVEDEFAULT,
XML_SCHEMAS_ERR_NOTNILLABLE,
XML_SCHEMAS_ERR_EXTRACONTENT,
XML_SCHEMAS_ERR_INVALIDATTR,
XML_SCHEMAS_ERR_INVALIDELEM,
XML_SCHEMAS_ERR_NOTDETERMINIST,
XML_SCHEMAS_ERR_CONSTRUCT,
XML_SCHEMAS_ERR_INTERNAL,
XML_SCHEMAS_ERR_NOTSIMPLE,
XML_SCHEMAS_ERR_ATTRUNKNOWN,
XML_SCHEMAS_ERR_ATTRINVALID,
XML_SCHEMAS_ERR_VALUE,
XML_SCHEMAS_ERR_FACET,
XML_SCHEMAS_ERR_,
XML_SCHEMAS_ERR_XXX
} xmlSchemaValidError;
/*
* ATTENTION: Change xmlSchemaSetValidOptions's check
* for invalid values, if adding to the validation
* options below.
*/
/**
* xmlSchemaValidOption:
*
* This is the set of XML Schema validation options.
*/
typedef enum {
XML_SCHEMA_VAL_VC_I_CREATE = 1<<0
/* Default/fixed: create an attribute node
* or an element's text node on the instance.
*/
} xmlSchemaValidOption;
/*
XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,
* assemble schemata using
* xsi:schemaLocation and
* xsi:noNamespaceSchemaLocation
*/
/**
* The schemas related types are kept internal
*/
typedef struct _xmlSchema xmlSchema;
typedef xmlSchema *xmlSchemaPtr;
/**
* xmlSchemaValidityErrorFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of an error callback from an XSD validation
*/
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc)
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* xmlSchemaValidityWarningFunc:
* @ctx: the validation context
* @msg: the message
* @...: extra arguments
*
* Signature of a warning callback from an XSD validation
*/
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc)
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* A schemas validation context
*/
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
/**
* xmlSchemaValidityLocatorFunc:
* @ctx: user provided context
* @file: returned file information
* @line: returned line information
*
* A schemas validation locator, a callback called by the validator.
* This is used when file or node informations are not available
* to find out what file and line number are affected
*
* Returns: 0 in case of success and -1 in case of error
*/
typedef int (XMLCDECL *xmlSchemaValidityLocatorFunc) (void *ctx,
const char **file, unsigned long *line);
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaPtr XMLCALL
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
XMLPUBFUN void XMLCALL
xmlSchemaFree (xmlSchemaPtr schema);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void XMLCALL
xmlSchemaDump (FILE *output,
xmlSchemaPtr schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void XMLCALL
xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void XMLCALL
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int XMLCALL
xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
xmlSchemaValidityErrorFunc *err,
xmlSchemaValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int XMLCALL
xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
int options);
XMLPUBFUN void XMLCALL
xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt,
const char *filename);
XMLPUBFUN int XMLCALL
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
XMLPUBFUN void XMLCALL
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
xmlDocPtr instance);
XMLPUBFUN int XMLCALL
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
xmlNodePtr elem);
XMLPUBFUN int XMLCALL
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
xmlParserInputBufferPtr input,
xmlCharEncoding enc,
xmlSAXHandlerPtr sax,
void *user_data);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
const char * filename,
int options);
XMLPUBFUN xmlParserCtxtPtr XMLCALL
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
/*
* Interface to insert Schemas SAX validation in a SAX stream
*/
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
xmlSAXHandlerPtr *sax,
void **user_data);
XMLPUBFUN int XMLCALL
xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
XMLPUBFUN void XMLCALL
xmlSchemaValidateSetLocator (xmlSchemaValidCtxtPtr vctxt,
xmlSchemaValidityLocatorFunc f,
void *ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_H__ */

View File

@ -0,0 +1,151 @@
/*
* Summary: implementation of XML Schema Datatypes
* Description: module providing the XML Schema Datatypes implementation
* both definition and validity checking
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_SCHEMA_TYPES_H__
#define __XML_SCHEMA_TYPES_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/schemasInternals.h>
#include <libxml/xmlschemas.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
XML_SCHEMA_WHITESPACE_PRESERVE = 1,
XML_SCHEMA_WHITESPACE_REPLACE = 2,
XML_SCHEMA_WHITESPACE_COLLAPSE = 3
} xmlSchemaWhitespaceValueType;
XMLPUBFUN void XMLCALL
xmlSchemaInitTypes (void);
XMLPUBFUN void XMLCALL
xmlSchemaCleanupTypes (void);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetPredefinedType (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int XMLCALL
xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val);
XMLPUBFUN int XMLCALL
xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFacet (xmlSchemaTypePtr base,
xmlSchemaFacetPtr facet,
const xmlChar *value,
xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL
xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType fws,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaValPtr val,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN void XMLCALL
xmlSchemaFreeValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaFacetPtr XMLCALL
xmlSchemaNewFacet (void);
XMLPUBFUN int XMLCALL
xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
xmlSchemaTypePtr typeDecl,
xmlSchemaParserCtxtPtr ctxt,
const xmlChar *name);
XMLPUBFUN void XMLCALL
xmlSchemaFreeFacet (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL
xmlSchemaCompareValues (xmlSchemaValPtr x,
xmlSchemaValPtr y);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type);
XMLPUBFUN int XMLCALL
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
const xmlChar *value,
unsigned long actualLen,
unsigned long *expectedLen);
XMLPUBFUN xmlSchemaTypePtr XMLCALL
xmlSchemaGetBuiltInType (xmlSchemaValType type);
XMLPUBFUN int XMLCALL
xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
int facetType);
XMLPUBFUN xmlChar * XMLCALL
xmlSchemaCollapseString (const xmlChar *value);
XMLPUBFUN xmlChar * XMLCALL
xmlSchemaWhiteSpaceReplace (const xmlChar *value);
XMLPUBFUN unsigned long XMLCALL
xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet);
XMLPUBFUN int XMLCALL
xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
xmlSchemaFacetPtr facet,
const xmlChar *value,
xmlSchemaValPtr val,
unsigned long *length);
XMLPUBFUN int XMLCALL
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaValPtr val,
unsigned long *length,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int XMLCALL
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
const xmlChar *value,
xmlSchemaValPtr *val,
xmlNodePtr node);
XMLPUBFUN int XMLCALL
xmlSchemaGetCanonValue (xmlSchemaValPtr val,
const xmlChar **retValue);
XMLPUBFUN int XMLCALL
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
const xmlChar **retValue,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int XMLCALL
xmlSchemaValueAppend (xmlSchemaValPtr prev,
xmlSchemaValPtr cur);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaValueGetNext (xmlSchemaValPtr cur);
XMLPUBFUN const xmlChar * XMLCALL
xmlSchemaValueGetAsString (xmlSchemaValPtr val);
XMLPUBFUN int XMLCALL
xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewStringValue (xmlSchemaValType type,
const xmlChar *value);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewNOTATIONValue (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaNewQNameValue (const xmlChar *namespaceName,
const xmlChar *localName);
XMLPUBFUN int XMLCALL
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
xmlSchemaWhitespaceValueType xws,
xmlSchemaValPtr y,
xmlSchemaWhitespaceValueType yws);
XMLPUBFUN xmlSchemaValPtr XMLCALL
xmlSchemaCopyValue (xmlSchemaValPtr val);
XMLPUBFUN xmlSchemaValType XMLCALL
xmlSchemaGetValType (xmlSchemaValPtr val);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_TYPES_H__ */

View File

@ -0,0 +1,140 @@
/*
* Summary: set of routines to process strings
* Description: type and interfaces needed for the internal string handling
* of the library, especially UTF8 processing.
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_STRING_H__
#define __XML_STRING_H__
#include <stdarg.h>
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlChar:
*
* This is a basic byte in an UTF-8 encoded string.
* It's unsigned allowing to pinpoint case where char * are assigned
* to xmlChar * (possibly making serialization back impossible).
*/
typedef unsigned char xmlChar;
/**
* BAD_CAST:
*
* Macro to cast a string to an xmlChar * when one know its safe.
*/
#define BAD_CAST (xmlChar *)
/*
* xmlChar handling
*/
XMLPUBFUN xmlChar * XMLCALL
xmlStrdup (const xmlChar *cur);
XMLPUBFUN xmlChar * XMLCALL
xmlStrndup (const xmlChar *cur,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlCharStrndup (const char *cur,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlCharStrdup (const char *cur);
XMLPUBFUN xmlChar * XMLCALL
xmlStrsub (const xmlChar *str,
int start,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlStrchr (const xmlChar *str,
xmlChar val);
XMLPUBFUN const xmlChar * XMLCALL
xmlStrstr (const xmlChar *str,
const xmlChar *val);
XMLPUBFUN const xmlChar * XMLCALL
xmlStrcasestr (const xmlChar *str,
const xmlChar *val);
XMLPUBFUN int XMLCALL
xmlStrcmp (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
xmlStrncmp (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int XMLCALL
xmlStrcasecmp (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
xmlStrncasecmp (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int XMLCALL
xmlStrEqual (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int XMLCALL
xmlStrQEqual (const xmlChar *pref,
const xmlChar *name,
const xmlChar *str);
XMLPUBFUN int XMLCALL
xmlStrlen (const xmlChar *str);
XMLPUBFUN xmlChar * XMLCALL
xmlStrcat (xmlChar *cur,
const xmlChar *add);
XMLPUBFUN xmlChar * XMLCALL
xmlStrncat (xmlChar *cur,
const xmlChar *add,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlStrncatNew (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int XMLCALL
xmlStrPrintf (xmlChar *buf,
int len,
const char *msg,
...) LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlStrVPrintf (xmlChar *buf,
int len,
const char *msg,
va_list ap) LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL
xmlGetUTF8Char (const unsigned char *utf,
int *len);
XMLPUBFUN int XMLCALL
xmlCheckUTF8 (const unsigned char *utf);
XMLPUBFUN int XMLCALL
xmlUTF8Strsize (const xmlChar *utf,
int len);
XMLPUBFUN xmlChar * XMLCALL
xmlUTF8Strndup (const xmlChar *utf,
int len);
XMLPUBFUN const xmlChar * XMLCALL
xmlUTF8Strpos (const xmlChar *utf,
int pos);
XMLPUBFUN int XMLCALL
xmlUTF8Strloc (const xmlChar *utf,
const xmlChar *utfchar);
XMLPUBFUN xmlChar * XMLCALL
xmlUTF8Strsub (const xmlChar *utf,
int start,
int len);
XMLPUBFUN int XMLCALL
xmlUTF8Strlen (const xmlChar *utf);
XMLPUBFUN int XMLCALL
xmlUTF8Size (const xmlChar *utf);
XMLPUBFUN int XMLCALL
xmlUTF8Charcmp (const xmlChar *utf1,
const xmlChar *utf2);
#ifdef __cplusplus
}
#endif
#endif /* __XML_STRING_H__ */

View File

@ -0,0 +1,202 @@
/*
* Summary: Unicode character APIs
* Description: API for the Unicode character APIs
*
* This file is automatically generated from the
* UCS description files of the Unicode Character Database
* http://www.unicode.org/Public/4.0-Update1/UCD-4.0.1.html
* using the genUnicode.py Python script.
*
* Generation date: Mon Mar 27 11:09:52 2006
* Sources: Blocks-4.0.1.txt UnicodeData-4.0.1.txt
* Author: Daniel Veillard
*/
#ifndef __XML_UNICODE_H__
#define __XML_UNICODE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_UNICODE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN int XMLCALL xmlUCSIsAegeanNumbers (int code);
XMLPUBFUN int XMLCALL xmlUCSIsAlphabeticPresentationForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArabicPresentationFormsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArmenian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsArrows (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBasicLatin (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBengali (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBlockElements (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBopomofo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBopomofoExtended (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBoxDrawing (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBraillePatterns (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBuhid (int code);
XMLPUBFUN int XMLCALL xmlUCSIsByzantineMusicalSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibility (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKCompatibilityIdeographsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKRadicalsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKSymbolsandPunctuation (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCJKUnifiedIdeographsExtensionB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCherokee (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarks (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningDiacriticalMarksforSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningHalfMarks (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCombiningMarksforSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsControlPictures (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCurrencySymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCypriotSyllabary (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCyrillic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCyrillicSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDeseret (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDevanagari (int code);
XMLPUBFUN int XMLCALL xmlUCSIsDingbats (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedAlphanumerics (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEnclosedCJKLettersandMonths (int code);
XMLPUBFUN int XMLCALL xmlUCSIsEthiopic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeneralPunctuation (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeometricShapes (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGeorgian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGothic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreek (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreekExtended (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGreekandCoptic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGujarati (int code);
XMLPUBFUN int XMLCALL xmlUCSIsGurmukhi (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHalfwidthandFullwidthForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulCompatibilityJamo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulJamo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHangulSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHanunoo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHebrew (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHighPrivateUseSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHighSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsHiragana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsIPAExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsIdeographicDescriptionCharacters (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKanbun (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKangxiRadicals (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKannada (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKatakana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKatakanaPhoneticExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKhmer (int code);
XMLPUBFUN int XMLCALL xmlUCSIsKhmerSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLao (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatin1Supplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLatinExtendedAdditional (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLetterlikeSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLimbu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLinearBIdeograms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLinearBSyllabary (int code);
XMLPUBFUN int XMLCALL xmlUCSIsLowSurrogates (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMalayalam (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalAlphanumericSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMathematicalOperators (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousMathematicalSymbolsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousSymbolsandArrows (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMiscellaneousTechnical (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMongolian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMusicalSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsMyanmar (int code);
XMLPUBFUN int XMLCALL xmlUCSIsNumberForms (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOgham (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOldItalic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOpticalCharacterRecognition (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOriya (int code);
XMLPUBFUN int XMLCALL xmlUCSIsOsmanya (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPhoneticExtensions (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUse (int code);
XMLPUBFUN int XMLCALL xmlUCSIsPrivateUseArea (int code);
XMLPUBFUN int XMLCALL xmlUCSIsRunic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsShavian (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSinhala (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSmallFormVariants (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSpacingModifierLetters (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSpecials (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSuperscriptsandSubscripts (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalArrowsB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementalMathematicalOperators (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaA (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSupplementaryPrivateUseAreaB (int code);
XMLPUBFUN int XMLCALL xmlUCSIsSyriac (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTagalog (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTagbanwa (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTags (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTaiLe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTaiXuanJingSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTamil (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTelugu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsThaana (int code);
XMLPUBFUN int XMLCALL xmlUCSIsThai (int code);
XMLPUBFUN int XMLCALL xmlUCSIsTibetan (int code);
XMLPUBFUN int XMLCALL xmlUCSIsUgaritic (int code);
XMLPUBFUN int XMLCALL xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code);
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectors (int code);
XMLPUBFUN int XMLCALL xmlUCSIsVariationSelectorsSupplement (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYiRadicals (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYiSyllables (int code);
XMLPUBFUN int XMLCALL xmlUCSIsYijingHexagramSymbols (int code);
XMLPUBFUN int XMLCALL xmlUCSIsBlock (int code, const char *block);
XMLPUBFUN int XMLCALL xmlUCSIsCatC (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCf (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatCs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatL (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLm (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLt (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatLu (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatM (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatMn (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatN (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNd (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatNo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatP (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPd (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPe (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPf (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPi (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatPs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatS (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSc (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSk (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSm (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatSo (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZ (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZl (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZp (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCatZs (int code);
XMLPUBFUN int XMLCALL xmlUCSIsCat (int code, const char *cat);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_UNICODE_ENABLED */
#endif /* __XML_UNICODE_H__ */

View File

@ -0,0 +1,486 @@
/*
* Summary: compile-time version informations
* Description: compile-time version informations for the XML library
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_VERSION_H__
#define __XML_VERSION_H__
#include <libxml/xmlexports.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* use those to be sure nothing nasty will happen if
* your library and includes mismatch
*/
#ifndef LIBXML2_COMPILING_MSCCDEF
XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#endif /* LIBXML2_COMPILING_MSCCDEF */
/**
* LIBXML_DOTTED_VERSION:
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.9.9"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 20909
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "20909"
/**
* LIBXML_VERSION_EXTRA:
*
* extra version information, used to show a CVS compilation
*/
#define LIBXML_VERSION_EXTRA ""
/**
* LIBXML_TEST_VERSION:
*
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(20909);
#ifndef VMS
#if 0
/**
* WITH_TRIO:
*
* defined if the trio support need to be configured in
*/
#define WITH_TRIO
#else
/**
* WITHOUT_TRIO:
*
* defined if the trio support should not be configured in
*/
#define WITHOUT_TRIO
#endif
#else /* VMS */
/**
* WITH_TRIO:
*
* defined if the trio support need to be configured in
*/
#define WITH_TRIO 1
#endif /* VMS */
/**
* LIBXML_THREAD_ENABLED:
*
* Whether the thread support is configured in
*/
#if 1
#if defined(_REENTRANT) || defined(__MT__) || \
(defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE - 0 >= 199506L))
#define LIBXML_THREAD_ENABLED
#endif
#endif
/**
* LIBXML_THREAD_ALLOC_ENABLED:
*
* Whether the allocation hooks are per-thread
*/
#if 0
#define LIBXML_THREAD_ALLOC_ENABLED
#endif
/**
* LIBXML_TREE_ENABLED:
*
* Whether the DOM like tree manipulation API support is configured in
*/
#if 1
#define LIBXML_TREE_ENABLED
#endif
/**
* LIBXML_OUTPUT_ENABLED:
*
* Whether the serialization/saving support is configured in
*/
#if 1
#define LIBXML_OUTPUT_ENABLED
#endif
/**
* LIBXML_PUSH_ENABLED:
*
* Whether the push parsing interfaces are configured in
*/
#if 1
#define LIBXML_PUSH_ENABLED
#endif
/**
* LIBXML_READER_ENABLED:
*
* Whether the xmlReader parsing interface is configured in
*/
#if 1
#define LIBXML_READER_ENABLED
#endif
/**
* LIBXML_PATTERN_ENABLED:
*
* Whether the xmlPattern node selection interface is configured in
*/
#if 1
#define LIBXML_PATTERN_ENABLED
#endif
/**
* LIBXML_WRITER_ENABLED:
*
* Whether the xmlWriter saving interface is configured in
*/
#if 1
#define LIBXML_WRITER_ENABLED
#endif
/**
* LIBXML_SAX1_ENABLED:
*
* Whether the older SAX1 interface is configured in
*/
#if 1
#define LIBXML_SAX1_ENABLED
#endif
/**
* LIBXML_FTP_ENABLED:
*
* Whether the FTP support is configured in
*/
#if 1
#define LIBXML_FTP_ENABLED
#endif
/**
* LIBXML_HTTP_ENABLED:
*
* Whether the HTTP support is configured in
*/
#if 1
#define LIBXML_HTTP_ENABLED
#endif
/**
* LIBXML_VALID_ENABLED:
*
* Whether the DTD validation support is configured in
*/
#if 1
#define LIBXML_VALID_ENABLED
#endif
/**
* LIBXML_HTML_ENABLED:
*
* Whether the HTML support is configured in
*/
#if 1
#define LIBXML_HTML_ENABLED
#endif
/**
* LIBXML_LEGACY_ENABLED:
*
* Whether the deprecated APIs are compiled in for compatibility
*/
#if 1
#define LIBXML_LEGACY_ENABLED
#endif
/**
* LIBXML_C14N_ENABLED:
*
* Whether the Canonicalization support is configured in
*/
#if 1
#define LIBXML_C14N_ENABLED
#endif
/**
* LIBXML_CATALOG_ENABLED:
*
* Whether the Catalog support is configured in
*/
#if 1
#define LIBXML_CATALOG_ENABLED
#endif
/**
* LIBXML_DOCB_ENABLED:
*
* Whether the SGML Docbook support is configured in
*/
#if 1
#define LIBXML_DOCB_ENABLED
#endif
/**
* LIBXML_XPATH_ENABLED:
*
* Whether XPath is configured in
*/
#if 1
#define LIBXML_XPATH_ENABLED
#endif
/**
* LIBXML_XPTR_ENABLED:
*
* Whether XPointer is configured in
*/
#if 1
#define LIBXML_XPTR_ENABLED
#endif
/**
* LIBXML_XINCLUDE_ENABLED:
*
* Whether XInclude is configured in
*/
#if 1
#define LIBXML_XINCLUDE_ENABLED
#endif
/**
* LIBXML_ICONV_ENABLED:
*
* Whether iconv support is available
*/
#if 1
#define LIBXML_ICONV_ENABLED
#endif
/**
* LIBXML_ICU_ENABLED:
*
* Whether icu support is available
*/
#if 0
#define LIBXML_ICU_ENABLED
#endif
/**
* LIBXML_ISO8859X_ENABLED:
*
* Whether ISO-8859-* support is made available in case iconv is not
*/
#if 1
#define LIBXML_ISO8859X_ENABLED
#endif
/**
* LIBXML_DEBUG_ENABLED:
*
* Whether Debugging module is configured in
*/
#if 1
#define LIBXML_DEBUG_ENABLED
#endif
/**
* DEBUG_MEMORY_LOCATION:
*
* Whether the memory debugging is configured in
*/
#if 0
#define DEBUG_MEMORY_LOCATION
#endif
/**
* LIBXML_DEBUG_RUNTIME:
*
* Whether the runtime debugging is configured in
*/
#if 0
#define LIBXML_DEBUG_RUNTIME
#endif
/**
* LIBXML_UNICODE_ENABLED:
*
* Whether the Unicode related interfaces are compiled in
*/
#if 1
#define LIBXML_UNICODE_ENABLED
#endif
/**
* LIBXML_REGEXP_ENABLED:
*
* Whether the regular expressions interfaces are compiled in
*/
#if 1
#define LIBXML_REGEXP_ENABLED
#endif
/**
* LIBXML_AUTOMATA_ENABLED:
*
* Whether the automata interfaces are compiled in
*/
#if 1
#define LIBXML_AUTOMATA_ENABLED
#endif
/**
* LIBXML_EXPR_ENABLED:
*
* Whether the formal expressions interfaces are compiled in
*/
#if 1
#define LIBXML_EXPR_ENABLED
#endif
/**
* LIBXML_SCHEMAS_ENABLED:
*
* Whether the Schemas validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMAS_ENABLED
#endif
/**
* LIBXML_SCHEMATRON_ENABLED:
*
* Whether the Schematron validation interfaces are compiled in
*/
#if 1
#define LIBXML_SCHEMATRON_ENABLED
#endif
/**
* LIBXML_MODULES_ENABLED:
*
* Whether the module interfaces are compiled in
*/
#if 1
#define LIBXML_MODULES_ENABLED
/**
* LIBXML_MODULE_EXTENSION:
*
* the string suffix used by dynamic modules (usually shared libraries)
*/
#define LIBXML_MODULE_EXTENSION ".so"
#endif
/**
* LIBXML_ZLIB_ENABLED:
*
* Whether the Zlib support is compiled in
*/
#if 0
#define LIBXML_ZLIB_ENABLED
#endif
/**
* LIBXML_LZMA_ENABLED:
*
* Whether the Lzma support is compiled in
*/
#if 0
#define LIBXML_LZMA_ENABLED
#endif
#ifdef __GNUC__
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
#ifndef ATTRIBUTE_UNUSED
# if ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
# define ATTRIBUTE_UNUSED __attribute__((unused))
# else
# define ATTRIBUTE_UNUSED
# endif
#endif
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#ifndef LIBXML_ATTR_ALLOC_SIZE
# if (!defined(__clang__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))))
# define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
# else
# define LIBXML_ATTR_ALLOC_SIZE(x)
# endif
#else
# define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#ifndef LIBXML_ATTR_FORMAT
# if ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
# define LIBXML_ATTR_FORMAT(fmt,args) __attribute__((__format__(__printf__,fmt,args)))
# else
# define LIBXML_ATTR_FORMAT(fmt,args)
# endif
#else
# define LIBXML_ATTR_FORMAT(fmt,args)
#endif
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
*
* Macro used to signal to GCC unused function parameters
*/
#define ATTRIBUTE_UNUSED
/**
* LIBXML_ATTR_ALLOC_SIZE:
*
* Macro used to indicate to GCC this is an allocator function
*/
#define LIBXML_ATTR_ALLOC_SIZE(x)
/**
* LIBXML_ATTR_FORMAT:
*
* Macro used to indicate to GCC the parameter are printf like
*/
#define LIBXML_ATTR_FORMAT(fmt,args)
#endif /* __GNUC__ */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,488 @@
/*
* Summary: text writing API for XML
* Description: text writing API for XML
*
* Copy: See Copyright for the status of this software.
*
* Author: Alfred Mickautsch <alfred@mickautsch.de>
*/
#ifndef __XML_XMLWRITER_H__
#define __XML_XMLWRITER_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_WRITER_ENABLED
#include <stdarg.h>
#include <libxml/xmlIO.h>
#include <libxml/list.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _xmlTextWriter xmlTextWriter;
typedef xmlTextWriter *xmlTextWriterPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriter(xmlOutputBufferPtr out);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterFilename(const char *uri, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterMemory(xmlBufferPtr buf, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterDoc(xmlDocPtr * doc, int compression);
XMLPUBFUN xmlTextWriterPtr XMLCALL
xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node,
int compression);
XMLPUBFUN void XMLCALL xmlFreeTextWriter(xmlTextWriterPtr writer);
/*
* Functions
*/
/*
* Document
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDocument(xmlTextWriterPtr writer,
const char *version,
const char *encoding,
const char *standalone);
XMLPUBFUN int XMLCALL xmlTextWriterEndDocument(xmlTextWriterPtr
writer);
/*
* Comments
*/
XMLPUBFUN int XMLCALL xmlTextWriterStartComment(xmlTextWriterPtr
writer);
XMLPUBFUN int XMLCALL xmlTextWriterEndComment(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatComment(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteComment(xmlTextWriterPtr
writer,
const xmlChar *
content);
/*
* Elements
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartElement(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterStartElementNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar * name,
const xmlChar *
namespaceURI);
XMLPUBFUN int XMLCALL xmlTextWriterEndElement(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL xmlTextWriterFullEndElement(xmlTextWriterPtr
writer);
/*
* Elements conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteElement(xmlTextWriterPtr
writer,
const xmlChar * name,
const xmlChar *
content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatElementNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatElementNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteElementNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar * name,
const xmlChar *
namespaceURI,
const xmlChar *
content);
/*
* Text
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatRaw(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatRaw(xmlTextWriterPtr writer,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteRawLen(xmlTextWriterPtr writer,
const xmlChar * content, int len);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteRaw(xmlTextWriterPtr writer,
const xmlChar * content);
XMLPUBFUN int XMLCALL xmlTextWriterWriteFormatString(xmlTextWriterPtr
writer,
const char
*format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL xmlTextWriterWriteVFormatString(xmlTextWriterPtr
writer,
const char
*format,
va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteString(xmlTextWriterPtr writer,
const xmlChar *
content);
XMLPUBFUN int XMLCALL xmlTextWriterWriteBase64(xmlTextWriterPtr writer,
const char *data,
int start, int len);
XMLPUBFUN int XMLCALL xmlTextWriterWriteBinHex(xmlTextWriterPtr writer,
const char *data,
int start, int len);
/*
* Attributes
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartAttribute(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterStartAttributeNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar *
name,
const xmlChar *
namespaceURI);
XMLPUBFUN int XMLCALL xmlTextWriterEndAttribute(xmlTextWriterPtr
writer);
/*
* Attributes conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatAttribute(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatAttribute(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttribute(xmlTextWriterPtr
writer,
const xmlChar * name,
const xmlChar *
content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatAttributeNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatAttributeNS(xmlTextWriterPtr writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteAttributeNS(xmlTextWriterPtr
writer,
const xmlChar *
prefix,
const xmlChar *
name,
const xmlChar *
namespaceURI,
const xmlChar *
content);
/*
* PI's
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartPI(xmlTextWriterPtr writer,
const xmlChar * target);
XMLPUBFUN int XMLCALL xmlTextWriterEndPI(xmlTextWriterPtr writer);
/*
* PI conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatPI(xmlTextWriterPtr writer,
const xmlChar * target,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatPI(xmlTextWriterPtr writer,
const xmlChar * target,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWritePI(xmlTextWriterPtr writer,
const xmlChar * target,
const xmlChar * content);
/**
* xmlTextWriterWriteProcessingInstruction:
*
* This macro maps to xmlTextWriterWritePI
*/
#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI
/*
* CDATA
*/
XMLPUBFUN int XMLCALL xmlTextWriterStartCDATA(xmlTextWriterPtr writer);
XMLPUBFUN int XMLCALL xmlTextWriterEndCDATA(xmlTextWriterPtr writer);
/*
* CDATA conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatCDATA(xmlTextWriterPtr writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatCDATA(xmlTextWriterPtr writer,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteCDATA(xmlTextWriterPtr writer,
const xmlChar * content);
/*
* DTD
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTD(xmlTextWriterPtr writer);
/*
* DTD conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTD(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * subset);
/**
* xmlTextWriterWriteDocType:
*
* this macro maps to xmlTextWriterWriteDTD
*/
#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD
/*
* DTD element definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDElement(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDElement(xmlTextWriterPtr
writer);
/*
* DTD element definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDElement(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDElement(xmlTextWriterPtr
writer,
const xmlChar *
name,
const xmlChar *
content);
/*
* DTD attribute list definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDAttlist(xmlTextWriterPtr
writer);
/*
* DTD attribute list definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriterPtr writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDAttlist(xmlTextWriterPtr
writer,
const xmlChar *
name,
const xmlChar *
content);
/*
* DTD entity definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer,
int pe, const xmlChar * name);
XMLPUBFUN int XMLCALL xmlTextWriterEndDTDEntity(xmlTextWriterPtr
writer);
/*
* DTD entity definition conveniency functions
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(4,5);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(4,0);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDInternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * content);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDExternalEntity(xmlTextWriterPtr writer,
int pe,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid);
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr
writer,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar *
ndataid);
XMLPUBFUN int XMLCALL xmlTextWriterWriteDTDEntity(xmlTextWriterPtr
writer, int pe,
const xmlChar * name,
const xmlChar *
pubid,
const xmlChar *
sysid,
const xmlChar *
ndataid,
const xmlChar *
content);
/*
* DTD notation definition
*/
XMLPUBFUN int XMLCALL
xmlTextWriterWriteDTDNotation(xmlTextWriterPtr writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid);
/*
* Indentation
*/
XMLPUBFUN int XMLCALL
xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent);
XMLPUBFUN int XMLCALL
xmlTextWriterSetIndentString(xmlTextWriterPtr writer,
const xmlChar * str);
XMLPUBFUN int XMLCALL
xmlTextWriterSetQuoteChar(xmlTextWriterPtr writer, xmlChar quotechar);
/*
* misc
*/
XMLPUBFUN int XMLCALL xmlTextWriterFlush(xmlTextWriterPtr writer);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_WRITER_ENABLED */
#endif /* __XML_XMLWRITER_H__ */

View File

@ -0,0 +1,557 @@
/*
* Summary: XML Path Language implementation
* Description: API for the XML Path Language implementation
*
* XML Path Language implementation
* XPath is a language for addressing parts of an XML document,
* designed to be used by both XSLT and XPointer
* http://www.w3.org/TR/xpath
*
* Implements
* W3C Recommendation 16 November 1999
* http://www.w3.org/TR/1999/REC-xpath-19991116
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XPATH_H__
#define __XML_XPATH_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_XPATH_ENABLED
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/hash.h>
#endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
#ifdef __cplusplus
extern "C" {
#endif
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */
#ifdef LIBXML_XPATH_ENABLED
typedef struct _xmlXPathContext xmlXPathContext;
typedef xmlXPathContext *xmlXPathContextPtr;
typedef struct _xmlXPathParserContext xmlXPathParserContext;
typedef xmlXPathParserContext *xmlXPathParserContextPtr;
/**
* The set of XPath error codes.
*/
typedef enum {
XPATH_EXPRESSION_OK = 0,
XPATH_NUMBER_ERROR,
XPATH_UNFINISHED_LITERAL_ERROR,
XPATH_START_LITERAL_ERROR,
XPATH_VARIABLE_REF_ERROR,
XPATH_UNDEF_VARIABLE_ERROR,
XPATH_INVALID_PREDICATE_ERROR,
XPATH_EXPR_ERROR,
XPATH_UNCLOSED_ERROR,
XPATH_UNKNOWN_FUNC_ERROR,
XPATH_INVALID_OPERAND,
XPATH_INVALID_TYPE,
XPATH_INVALID_ARITY,
XPATH_INVALID_CTXT_SIZE,
XPATH_INVALID_CTXT_POSITION,
XPATH_MEMORY_ERROR,
XPTR_SYNTAX_ERROR,
XPTR_RESOURCE_ERROR,
XPTR_SUB_RESOURCE_ERROR,
XPATH_UNDEF_PREFIX_ERROR,
XPATH_ENCODING_ERROR,
XPATH_INVALID_CHAR_ERROR,
XPATH_INVALID_CTXT,
XPATH_STACK_ERROR,
XPATH_FORBID_VARIABLE_ERROR
} xmlXPathError;
/*
* A node-set (an unordered collection of nodes without duplicates).
*/
typedef struct _xmlNodeSet xmlNodeSet;
typedef xmlNodeSet *xmlNodeSetPtr;
struct _xmlNodeSet {
int nodeNr; /* number of nodes in the set */
int nodeMax; /* size of the array as allocated */
xmlNodePtr *nodeTab; /* array of nodes in no particular order */
/* @@ with_ns to check wether namespace nodes should be looked at @@ */
};
/*
* An expression is evaluated to yield an object, which
* has one of the following four basic types:
* - node-set
* - boolean
* - number
* - string
*
* @@ XPointer will add more types !
*/
typedef enum {
XPATH_UNDEFINED = 0,
XPATH_NODESET = 1,
XPATH_BOOLEAN = 2,
XPATH_NUMBER = 3,
XPATH_STRING = 4,
XPATH_POINT = 5,
XPATH_RANGE = 6,
XPATH_LOCATIONSET = 7,
XPATH_USERS = 8,
XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
} xmlXPathObjectType;
typedef struct _xmlXPathObject xmlXPathObject;
typedef xmlXPathObject *xmlXPathObjectPtr;
struct _xmlXPathObject {
xmlXPathObjectType type;
xmlNodeSetPtr nodesetval;
int boolval;
double floatval;
xmlChar *stringval;
void *user;
int index;
void *user2;
int index2;
};
/**
* xmlXPathConvertFunc:
* @obj: an XPath object
* @type: the number of the target type
*
* A conversion function is associated to a type and used to cast
* the new type to primitive values.
*
* Returns -1 in case of error, 0 otherwise
*/
typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
/*
* Extra type: a name and a conversion function.
*/
typedef struct _xmlXPathType xmlXPathType;
typedef xmlXPathType *xmlXPathTypePtr;
struct _xmlXPathType {
const xmlChar *name; /* the type name */
xmlXPathConvertFunc func; /* the conversion function */
};
/*
* Extra variable: a name and a value.
*/
typedef struct _xmlXPathVariable xmlXPathVariable;
typedef xmlXPathVariable *xmlXPathVariablePtr;
struct _xmlXPathVariable {
const xmlChar *name; /* the variable name */
xmlXPathObjectPtr value; /* the value */
};
/**
* xmlXPathEvalFunc:
* @ctxt: an XPath parser context
* @nargs: the number of arguments passed to the function
*
* An XPath evaluation function, the parameters are on the XPath context stack.
*/
typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
int nargs);
/*
* Extra function: a name and a evaluation function.
*/
typedef struct _xmlXPathFunct xmlXPathFunct;
typedef xmlXPathFunct *xmlXPathFuncPtr;
struct _xmlXPathFunct {
const xmlChar *name; /* the function name */
xmlXPathEvalFunc func; /* the evaluation function */
};
/**
* xmlXPathAxisFunc:
* @ctxt: the XPath interpreter context
* @cur: the previous node being explored on that axis
*
* An axis traversal function. To traverse an axis, the engine calls
* the first time with cur == NULL and repeat until the function returns
* NULL indicating the end of the axis traversal.
*
* Returns the next node in that axis or NULL if at the end of the axis.
*/
typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr cur);
/*
* Extra axis: a name and an axis function.
*/
typedef struct _xmlXPathAxis xmlXPathAxis;
typedef xmlXPathAxis *xmlXPathAxisPtr;
struct _xmlXPathAxis {
const xmlChar *name; /* the axis name */
xmlXPathAxisFunc func; /* the search function */
};
/**
* xmlXPathFunction:
* @ctxt: the XPath interprestation context
* @nargs: the number of arguments
*
* An XPath function.
* The arguments (if any) are popped out from the context stack
* and the result is pushed on the stack.
*/
typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
/*
* Function and Variable Lookup.
*/
/**
* xmlXPathVariableLookupFunc:
* @ctxt: an XPath context
* @name: name of the variable
* @ns_uri: the namespace name hosting this variable
*
* Prototype for callbacks used to plug variable lookup in the XPath
* engine.
*
* Returns the XPath object value or NULL if not found.
*/
typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
/**
* xmlXPathFuncLookupFunc:
* @ctxt: an XPath context
* @name: name of the function
* @ns_uri: the namespace name hosting this function
*
* Prototype for callbacks used to plug function lookup in the XPath
* engine.
*
* Returns the XPath function or NULL if not found.
*/
typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
/**
* xmlXPathFlags:
* Flags for XPath engine compilation and runtime
*/
/**
* XML_XPATH_CHECKNS:
*
* check namespaces at compilation
*/
#define XML_XPATH_CHECKNS (1<<0)
/**
* XML_XPATH_NOVAR:
*
* forbid variables in expression
*/
#define XML_XPATH_NOVAR (1<<1)
/**
* xmlXPathContext:
*
* Expression evaluation occurs with respect to a context.
* he context consists of:
* - a node (the context node)
* - a node list (the context node list)
* - a set of variable bindings
* - a function library
* - the set of namespace declarations in scope for the expression
* Following the switch to hash tables, this need to be trimmed up at
* the next binary incompatible release.
* The node may be modified when the context is passed to libxml2
* for an XPath evaluation so you may need to initialize it again
* before the next call.
*/
struct _xmlXPathContext {
xmlDocPtr doc; /* The current document */
xmlNodePtr node; /* The current node */
int nb_variables_unused; /* unused (hash table) */
int max_variables_unused; /* unused (hash table) */
xmlHashTablePtr varHash; /* Hash table of defined variables */
int nb_types; /* number of defined types */
int max_types; /* max number of types */
xmlXPathTypePtr types; /* Array of defined types */
int nb_funcs_unused; /* unused (hash table) */
int max_funcs_unused; /* unused (hash table) */
xmlHashTablePtr funcHash; /* Hash table of defined funcs */
int nb_axis; /* number of defined axis */
int max_axis; /* max number of axis */
xmlXPathAxisPtr axis; /* Array of defined axis */
/* the namespace nodes of the context node */
xmlNsPtr *namespaces; /* Array of namespaces */
int nsNr; /* number of namespace in scope */
void *user; /* function to free */
/* extra variables */
int contextSize; /* the context size */
int proximityPosition; /* the proximity position */
/* extra stuff for XPointer */
int xptr; /* is this an XPointer context? */
xmlNodePtr here; /* for here() */
xmlNodePtr origin; /* for origin() */
/* the set of namespace declarations in scope for the expression */
xmlHashTablePtr nsHash; /* The namespaces hash table */
xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */
void *varLookupData; /* variable lookup data */
/* Possibility to link in an extra item */
void *extra; /* needed for XSLT */
/* The function name and URI when calling a function */
const xmlChar *function;
const xmlChar *functionURI;
/* function lookup function and data */
xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */
void *funcLookupData; /* function lookup data */
/* temporary namespace lists kept for walking the namespace axis */
xmlNsPtr *tmpNsList; /* Array of namespaces */
int tmpNsNr; /* number of namespaces in scope */
/* error reporting mechanism */
void *userData; /* user specific data block */
xmlStructuredErrorFunc error; /* the callback in case of errors */
xmlError lastError; /* the last error */
xmlNodePtr debugNode; /* the source node XSLT */
/* dictionary */
xmlDictPtr dict; /* dictionary if any */
int flags; /* flags to control compilation */
/* Cache for reusal of XPath objects */
void *cache;
};
/*
* The structure of a compiled expression form is not public.
*/
typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
/**
* xmlXPathParserContext:
*
* An XPath parser context. It contains pure parsing informations,
* an xmlXPathContext, and the stack of objects.
*/
struct _xmlXPathParserContext {
const xmlChar *cur; /* the current char being parsed */
const xmlChar *base; /* the full expression */
int error; /* error code */
xmlXPathContextPtr context; /* the evaluation context */
xmlXPathObjectPtr value; /* the current value */
int valueNr; /* number of values stacked */
int valueMax; /* max number of values stacked */
xmlXPathObjectPtr *valueTab; /* stack of values */
xmlXPathCompExprPtr comp; /* the precompiled expression */
int xptr; /* it this an XPointer expression */
xmlNodePtr ancestor; /* used for walking preceding axis */
int valueFrame; /* used to limit Pop on the stack */
};
/************************************************************************
* *
* Public API *
* *
************************************************************************/
/**
* Objects and Nodesets handling
*/
XMLPUBVAR double xmlXPathNAN;
XMLPUBVAR double xmlXPathPINF;
XMLPUBVAR double xmlXPathNINF;
/* These macros may later turn into functions */
/**
* xmlXPathNodeSetGetLength:
* @ns: a node-set
*
* Implement a functionality similar to the DOM NodeList.length.
*
* Returns the number of nodes in the node-set.
*/
#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
/**
* xmlXPathNodeSetItem:
* @ns: a node-set
* @index: index of a node in the set
*
* Implements a functionality similar to the DOM NodeList.item().
*
* Returns the xmlNodePtr at the given @index in @ns or NULL if
* @index is out of range (0 to length-1)
*/
#define xmlXPathNodeSetItem(ns, index) \
((((ns) != NULL) && \
((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
(ns)->nodeTab[(index)] \
: NULL)
/**
* xmlXPathNodeSetIsEmpty:
* @ns: a node-set
*
* Checks whether @ns is empty or not.
*
* Returns %TRUE if @ns is an empty node-set.
*/
#define xmlXPathNodeSetIsEmpty(ns) \
(((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
XMLPUBFUN void XMLCALL
xmlXPathFreeObject (xmlXPathObjectPtr obj);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeSetCreate (xmlNodePtr val);
XMLPUBFUN void XMLCALL
xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
XMLPUBFUN void XMLCALL
xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathObjectCopy (xmlXPathObjectPtr val);
XMLPUBFUN int XMLCALL
xmlXPathCmpNodes (xmlNodePtr node1,
xmlNodePtr node2);
/**
* Conversion functions to basic types.
*/
XMLPUBFUN int XMLCALL
xmlXPathCastNumberToBoolean (double val);
XMLPUBFUN int XMLCALL
xmlXPathCastStringToBoolean (const xmlChar * val);
XMLPUBFUN int XMLCALL
xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
XMLPUBFUN int XMLCALL
xmlXPathCastToBoolean (xmlXPathObjectPtr val);
XMLPUBFUN double XMLCALL
xmlXPathCastBooleanToNumber (int val);
XMLPUBFUN double XMLCALL
xmlXPathCastStringToNumber (const xmlChar * val);
XMLPUBFUN double XMLCALL
xmlXPathCastNodeToNumber (xmlNodePtr node);
XMLPUBFUN double XMLCALL
xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
XMLPUBFUN double XMLCALL
xmlXPathCastToNumber (xmlXPathObjectPtr val);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastBooleanToString (int val);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNumberToString (double val);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNodeToString (xmlNodePtr node);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathCastToString (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertBoolean (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertNumber (xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathConvertString (xmlXPathObjectPtr val);
/**
* Context handling.
*/
XMLPUBFUN xmlXPathContextPtr XMLCALL
xmlXPathNewContext (xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlXPathFreeContext (xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
int active,
int value,
int options);
/**
* Evaluation functions.
*/
XMLPUBFUN long XMLCALL
xmlXPathOrderDocElems (xmlDocPtr doc);
XMLPUBFUN int XMLCALL
xmlXPathSetContextNode (xmlNodePtr node,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNodeEval (xmlNodePtr node,
const xmlChar *str,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathEval (const xmlChar *str,
xmlXPathContextPtr ctx);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathEvalExpression (const xmlChar *str,
xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
xmlXPathObjectPtr res);
/**
* Separate compilation/evaluation entry points.
*/
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
xmlXPathCompile (const xmlChar *str);
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
const xmlChar *str);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctx);
XMLPUBFUN int XMLCALL
xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
xmlXPathContextPtr ctxt);
XMLPUBFUN void XMLCALL
xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
#endif /* LIBXML_XPATH_ENABLED */
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
XMLPUBFUN void XMLCALL
xmlXPathInit (void);
XMLPUBFUN int XMLCALL
xmlXPathIsNaN (double val);
XMLPUBFUN int XMLCALL
xmlXPathIsInf (double val);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
#endif /* ! __XML_XPATH_H__ */

View File

@ -0,0 +1,632 @@
/*
* Summary: internal interfaces for XML Path Language implementation
* Description: internal interfaces for XML Path Language implementation
* used to build new modules on top of XPath like XPointer and
* XSLT
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XPATH_INTERNALS_H__
#define __XML_XPATH_INTERNALS_H__
#include <libxml/xmlversion.h>
#include <libxml/xpath.h>
#ifdef LIBXML_XPATH_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/************************************************************************
* *
* Helpers *
* *
************************************************************************/
/*
* Many of these macros may later turn into functions. They
* shouldn't be used in #ifdef's preprocessor instructions.
*/
/**
* xmlXPathSetError:
* @ctxt: an XPath parser context
* @err: an xmlXPathError code
*
* Raises an error.
*/
#define xmlXPathSetError(ctxt, err) \
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
if ((ctxt) != NULL) (ctxt)->error = (err); }
/**
* xmlXPathSetArityError:
* @ctxt: an XPath parser context
*
* Raises an XPATH_INVALID_ARITY error.
*/
#define xmlXPathSetArityError(ctxt) \
xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
/**
* xmlXPathSetTypeError:
* @ctxt: an XPath parser context
*
* Raises an XPATH_INVALID_TYPE error.
*/
#define xmlXPathSetTypeError(ctxt) \
xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
/**
* xmlXPathGetError:
* @ctxt: an XPath parser context
*
* Get the error code of an XPath context.
*
* Returns the context error.
*/
#define xmlXPathGetError(ctxt) ((ctxt)->error)
/**
* xmlXPathCheckError:
* @ctxt: an XPath parser context
*
* Check if an XPath error was raised.
*
* Returns true if an error has been raised, false otherwise.
*/
#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK)
/**
* xmlXPathGetDocument:
* @ctxt: an XPath parser context
*
* Get the document of an XPath context.
*
* Returns the context document.
*/
#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc)
/**
* xmlXPathGetContextNode:
* @ctxt: an XPath parser context
*
* Get the context node of an XPath context.
*
* Returns the context node.
*/
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
XMLPUBFUN int XMLCALL
xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt);
XMLPUBFUN double XMLCALL
xmlXPathPopNumber (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathPopString (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt);
XMLPUBFUN void * XMLCALL
xmlXPathPopExternal (xmlXPathParserContextPtr ctxt);
/**
* xmlXPathReturnBoolean:
* @ctxt: an XPath parser context
* @val: a boolean
*
* Pushes the boolean @val on the context stack.
*/
#define xmlXPathReturnBoolean(ctxt, val) \
valuePush((ctxt), xmlXPathNewBoolean(val))
/**
* xmlXPathReturnTrue:
* @ctxt: an XPath parser context
*
* Pushes true on the context stack.
*/
#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1)
/**
* xmlXPathReturnFalse:
* @ctxt: an XPath parser context
*
* Pushes false on the context stack.
*/
#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0)
/**
* xmlXPathReturnNumber:
* @ctxt: an XPath parser context
* @val: a double
*
* Pushes the double @val on the context stack.
*/
#define xmlXPathReturnNumber(ctxt, val) \
valuePush((ctxt), xmlXPathNewFloat(val))
/**
* xmlXPathReturnString:
* @ctxt: an XPath parser context
* @str: a string
*
* Pushes the string @str on the context stack.
*/
#define xmlXPathReturnString(ctxt, str) \
valuePush((ctxt), xmlXPathWrapString(str))
/**
* xmlXPathReturnEmptyString:
* @ctxt: an XPath parser context
*
* Pushes an empty string on the stack.
*/
#define xmlXPathReturnEmptyString(ctxt) \
valuePush((ctxt), xmlXPathNewCString(""))
/**
* xmlXPathReturnNodeSet:
* @ctxt: an XPath parser context
* @ns: a node-set
*
* Pushes the node-set @ns on the context stack.
*/
#define xmlXPathReturnNodeSet(ctxt, ns) \
valuePush((ctxt), xmlXPathWrapNodeSet(ns))
/**
* xmlXPathReturnEmptyNodeSet:
* @ctxt: an XPath parser context
*
* Pushes an empty node-set on the context stack.
*/
#define xmlXPathReturnEmptyNodeSet(ctxt) \
valuePush((ctxt), xmlXPathNewNodeSet(NULL))
/**
* xmlXPathReturnExternal:
* @ctxt: an XPath parser context
* @val: user data
*
* Pushes user data on the context stack.
*/
#define xmlXPathReturnExternal(ctxt, val) \
valuePush((ctxt), xmlXPathWrapExternal(val))
/**
* xmlXPathStackIsNodeSet:
* @ctxt: an XPath parser context
*
* Check if the current value on the XPath stack is a node set or
* an XSLT value tree.
*
* Returns true if the current object on the stack is a node-set.
*/
#define xmlXPathStackIsNodeSet(ctxt) \
(((ctxt)->value != NULL) \
&& (((ctxt)->value->type == XPATH_NODESET) \
|| ((ctxt)->value->type == XPATH_XSLT_TREE)))
/**
* xmlXPathStackIsExternal:
* @ctxt: an XPath parser context
*
* Checks if the current value on the XPath stack is an external
* object.
*
* Returns true if the current object on the stack is an external
* object.
*/
#define xmlXPathStackIsExternal(ctxt) \
((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
/**
* xmlXPathEmptyNodeSet:
* @ns: a node-set
*
* Empties a node-set.
*/
#define xmlXPathEmptyNodeSet(ns) \
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; }
/**
* CHECK_ERROR:
*
* Macro to return from the function if an XPath error was detected.
*/
#define CHECK_ERROR \
if (ctxt->error != XPATH_EXPRESSION_OK) return
/**
* CHECK_ERROR0:
*
* Macro to return 0 from the function if an XPath error was detected.
*/
#define CHECK_ERROR0 \
if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
/**
* XP_ERROR:
* @X: the error code
*
* Macro to raise an XPath error and return.
*/
#define XP_ERROR(X) \
{ xmlXPathErr(ctxt, X); return; }
/**
* XP_ERROR0:
* @X: the error code
*
* Macro to raise an XPath error and return 0.
*/
#define XP_ERROR0(X) \
{ xmlXPathErr(ctxt, X); return(0); }
/**
* CHECK_TYPE:
* @typeval: the XPath type
*
* Macro to check that the value on top of the XPath stack is of a given
* type.
*/
#define CHECK_TYPE(typeval) \
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
XP_ERROR(XPATH_INVALID_TYPE)
/**
* CHECK_TYPE0:
* @typeval: the XPath type
*
* Macro to check that the value on top of the XPath stack is of a given
* type. Return(0) in case of failure
*/
#define CHECK_TYPE0(typeval) \
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
XP_ERROR0(XPATH_INVALID_TYPE)
/**
* CHECK_ARITY:
* @x: the number of expected args
*
* Macro to check that the number of args passed to an XPath function matches.
*/
#define CHECK_ARITY(x) \
if (ctxt == NULL) return; \
if (nargs != (x)) \
XP_ERROR(XPATH_INVALID_ARITY); \
if (ctxt->valueNr < ctxt->valueFrame + (x)) \
XP_ERROR(XPATH_STACK_ERROR);
/**
* CAST_TO_STRING:
*
* Macro to try to cast the value on the top of the XPath stack to a string.
*/
#define CAST_TO_STRING \
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
xmlXPathStringFunction(ctxt, 1);
/**
* CAST_TO_NUMBER:
*
* Macro to try to cast the value on the top of the XPath stack to a number.
*/
#define CAST_TO_NUMBER \
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
xmlXPathNumberFunction(ctxt, 1);
/**
* CAST_TO_BOOLEAN:
*
* Macro to try to cast the value on the top of the XPath stack to a boolean.
*/
#define CAST_TO_BOOLEAN \
if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
xmlXPathBooleanFunction(ctxt, 1);
/*
* Variable Lookup forwarding.
*/
XMLPUBFUN void XMLCALL
xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
xmlXPathVariableLookupFunc f,
void *data);
/*
* Function Lookup forwarding.
*/
XMLPUBFUN void XMLCALL
xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
xmlXPathFuncLookupFunc f,
void *funcCtxt);
/*
* Error reporting.
*/
XMLPUBFUN void XMLCALL
xmlXPatherror (xmlXPathParserContextPtr ctxt,
const char *file,
int line,
int no);
XMLPUBFUN void XMLCALL
xmlXPathErr (xmlXPathParserContextPtr ctxt,
int error);
#ifdef LIBXML_DEBUG_ENABLED
XMLPUBFUN void XMLCALL
xmlXPathDebugDumpObject (FILE *output,
xmlXPathObjectPtr cur,
int depth);
XMLPUBFUN void XMLCALL
xmlXPathDebugDumpCompExpr(FILE *output,
xmlXPathCompExprPtr comp,
int depth);
#endif
/**
* NodeSet handling.
*/
XMLPUBFUN int XMLCALL
xmlXPathNodeSetContains (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathDifference (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathIntersection (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathDistinctSorted (xmlNodeSetPtr nodes);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathDistinct (xmlNodeSetPtr nodes);
XMLPUBFUN int XMLCALL
xmlXPathHasSameNodes (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathLeadingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeLeading (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathLeading (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathTrailingSorted (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeTrailing (xmlNodeSetPtr nodes,
xmlNodePtr node);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathTrailing (xmlNodeSetPtr nodes1,
xmlNodeSetPtr nodes2);
/**
* Extending a context.
*/
XMLPUBFUN int XMLCALL
xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
const xmlChar *prefix,
const xmlChar *ns_uri);
XMLPUBFUN const xmlChar * XMLCALL
xmlXPathNsLookup (xmlXPathContextPtr ctxt,
const xmlChar *prefix);
XMLPUBFUN void XMLCALL
xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
XMLPUBFUN int XMLCALL
xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
const xmlChar *name,
xmlXPathFunction f);
XMLPUBFUN int XMLCALL
xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri,
xmlXPathFunction f);
XMLPUBFUN int XMLCALL
xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
const xmlChar *name,
xmlXPathObjectPtr value);
XMLPUBFUN int XMLCALL
xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri,
xmlXPathObjectPtr value);
XMLPUBFUN xmlXPathFunction XMLCALL
xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
const xmlChar *name);
XMLPUBFUN xmlXPathFunction XMLCALL
xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
XMLPUBFUN void XMLCALL
xmlXPathRegisteredFuncsCleanup (xmlXPathContextPtr ctxt);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
const xmlChar *name);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
XMLPUBFUN void XMLCALL
xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
/**
* Utilities to extend XPath.
*/
XMLPUBFUN xmlXPathParserContextPtr XMLCALL
xmlXPathNewParserContext (const xmlChar *str,
xmlXPathContextPtr ctxt);
XMLPUBFUN void XMLCALL
xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
/* TODO: remap to xmlXPathValuePop and Push. */
XMLPUBFUN xmlXPathObjectPtr XMLCALL
valuePop (xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL
valuePush (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr value);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewString (const xmlChar *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewCString (const char *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathWrapString (xmlChar *val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathWrapCString (char * val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewFloat (double val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewBoolean (int val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewNodeSet (xmlNodePtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewValueTree (xmlNodePtr val);
XMLPUBFUN int XMLCALL
xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN int XMLCALL
xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN int XMLCALL
xmlXPathNodeSetAddNs (xmlNodeSetPtr cur,
xmlNodePtr node,
xmlNsPtr ns);
XMLPUBFUN void XMLCALL
xmlXPathNodeSetSort (xmlNodeSetPtr set);
XMLPUBFUN void XMLCALL
xmlXPathRoot (xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL
xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathParseName (xmlXPathParserContextPtr ctxt);
XMLPUBFUN xmlChar * XMLCALL
xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
/*
* Existing functions.
*/
XMLPUBFUN double XMLCALL
xmlXPathStringEvalNumber (const xmlChar *str);
XMLPUBFUN int XMLCALL
xmlXPathEvaluatePredicateResult (xmlXPathParserContextPtr ctxt,
xmlXPathObjectPtr res);
XMLPUBFUN void XMLCALL
xmlXPathRegisterAllFunctions (xmlXPathContextPtr ctxt);
XMLPUBFUN xmlNodeSetPtr XMLCALL
xmlXPathNodeSetMerge (xmlNodeSetPtr val1,
xmlNodeSetPtr val2);
XMLPUBFUN void XMLCALL
xmlXPathNodeSetDel (xmlNodeSetPtr cur,
xmlNodePtr val);
XMLPUBFUN void XMLCALL
xmlXPathNodeSetRemove (xmlNodeSetPtr cur,
int val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathNewNodeSetList (xmlNodeSetPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathWrapNodeSet (xmlNodeSetPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPathWrapExternal (void *val);
XMLPUBFUN int XMLCALL xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
XMLPUBFUN void XMLCALL xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN void XMLCALL xmlXPathModValues(xmlXPathParserContextPtr ctxt);
XMLPUBFUN int XMLCALL xmlXPathIsNodeType(const xmlChar *name);
/*
* Some of the axis navigation routines.
*/
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextChild(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextParent(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
XMLPUBFUN xmlNodePtr XMLCALL xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt,
xmlNodePtr cur);
/*
* The official core of XPath functions.
*/
XMLPUBFUN void XMLCALL xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
XMLPUBFUN void XMLCALL xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
/**
* Really internal functions
*/
XMLPUBFUN void XMLCALL xmlXPathNodeSetFreeNs(xmlNsPtr ns);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPATH_ENABLED */
#endif /* ! __XML_XPATH_INTERNALS_H__ */

View File

@ -0,0 +1,114 @@
/*
* Summary: API to handle XML Pointers
* Description: API to handle XML Pointers
* Base implementation was made accordingly to
* W3C Candidate Recommendation 7 June 2000
* http://www.w3.org/TR/2000/CR-xptr-20000607
*
* Added support for the element() scheme described in:
* W3C Proposed Recommendation 13 November 2002
* http://www.w3.org/TR/2002/PR-xptr-element-20021113/
*
* Copy: See Copyright for the status of this software.
*
* Author: Daniel Veillard
*/
#ifndef __XML_XPTR_H__
#define __XML_XPTR_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_XPTR_ENABLED
#include <libxml/tree.h>
#include <libxml/xpath.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* A Location Set
*/
typedef struct _xmlLocationSet xmlLocationSet;
typedef xmlLocationSet *xmlLocationSetPtr;
struct _xmlLocationSet {
int locNr; /* number of locations in the set */
int locMax; /* size of the array as allocated */
xmlXPathObjectPtr *locTab;/* array of locations */
};
/*
* Handling of location sets.
*/
XMLPUBFUN xmlLocationSetPtr XMLCALL
xmlXPtrLocationSetCreate (xmlXPathObjectPtr val);
XMLPUBFUN void XMLCALL
xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
XMLPUBFUN xmlLocationSetPtr XMLCALL
xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
xmlLocationSetPtr val2);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRange (xmlNodePtr start,
int startindex,
xmlNodePtr end,
int endindex);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangePoints (xmlXPathObjectPtr start,
xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodePoint (xmlNodePtr start,
xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangePointNode (xmlXPathObjectPtr start,
xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodes (xmlNodePtr start,
xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewLocationSetNodes (xmlNodePtr start,
xmlNodePtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewRangeNodeObject (xmlNodePtr start,
xmlXPathObjectPtr end);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrNewCollapsedRange (xmlNodePtr start);
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetAdd (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrWrapLocationSet (xmlLocationSetPtr val);
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetDel (xmlLocationSetPtr cur,
xmlXPathObjectPtr val);
XMLPUBFUN void XMLCALL
xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
int val);
/*
* Functions.
*/
XMLPUBFUN xmlXPathContextPtr XMLCALL
xmlXPtrNewContext (xmlDocPtr doc,
xmlNodePtr here,
xmlNodePtr origin);
XMLPUBFUN xmlXPathObjectPtr XMLCALL
xmlXPtrEval (const xmlChar *str,
xmlXPathContextPtr ctx);
XMLPUBFUN void XMLCALL
xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
int nargs);
XMLPUBFUN xmlNodePtr XMLCALL
xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
XMLPUBFUN void XMLCALL
xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPTR_ENABLED */
#endif /* __XML_XPTR_H__ */

View File

@ -0,0 +1,163 @@
/* ltdl.h -- generic dlopen functions
Copyright (C) 1998-2000, 2004-2005, 2007-2008, 2011-2015 Free
Software Foundation, Inc.
Written by Thomas Tanner, 1998
NOTE: The canonical source of this file is maintained with the
GNU Libtool package. Report bugs to bug-libtool@gnu.org.
GNU Libltdl is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
As a special exception to the GNU Lesser General Public License,
if you distribute this file as part of a program or library that
is built using GNU Libtool, you may include this file under the
same distribution terms that you use for the rest of that program.
GNU Libltdl 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 GNU Libltdl; see the file COPYING.LIB. If not, a
copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
or obtained by writing to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Only include this header file once. */
#if !defined LTDL_H
#define LTDL_H 1
#include <libltdl/lt_system.h>
#include <libltdl/lt_error.h>
#include <libltdl/lt_dlloader.h>
LT_BEGIN_C_DECLS
/* LT_STRLEN can be used safely on NULL pointers. */
#define LT_STRLEN(s) (((s) && (s)[0]) ? strlen (s) : 0)
/* --- DYNAMIC MODULE LOADING API --- */
typedef struct lt__handle *lt_dlhandle; /* A loaded module. */
/* Initialisation and finalisation functions for libltdl. */
LT_SCOPE int lt_dlinit (void);
LT_SCOPE int lt_dlexit (void);
/* Module search path manipulation. */
LT_SCOPE int lt_dladdsearchdir (const char *search_dir);
LT_SCOPE int lt_dlinsertsearchdir (const char *before,
const char *search_dir);
LT_SCOPE int lt_dlsetsearchpath (const char *search_path);
LT_SCOPE const char *lt_dlgetsearchpath (void);
LT_SCOPE int lt_dlforeachfile (
const char *search_path,
int (*func) (const char *filename, void *data),
void *data);
/* User module loading advisors. */
LT_SCOPE int lt_dladvise_init (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_destroy (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_ext (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_resident (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_local (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_global (lt_dladvise *advise);
LT_SCOPE int lt_dladvise_preload (lt_dladvise *advise);
/* Portable libltdl versions of the system dlopen() API. */
LT_SCOPE lt_dlhandle lt_dlopen (const char *filename);
LT_SCOPE lt_dlhandle lt_dlopenext (const char *filename);
LT_SCOPE lt_dlhandle lt_dlopenadvise (const char *filename,
lt_dladvise advise);
LT_SCOPE void * lt_dlsym (lt_dlhandle handle, const char *name);
LT_SCOPE const char *lt_dlerror (void);
LT_SCOPE int lt_dlclose (lt_dlhandle handle);
/* --- PRELOADED MODULE SUPPORT --- */
/* A preopened symbol. Arrays of this type comprise the exported
symbols for a dlpreopened module. */
typedef struct {
const char *name;
void *address;
} lt_dlsymlist;
typedef int lt_dlpreload_callback_func (lt_dlhandle handle);
LT_SCOPE int lt_dlpreload (const lt_dlsymlist *preloaded);
LT_SCOPE int lt_dlpreload_default (const lt_dlsymlist *preloaded);
LT_SCOPE int lt_dlpreload_open (const char *originator,
lt_dlpreload_callback_func *func);
#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols
/* Ensure C linkage. */
extern LT_DLSYM_CONST lt_dlsymlist lt__PROGRAM__LTX_preloaded_symbols[];
#define LTDL_SET_PRELOADED_SYMBOLS() \
lt_dlpreload_default(lt_preloaded_symbols)
/* --- MODULE INFORMATION --- */
/* Associating user data with loaded modules. */
typedef void * lt_dlinterface_id;
typedef int lt_dlhandle_interface (lt_dlhandle handle, const char *id_string);
LT_SCOPE lt_dlinterface_id lt_dlinterface_register (const char *id_string,
lt_dlhandle_interface *iface);
LT_SCOPE void lt_dlinterface_free (lt_dlinterface_id key);
LT_SCOPE void * lt_dlcaller_set_data (lt_dlinterface_id key,
lt_dlhandle handle, void *data);
LT_SCOPE void * lt_dlcaller_get_data (lt_dlinterface_id key,
lt_dlhandle handle);
/* Read only information pertaining to a loaded module. */
typedef struct {
char * filename; /* file name */
char * name; /* module name */
int ref_count; /* number of times lt_dlopened minus
number of times lt_dlclosed. */
unsigned int is_resident:1; /* module can't be unloaded. */
unsigned int is_symglobal:1; /* module symbols can satisfy
subsequently loaded modules. */
unsigned int is_symlocal:1; /* module symbols are only available
locally. */
} lt_dlinfo;
LT_SCOPE const lt_dlinfo *lt_dlgetinfo (lt_dlhandle handle);
LT_SCOPE lt_dlhandle lt_dlhandle_iterate (lt_dlinterface_id iface,
lt_dlhandle place);
LT_SCOPE lt_dlhandle lt_dlhandle_fetch (lt_dlinterface_id iface,
const char *module_name);
LT_SCOPE int lt_dlhandle_map (lt_dlinterface_id iface,
int (*func) (lt_dlhandle handle, void *data),
void *data);
/* Deprecated module residency management API. */
LT_SCOPE int lt_dlmakeresident (lt_dlhandle handle);
LT_SCOPE int lt_dlisresident (lt_dlhandle handle);
#define lt_ptr void *
LT_END_C_DECLS
#endif /*!defined LTDL_H*/

View File

@ -0,0 +1,269 @@
/* mpc.h -- Include file for mpc.
Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015 INRIA
This file is part of GNU MPC.
GNU MPC 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 3 of the License, or (at your
option) any later version.
GNU MPC 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 program. If not, see http://www.gnu.org/licenses/ .
*/
#ifndef __MPC_H
#define __MPC_H
#include "gmp.h"
#include "mpfr.h"
/* Backwards compatibility with mpfr<3.0.0 */
#ifndef mpfr_exp_t
#define mpfr_exp_t mp_exp_t
#endif
/* Define MPC version number */
#define MPC_VERSION_MAJOR 1
#define MPC_VERSION_MINOR 0
#define MPC_VERSION_PATCHLEVEL 3
#define MPC_VERSION_STRING "1.0.3"
/* Macros dealing with MPC VERSION */
#define MPC_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
#define MPC_VERSION \
MPC_VERSION_NUM(MPC_VERSION_MAJOR,MPC_VERSION_MINOR,MPC_VERSION_PATCHLEVEL)
/* Check if stdint.h/inttypes.h is included */
#if defined (INTMAX_C) && defined (UINTMAX_C)
#define _MPC_H_HAVE_INTMAX_T 1
#endif
/* Return values */
/* Transform negative to 2, positive to 1, leave 0 unchanged */
#define MPC_INEX_POS(inex) (((inex) < 0) ? 2 : ((inex) == 0) ? 0 : 1)
/* Transform 2 to negative, 1 to positive, leave 0 unchanged */
#define MPC_INEX_NEG(inex) (((inex) == 2) ? -1 : ((inex) == 0) ? 0 : 1)
/* The global inexact flag is made of (real flag) + 4 * (imaginary flag), where
each of the real and imaginary inexact flag are:
0 when the result is exact (no rounding error)
1 when the result is larger than the exact value
2 when the result is smaller than the exact value */
#define MPC_INEX(inex_re, inex_im) \
(MPC_INEX_POS(inex_re) | (MPC_INEX_POS(inex_im) << 2))
#define MPC_INEX_RE(inex) MPC_INEX_NEG((inex) & 3)
#define MPC_INEX_IM(inex) MPC_INEX_NEG((inex) >> 2)
/* For functions computing two results, the return value is
inexact1+16*inexact2, which is 0 iif both results are exact. */
#define MPC_INEX12(inex1, inex2) (inex1 | (inex2 << 4))
#define MPC_INEX1(inex) (inex & 15)
#define MPC_INEX2(inex) (inex >> 4)
/* Definition of rounding modes */
/* a complex rounding mode is just a pair of two real rounding modes
we reserve four bits for a real rounding mode. */
typedef int mpc_rnd_t;
#define MPC_RND(r1,r2) (((int)(r1)) + ((int)(r2) << 4))
#define MPC_RND_RE(x) ((mpfr_rnd_t)((x) & 0x0F))
#define MPC_RND_IM(x) ((mpfr_rnd_t)((x) >> 4))
#define MPC_RNDNN MPC_RND (GMP_RNDN,GMP_RNDN)
#define MPC_RNDNZ MPC_RND (GMP_RNDN,GMP_RNDZ)
#define MPC_RNDNU MPC_RND (GMP_RNDN,GMP_RNDU)
#define MPC_RNDND MPC_RND (GMP_RNDN,GMP_RNDD)
#define MPC_RNDZN MPC_RND (GMP_RNDZ,GMP_RNDN)
#define MPC_RNDZZ MPC_RND (GMP_RNDZ,GMP_RNDZ)
#define MPC_RNDZU MPC_RND (GMP_RNDZ,GMP_RNDU)
#define MPC_RNDZD MPC_RND (GMP_RNDZ,GMP_RNDD)
#define MPC_RNDUN MPC_RND (GMP_RNDU,GMP_RNDN)
#define MPC_RNDUZ MPC_RND (GMP_RNDU,GMP_RNDZ)
#define MPC_RNDUU MPC_RND (GMP_RNDU,GMP_RNDU)
#define MPC_RNDUD MPC_RND (GMP_RNDU,GMP_RNDD)
#define MPC_RNDDN MPC_RND (GMP_RNDD,GMP_RNDN)
#define MPC_RNDDZ MPC_RND (GMP_RNDD,GMP_RNDZ)
#define MPC_RNDDU MPC_RND (GMP_RNDD,GMP_RNDU)
#define MPC_RNDDD MPC_RND (GMP_RNDD,GMP_RNDD)
/* Definitions of types and their semantics */
typedef struct {
mpfr_t re;
mpfr_t im;
}
__mpc_struct;
typedef __mpc_struct mpc_t[1];
typedef __mpc_struct *mpc_ptr;
typedef const __mpc_struct *mpc_srcptr;
/* Support for WINDOWS DLL, see
http://lists.gforge.inria.fr/pipermail/mpc-discuss/2011-November/000990.html;
when building the DLL, export symbols, otherwise behave as GMP */
#if defined (__MPC_LIBRARY_BUILD) && __GMP_LIBGMP_DLL
#define __MPC_DECLSPEC __GMP_DECLSPEC_EXPORT
#else
#define __MPC_DECLSPEC __GMP_DECLSPEC
#endif
#if defined (__cplusplus)
extern "C" {
#endif
__MPC_DECLSPEC int mpc_add (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_add_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_add_si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_add_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_sub (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_sub_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_fr_sub (mpc_ptr, mpfr_srcptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_sub_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_ui_ui_sub (mpc_ptr, unsigned long int, unsigned long int, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_mul (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_mul_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_mul_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_mul_si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_mul_i (mpc_ptr, mpc_srcptr, int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_sqr (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_div (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_pow (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_pow_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_pow_ld (mpc_ptr, mpc_srcptr, long double, mpc_rnd_t);
__MPC_DECLSPEC int mpc_pow_d (mpc_ptr, mpc_srcptr, double, mpc_rnd_t);
__MPC_DECLSPEC int mpc_pow_si (mpc_ptr, mpc_srcptr, long, mpc_rnd_t);
__MPC_DECLSPEC int mpc_pow_ui (mpc_ptr, mpc_srcptr, unsigned long, mpc_rnd_t);
__MPC_DECLSPEC int mpc_pow_z (mpc_ptr, mpc_srcptr, mpz_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_div_fr (mpc_ptr, mpc_srcptr, mpfr_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_fr_div (mpc_ptr, mpfr_srcptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_div_ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_ui_div (mpc_ptr, unsigned long int, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_div_2ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_mul_2ui (mpc_ptr, mpc_srcptr, unsigned long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_div_2si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_mul_2si (mpc_ptr, mpc_srcptr, long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_conj (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_neg (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_norm (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
__MPC_DECLSPEC int mpc_abs (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
__MPC_DECLSPEC int mpc_sqrt (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_d (mpc_ptr, double, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_d_d (mpc_ptr, double, double, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_ld (mpc_ptr, long double, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_ld_ld (mpc_ptr, long double, long double, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_f (mpc_ptr, mpf_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_f_f (mpc_ptr, mpf_srcptr, mpf_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_fr (mpc_ptr, mpfr_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_fr_fr (mpc_ptr, mpfr_srcptr, mpfr_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_q (mpc_ptr, mpq_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_q_q (mpc_ptr, mpq_srcptr, mpq_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_si (mpc_ptr, long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_si_si (mpc_ptr, long int, long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_ui (mpc_ptr, unsigned long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_ui_ui (mpc_ptr, unsigned long int, unsigned long int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_z (mpc_ptr, mpz_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_z_z (mpc_ptr, mpz_srcptr, mpz_srcptr, mpc_rnd_t);
__MPC_DECLSPEC void mpc_swap (mpc_ptr, mpc_ptr);
__MPC_DECLSPEC int mpc_fma (mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC void mpc_set_nan (mpc_ptr);
__MPC_DECLSPEC int mpc_real (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
__MPC_DECLSPEC int mpc_imag (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
__MPC_DECLSPEC int mpc_arg (mpfr_ptr, mpc_srcptr, mpfr_rnd_t);
__MPC_DECLSPEC int mpc_proj (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_cmp (mpc_srcptr, mpc_srcptr);
__MPC_DECLSPEC int mpc_cmp_si_si (mpc_srcptr, long int, long int);
__MPC_DECLSPEC int mpc_exp (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_log (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_log10 (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_sin (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_cos (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_sin_cos (mpc_ptr, mpc_ptr, mpc_srcptr, mpc_rnd_t, mpc_rnd_t);
__MPC_DECLSPEC int mpc_tan (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_sinh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_cosh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_tanh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_asin (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_acos (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_atan (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_asinh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_acosh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC int mpc_atanh (mpc_ptr, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC void mpc_clear (mpc_ptr);
__MPC_DECLSPEC int mpc_urandom (mpc_ptr, gmp_randstate_t);
__MPC_DECLSPEC void mpc_init2 (mpc_ptr, mpfr_prec_t);
__MPC_DECLSPEC void mpc_init3 (mpc_ptr, mpfr_prec_t, mpfr_prec_t);
__MPC_DECLSPEC mpfr_prec_t mpc_get_prec (mpc_srcptr x);
__MPC_DECLSPEC void mpc_get_prec2 (mpfr_prec_t *pr, mpfr_prec_t *pi, mpc_srcptr x);
__MPC_DECLSPEC void mpc_set_prec (mpc_ptr, mpfr_prec_t);
__MPC_DECLSPEC const char * mpc_get_version (void);
__MPC_DECLSPEC int mpc_strtoc (mpc_ptr, const char *, char **, int, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_str (mpc_ptr, const char *, int, mpc_rnd_t);
__MPC_DECLSPEC char * mpc_get_str (int, size_t, mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC void mpc_free_str (char *);
/* declare certain functions only if appropriate headers have been included */
#ifdef _MPC_H_HAVE_INTMAX_T
__MPC_DECLSPEC int mpc_set_sj (mpc_ptr, intmax_t, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_uj (mpc_ptr, uintmax_t, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_sj_sj (mpc_ptr, intmax_t, intmax_t, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_uj_uj (mpc_ptr, uintmax_t, uintmax_t, mpc_rnd_t);
#endif
#ifdef _Complex_I
__MPC_DECLSPEC int mpc_set_dc (mpc_ptr, double _Complex, mpc_rnd_t);
__MPC_DECLSPEC int mpc_set_ldc (mpc_ptr, long double _Complex, mpc_rnd_t);
__MPC_DECLSPEC double _Complex mpc_get_dc (mpc_srcptr, mpc_rnd_t);
__MPC_DECLSPEC long double _Complex mpc_get_ldc (mpc_srcptr, mpc_rnd_t);
#endif
#ifdef _GMP_H_HAVE_FILE
__MPC_DECLSPEC int mpc_inp_str (mpc_ptr, FILE *, size_t *, int, mpc_rnd_t);
__MPC_DECLSPEC size_t mpc_out_str (FILE *, int, size_t, mpc_srcptr, mpc_rnd_t);
#endif
#if defined (__cplusplus)
}
#endif
#define mpc_realref(x) ((x)->re)
#define mpc_imagref(x) ((x)->im)
#define mpc_cmp_si(x, y) \
( mpc_cmp_si_si ((x), (y), 0l) )
#define mpc_ui_sub(x, y, z, r) mpc_ui_ui_sub (x, y, 0ul, z, r)
/*
Define a fake mpfr_set_fr so that, for instance, mpc_set_fr_z would
be defined as follows:
mpc_set_fr_z (mpc_t rop, mpfr_t x, mpz_t y, mpc_rnd_t rnd)
MPC_SET_X_Y (fr, z, rop, x, y, rnd)
*/
#ifndef mpfr_set_fr
#define mpfr_set_fr mpfr_set
#endif
#define MPC_SET_X_Y(real_t, imag_t, z, real_value, imag_value, rnd) \
{ \
int _inex_re, _inex_im; \
_inex_re = (mpfr_set_ ## real_t) (mpc_realref (z), (real_value), MPC_RND_RE (rnd)); \
_inex_im = (mpfr_set_ ## imag_t) (mpc_imagref (z), (imag_value), MPC_RND_IM (rnd)); \
return MPC_INEX (_inex_re, _inex_im); \
}
#endif /* ifndef __MPC_H */

View File

@ -0,0 +1,175 @@
/* mpf2mpfr.h -- Compatibility include file with mpf.
Copyright 1999-2002, 2004-2017 Free Software Foundation, Inc.
Contributed by the AriC and Caramba projects, INRIA.
This file is part of the GNU MPFR Library.
The GNU MPFR 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 3 of the License, or (at your
option) any later version.
The GNU MPFR 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 MPFR Library; see the file COPYING.LESSER. If not, see
http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef __MPFR_FROM_MPF__
#define __MPFR_FROM_MPF__
/* types */
#define mpf_t mpfr_t
#define mpf_srcptr mpfr_srcptr
#define mpf_ptr mpfr_ptr
/* Get current Rounding Mode */
#ifndef MPFR_DEFAULT_RND
# define MPFR_DEFAULT_RND mpfr_get_default_rounding_mode ()
#endif
/* mpf_init initalizes at 0 */
#undef mpf_init
#define mpf_init(x) mpfr_init_set_ui ((x), 0, MPFR_DEFAULT_RND)
#undef mpf_init2
#define mpf_init2(x,p) (mpfr_init2((x),(p)), mpfr_set_ui ((x), 0, MPFR_DEFAULT_RND))
/* functions which don't take as argument the rounding mode */
#undef mpf_ceil
#define mpf_ceil mpfr_ceil
#undef mpf_clear
#define mpf_clear mpfr_clear
#undef mpf_cmp
#define mpf_cmp mpfr_cmp
#undef mpf_cmp_si
#define mpf_cmp_si mpfr_cmp_si
#undef mpf_cmp_ui
#define mpf_cmp_ui mpfr_cmp_ui
#undef mpf_cmp_d
#define mpf_cmp_d mpfr_cmp_d
#undef mpf_eq
#define mpf_eq mpfr_eq
#undef mpf_floor
#define mpf_floor mpfr_floor
#undef mpf_get_prec
#define mpf_get_prec mpfr_get_prec
#undef mpf_integer_p
#define mpf_integer_p mpfr_integer_p
#undef mpf_random2
#define mpf_random2 mpfr_random2
#undef mpf_set_default_prec
#define mpf_set_default_prec mpfr_set_default_prec
#undef mpf_get_default_prec
#define mpf_get_default_prec mpfr_get_default_prec
#undef mpf_set_prec
#define mpf_set_prec mpfr_set_prec
#undef mpf_set_prec_raw
#define mpf_set_prec_raw(x,p) mpfr_prec_round(x,p,MPFR_DEFAULT_RND)
#undef mpf_trunc
#define mpf_trunc mpfr_trunc
#undef mpf_sgn
#define mpf_sgn mpfr_sgn
#undef mpf_swap
#define mpf_swap mpfr_swap
#undef mpf_dump
#define mpf_dump mpfr_dump
/* functions which take as argument the rounding mode */
#undef mpf_abs
#define mpf_abs(x,y) mpfr_abs(x,y,MPFR_DEFAULT_RND)
#undef mpf_add
#define mpf_add(x,y,z) mpfr_add(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_add_ui
#define mpf_add_ui(x,y,z) mpfr_add_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_div
#define mpf_div(x,y,z) mpfr_div(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_div_ui
#define mpf_div_ui(x,y,z) mpfr_div_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_div_2exp
#define mpf_div_2exp(x,y,z) mpfr_div_2exp(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_fits_slong_p
#define mpf_fits_slong_p(x) mpfr_fits_slong_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_ulong_p
#define mpf_fits_ulong_p(x) mpfr_fits_ulong_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_sint_p
#define mpf_fits_sint_p(x) mpfr_fits_sint_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_uint_p
#define mpf_fits_uint_p(x) mpfr_fits_uint_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_sshort_p
#define mpf_fits_sshort_p(x) mpfr_fits_sshort_p(x,MPFR_DEFAULT_RND)
#undef mpf_fits_ushort_p
#define mpf_fits_ushort_p(x) mpfr_fits_ushort_p(x,MPFR_DEFAULT_RND)
#undef mpf_get_str
#define mpf_get_str(x,y,z,t,u) mpfr_get_str(x,y,z,t,u,MPFR_DEFAULT_RND)
#undef mpf_get_d
#define mpf_get_d(x) mpfr_get_d(x,MPFR_DEFAULT_RND)
#undef mpf_get_d_2exp
#define mpf_get_d_2exp(e,x) mpfr_get_d_2exp(e,x,MPFR_DEFAULT_RND)
#undef mpf_get_ui
#define mpf_get_ui(x) mpfr_get_ui(x,MPFR_DEFAULT_RND)
#undef mpf_get_si
#define mpf_get_si(x) mpfr_get_si(x,MPFR_DEFAULT_RND)
#undef mpf_inp_str
#define mpf_inp_str(x,y,z) mpfr_inp_str(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_set_str
#define mpf_set_str(x,y,z) mpfr_set_str(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_init_set
#define mpf_init_set(x,y) mpfr_init_set(x,y,MPFR_DEFAULT_RND)
#undef mpf_init_set_d
#define mpf_init_set_d(x,y) mpfr_init_set_d(x,y,MPFR_DEFAULT_RND)
#undef mpf_init_set_si
#define mpf_init_set_si(x,y) mpfr_init_set_si(x,y,MPFR_DEFAULT_RND)
#undef mpf_init_set_str
#define mpf_init_set_str(x,y,z) mpfr_init_set_str(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_init_set_ui
#define mpf_init_set_ui(x,y) mpfr_init_set_ui(x,y,MPFR_DEFAULT_RND)
#undef mpf_mul
#define mpf_mul(x,y,z) mpfr_mul(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_mul_2exp
#define mpf_mul_2exp(x,y,z) mpfr_mul_2exp(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_mul_ui
#define mpf_mul_ui(x,y,z) mpfr_mul_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_neg
#define mpf_neg(x,y) mpfr_neg(x,y,MPFR_DEFAULT_RND)
#undef mpf_out_str
#define mpf_out_str(x,y,z,t) mpfr_out_str(x,y,z,t,MPFR_DEFAULT_RND)
#undef mpf_pow_ui
#define mpf_pow_ui(x,y,z) mpfr_pow_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_reldiff
#define mpf_reldiff(x,y,z) mpfr_reldiff(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_set
#define mpf_set(x,y) mpfr_set(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_d
#define mpf_set_d(x,y) mpfr_set_d(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_q
#define mpf_set_q(x,y) mpfr_set_q(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_si
#define mpf_set_si(x,y) mpfr_set_si(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_ui
#define mpf_set_ui(x,y) mpfr_set_ui(x,y,MPFR_DEFAULT_RND)
#undef mpf_set_z
#define mpf_set_z(x,y) mpfr_set_z(x,y,MPFR_DEFAULT_RND)
#undef mpf_sqrt
#define mpf_sqrt(x,y) mpfr_sqrt(x,y,MPFR_DEFAULT_RND)
#undef mpf_sqrt_ui
#define mpf_sqrt_ui(x,y) mpfr_sqrt_ui(x,y,MPFR_DEFAULT_RND)
#undef mpf_sub
#define mpf_sub(x,y,z) mpfr_sub(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_sub_ui
#define mpf_sub_ui(x,y,z) mpfr_sub_ui(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_ui_div
#define mpf_ui_div(x,y,z) mpfr_ui_div(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_ui_sub
#define mpf_ui_sub(x,y,z) mpfr_ui_sub(x,y,z,MPFR_DEFAULT_RND)
#undef mpf_urandomb
#define mpf_urandomb(x,y,n) mpfr_urandomb(x,y)
#undef mpz_set_f
#define mpz_set_f(z,f) mpfr_get_z(z,f,MPFR_DEFAULT_RND)
#endif /* __MPFR_FROM_MPF__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
/****************************************************************************
* Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */
#ifndef NCURSES_ETI_H_incl
#define NCURSES_ETI_H_incl 1
#define E_OK (0)
#define E_SYSTEM_ERROR (-1)
#define E_BAD_ARGUMENT (-2)
#define E_POSTED (-3)
#define E_CONNECTED (-4)
#define E_BAD_STATE (-5)
#define E_NO_ROOM (-6)
#define E_NOT_POSTED (-7)
#define E_UNKNOWN_COMMAND (-8)
#define E_NO_MATCH (-9)
#define E_NOT_SELECTABLE (-10)
#define E_NOT_CONNECTED (-11)
#define E_REQUEST_DENIED (-12)
#define E_INVALID_FIELD (-13)
#define E_CURRENT (-14)
#endif

View File

@ -0,0 +1,428 @@
/****************************************************************************
* Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/* $Id: form.h,v 0.24 2014/07/26 20:52:28 tom Exp $ */
#ifndef FORM_H
#define FORM_H
/* *INDENT-OFF*/
#include <ncurses/curses.h>
#include <ncurses/eti.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef FORM_PRIV_H
typedef void *FIELD_CELL;
#endif
#ifndef NCURSES_FIELD_INTERNALS
#define NCURSES_FIELD_INTERNALS /* nothing */
#endif
typedef int Form_Options;
typedef int Field_Options;
/**********
* _PAGE *
**********/
typedef struct {
short pmin; /* index of first field on page */
short pmax; /* index of last field on page */
short smin; /* index of top leftmost field on page */
short smax; /* index of bottom rightmost field on page */
} _PAGE;
/**********
* FIELD *
**********/
typedef struct fieldnode {
unsigned short status; /* flags */
short rows; /* size in rows */
short cols; /* size in cols */
short frow; /* first row */
short fcol; /* first col */
int drows; /* dynamic rows */
int dcols; /* dynamic cols */
int maxgrow; /* maximum field growth */
int nrow; /* off-screen rows */
short nbuf; /* additional buffers */
short just; /* justification */
short page; /* page on form */
short index; /* into form -> field */
int pad; /* pad character */
chtype fore; /* foreground attribute */
chtype back; /* background attribute */
Field_Options opts; /* options */
struct fieldnode * snext; /* sorted order pointer */
struct fieldnode * sprev; /* sorted order pointer */
struct fieldnode * link; /* linked field chain */
struct formnode * form; /* containing form */
struct typenode * type; /* field type */
void * arg; /* argument for type */
FIELD_CELL * buf; /* field buffers */
void * usrptr; /* user pointer */
/*
* The wide-character configuration requires extra information. Because
* there are existing applications that manipulate the members of FIELD
* directly, we cannot make the struct opaque. Offsets of members up to
* this point are the same in the narrow- and wide-character configuration.
* But note that the type of buf depends on the configuration, and is made
* opaque for that reason.
*/
NCURSES_FIELD_INTERNALS
} FIELD;
/*********
* FORM *
*********/
typedef struct formnode {
unsigned short status; /* flags */
short rows; /* size in rows */
short cols; /* size in cols */
int currow; /* current row in field window */
int curcol; /* current col in field window */
int toprow; /* in scrollable field window */
int begincol; /* in horiz. scrollable field */
short maxfield; /* number of fields */
short maxpage; /* number of pages */
short curpage; /* index into page */
Form_Options opts; /* options */
WINDOW * win; /* window */
WINDOW * sub; /* subwindow */
WINDOW * w; /* window for current field */
FIELD ** field; /* field [maxfield] */
FIELD * current; /* current field */
_PAGE * page; /* page [maxpage] */
void * usrptr; /* user pointer */
void (*forminit)(struct formnode *);
void (*formterm)(struct formnode *);
void (*fieldinit)(struct formnode *);
void (*fieldterm)(struct formnode *);
} FORM;
/**************
* FIELDTYPE *
**************/
typedef struct typenode {
unsigned short status; /* flags */
long ref; /* reference count */
struct typenode * left; /* ptr to operand for | */
struct typenode * right; /* ptr to operand for | */
void* (*makearg)(va_list *); /* make fieldtype arg */
void* (*copyarg)(const void *); /* copy fieldtype arg */
void (*freearg)(void *); /* free fieldtype arg */
#if NCURSES_INTEROP_FUNCS
union {
bool (*ofcheck)(FIELD *,const void *); /* field validation */
bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */
} fieldcheck;
union {
bool (*occheck)(int,const void *); /* character validation */
bool (*gccheck)(int,FORM*,
FIELD*,const void*); /* generic char validation */
} charcheck;
union {
bool (*onext)(FIELD *,const void *); /* enumerate next value */
bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */
} enum_next;
union {
bool (*oprev)(FIELD *,const void *); /* enumerate prev value */
bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */
} enum_prev;
void* (*genericarg)(void*); /* Alternate Arg method */
#else
bool (*fcheck)(FIELD *,const void *); /* field validation */
bool (*ccheck)(int,const void *); /* character validation */
bool (*next)(FIELD *,const void *); /* enumerate next value */
bool (*prev)(FIELD *,const void *); /* enumerate prev value */
#endif
} FIELDTYPE;
typedef void (*Form_Hook)(FORM *);
/***************************
* miscellaneous #defines *
***************************/
/* field justification */
#define NO_JUSTIFICATION (0)
#define JUSTIFY_LEFT (1)
#define JUSTIFY_CENTER (2)
#define JUSTIFY_RIGHT (3)
/* field options */
#define O_VISIBLE (0x0001U)
#define O_ACTIVE (0x0002U)
#define O_PUBLIC (0x0004U)
#define O_EDIT (0x0008U)
#define O_WRAP (0x0010U)
#define O_BLANK (0x0020U)
#define O_AUTOSKIP (0x0040U)
#define O_NULLOK (0x0080U)
#define O_PASSOK (0x0100U)
#define O_STATIC (0x0200U)
#define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */
/* form options */
#define O_NL_OVERLOAD (0x0001U)
#define O_BS_OVERLOAD (0x0002U)
/* form driver commands */
#define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */
#define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */
#define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */
#define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */
#define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */
#define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */
#define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */
#define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */
#define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */
#define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */
#define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */
#define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */
#define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */
#define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */
#define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */
#define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */
#define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */
#define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */
#define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */
#define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */
#define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */
#define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */
#define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */
#define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */
#define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */
#define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */
#define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */
#define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */
#define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */
#define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */
#define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */
#define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */
#define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */
#define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */
#define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */
#define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */
#define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */
#define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */
#define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */
#define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */
#define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */
#define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */
#define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */
#define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */
#define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */
#define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */
#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */
#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */
#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */
#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */
#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */
#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */
#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */
#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */
#define REQ_VALIDATION (KEY_MAX + 55) /* validate field */
#define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */
#define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */
#define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */
#define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */
#if defined(MAX_COMMAND)
# if (MAX_FORM_COMMAND > MAX_COMMAND)
# error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
# elif (MAX_COMMAND != (KEY_MAX + 128))
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
# endif
#else
# define MAX_COMMAND (KEY_MAX + 128)
#endif
/*************************
* standard field types *
*************************/
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
/************************************
* built-in additional field types *
* They are not defined in SVr4 *
************************************/
extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */
/***********************
* FIELDTYPE routines *
***********************/
extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (
bool (* const field_check)(FIELD *,const void *),
bool (* const char_check)(int,const void *));
extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype(
FIELDTYPE *, FIELDTYPE *);
extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *);
extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *,
void * (* const make_arg)(va_list *),
void * (* const copy_arg)(const void *),
void (* const free_arg)(void *));
extern NCURSES_EXPORT(int) set_fieldtype_choice (FIELDTYPE *,
bool (* const next_choice)(FIELD *,const void *),
bool (* const prev_choice)(FIELD *,const void *));
/*******************
* FIELD routines *
*******************/
extern NCURSES_EXPORT(FIELD *) new_field (int,int,int,int,int,int);
extern NCURSES_EXPORT(FIELD *) dup_field (FIELD *,int,int);
extern NCURSES_EXPORT(FIELD *) link_field (FIELD *,int,int);
extern NCURSES_EXPORT(int) free_field (FIELD *);
extern NCURSES_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
extern NCURSES_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *);
extern NCURSES_EXPORT(int) set_max_field ( FIELD *,int);
extern NCURSES_EXPORT(int) move_field (FIELD *,int,int);
extern NCURSES_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...);
extern NCURSES_EXPORT(int) set_new_page (FIELD *,bool);
extern NCURSES_EXPORT(int) set_field_just (FIELD *,int);
extern NCURSES_EXPORT(int) field_just (const FIELD *);
extern NCURSES_EXPORT(int) set_field_fore (FIELD *,chtype);
extern NCURSES_EXPORT(int) set_field_back (FIELD *,chtype);
extern NCURSES_EXPORT(int) set_field_pad (FIELD *,int);
extern NCURSES_EXPORT(int) field_pad (const FIELD *);
extern NCURSES_EXPORT(int) set_field_buffer (FIELD *,int,const char *);
extern NCURSES_EXPORT(int) set_field_status (FIELD *,bool);
extern NCURSES_EXPORT(int) set_field_userptr (FIELD *, void *);
extern NCURSES_EXPORT(int) set_field_opts (FIELD *,Field_Options);
extern NCURSES_EXPORT(int) field_opts_on (FIELD *,Field_Options);
extern NCURSES_EXPORT(int) field_opts_off (FIELD *,Field_Options);
extern NCURSES_EXPORT(chtype) field_fore (const FIELD *);
extern NCURSES_EXPORT(chtype) field_back (const FIELD *);
extern NCURSES_EXPORT(bool) new_page (const FIELD *);
extern NCURSES_EXPORT(bool) field_status (const FIELD *);
extern NCURSES_EXPORT(void *) field_arg (const FIELD *);
extern NCURSES_EXPORT(void *) field_userptr (const FIELD *);
extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *);
extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int);
extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *);
/******************
* FORM routines *
******************/
extern NCURSES_EXPORT(FORM *) new_form (FIELD **);
extern NCURSES_EXPORT(FIELD **) form_fields (const FORM *);
extern NCURSES_EXPORT(FIELD *) current_field (const FORM *);
extern NCURSES_EXPORT(WINDOW *) form_win (const FORM *);
extern NCURSES_EXPORT(WINDOW *) form_sub (const FORM *);
extern NCURSES_EXPORT(Form_Hook) form_init (const FORM *);
extern NCURSES_EXPORT(Form_Hook) form_term (const FORM *);
extern NCURSES_EXPORT(Form_Hook) field_init (const FORM *);
extern NCURSES_EXPORT(Form_Hook) field_term (const FORM *);
extern NCURSES_EXPORT(int) free_form (FORM *);
extern NCURSES_EXPORT(int) set_form_fields (FORM *,FIELD **);
extern NCURSES_EXPORT(int) field_count (const FORM *);
extern NCURSES_EXPORT(int) set_form_win (FORM *,WINDOW *);
extern NCURSES_EXPORT(int) set_form_sub (FORM *,WINDOW *);
extern NCURSES_EXPORT(int) set_current_field (FORM *,FIELD *);
extern NCURSES_EXPORT(int) field_index (const FIELD *);
extern NCURSES_EXPORT(int) set_form_page (FORM *,int);
extern NCURSES_EXPORT(int) form_page (const FORM *);
extern NCURSES_EXPORT(int) scale_form (const FORM *,int *,int *);
extern NCURSES_EXPORT(int) set_form_init (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_form_term (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_field_init (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) set_field_term (FORM *,Form_Hook);
extern NCURSES_EXPORT(int) post_form (FORM *);
extern NCURSES_EXPORT(int) unpost_form (FORM *);
extern NCURSES_EXPORT(int) pos_form_cursor (FORM *);
extern NCURSES_EXPORT(int) form_driver (FORM *,int);
# if NCURSES_WIDECHAR
extern NCURSES_EXPORT(int) form_driver_w (FORM *,int,wchar_t);
# endif
extern NCURSES_EXPORT(int) set_form_userptr (FORM *,void *);
extern NCURSES_EXPORT(int) set_form_opts (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_opts_on (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_opts_off (FORM *,Form_Options);
extern NCURSES_EXPORT(int) form_request_by_name (const char *);
extern NCURSES_EXPORT(const char *) form_request_name (int);
extern NCURSES_EXPORT(void *) form_userptr (const FORM *);
extern NCURSES_EXPORT(Form_Options) form_opts (const FORM *);
extern NCURSES_EXPORT(bool) data_ahead (const FORM *);
extern NCURSES_EXPORT(bool) data_behind (const FORM *);
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
#endif
#ifdef __cplusplus
}
#endif
/* *INDENT-ON*/
#endif /* FORM_H */

View File

@ -0,0 +1,260 @@
/****************************************************************************
* Copyright (c) 1998-2007,2009 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/* $Id: menu.h,v 1.20 2009/04/05 00:28:07 tom Exp $ */
#ifndef ETI_MENU
#define ETI_MENU
#ifdef AMIGA
#define TEXT TEXT_ncurses
#endif
#include <ncurses/curses.h>
#include <ncurses/eti.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int Menu_Options;
typedef int Item_Options;
/* Menu options: */
#define O_ONEVALUE (0x01)
#define O_SHOWDESC (0x02)
#define O_ROWMAJOR (0x04)
#define O_IGNORECASE (0x08)
#define O_SHOWMATCH (0x10)
#define O_NONCYCLIC (0x20)
/* Item options: */
#define O_SELECTABLE (0x01)
typedef struct
{
const char* str;
unsigned short length;
} TEXT;
typedef struct tagITEM
{
TEXT name; /* name of menu item */
TEXT description; /* description of item, optional in display */
struct tagMENU *imenu; /* Pointer to parent menu */
void *userptr; /* Pointer to user defined per item data */
Item_Options opt; /* Item options */
short index; /* Item number if connected to a menu */
short y; /* y and x location of item in menu */
short x;
bool value; /* Selection value */
struct tagITEM *left; /* neighbor items */
struct tagITEM *right;
struct tagITEM *up;
struct tagITEM *down;
} ITEM;
typedef void (*Menu_Hook)(struct tagMENU *);
typedef struct tagMENU
{
short height; /* Nr. of chars high */
short width; /* Nr. of chars wide */
short rows; /* Nr. of items high */
short cols; /* Nr. of items wide */
short frows; /* Nr. of formatted items high */
short fcols; /* Nr. of formatted items wide */
short arows; /* Nr. of items high (actual) */
short namelen; /* Max. name length */
short desclen; /* Max. description length */
short marklen; /* Length of mark, if any */
short itemlen; /* Length of one item */
short spc_desc; /* Spacing for descriptor */
short spc_cols; /* Spacing for columns */
short spc_rows; /* Spacing for rows */
char *pattern; /* Buffer to store match chars */
short pindex; /* Index into pattern buffer */
WINDOW *win; /* Window containing menu */
WINDOW *sub; /* Subwindow for menu display */
WINDOW *userwin; /* User's window */
WINDOW *usersub; /* User's subwindow */
ITEM **items; /* array of items */
short nitems; /* Nr. of items in menu */
ITEM *curitem; /* Current item */
short toprow; /* Top row of menu */
chtype fore; /* Selection attribute */
chtype back; /* Nonselection attribute */
chtype grey; /* Inactive attribute */
unsigned char pad; /* Pad character */
Menu_Hook menuinit; /* User hooks */
Menu_Hook menuterm;
Menu_Hook iteminit;
Menu_Hook itemterm;
void *userptr; /* Pointer to menus user data */
char *mark; /* Pointer to marker string */
Menu_Options opt; /* Menu options */
unsigned short status; /* Internal state of menu */
} MENU;
/* Define keys */
#define REQ_LEFT_ITEM (KEY_MAX + 1)
#define REQ_RIGHT_ITEM (KEY_MAX + 2)
#define REQ_UP_ITEM (KEY_MAX + 3)
#define REQ_DOWN_ITEM (KEY_MAX + 4)
#define REQ_SCR_ULINE (KEY_MAX + 5)
#define REQ_SCR_DLINE (KEY_MAX + 6)
#define REQ_SCR_DPAGE (KEY_MAX + 7)
#define REQ_SCR_UPAGE (KEY_MAX + 8)
#define REQ_FIRST_ITEM (KEY_MAX + 9)
#define REQ_LAST_ITEM (KEY_MAX + 10)
#define REQ_NEXT_ITEM (KEY_MAX + 11)
#define REQ_PREV_ITEM (KEY_MAX + 12)
#define REQ_TOGGLE_ITEM (KEY_MAX + 13)
#define REQ_CLEAR_PATTERN (KEY_MAX + 14)
#define REQ_BACK_PATTERN (KEY_MAX + 15)
#define REQ_NEXT_MATCH (KEY_MAX + 16)
#define REQ_PREV_MATCH (KEY_MAX + 17)
#define MIN_MENU_COMMAND (KEY_MAX + 1)
#define MAX_MENU_COMMAND (KEY_MAX + 17)
/*
* Some AT&T code expects MAX_COMMAND to be out-of-band not
* just for menu commands but for forms ones as well.
*/
#if defined(MAX_COMMAND)
# if (MAX_MENU_COMMAND > MAX_COMMAND)
# error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND
# elif (MAX_COMMAND != (KEY_MAX + 128))
# error Something is wrong -- MAX_COMMAND is already inconsistently defined.
# endif
#else
# define MAX_COMMAND (KEY_MAX + 128)
#endif
/* --------- prototypes for libmenu functions ----------------------------- */
extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *);
extern NCURSES_EXPORT(ITEM *) current_item (const MENU *);
extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *);
extern NCURSES_EXPORT(MENU *) new_menu (ITEM **);
extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *);
extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *);
extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *);
extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *);
extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *);
extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *);
extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *);
extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *);
extern NCURSES_EXPORT(const char *) item_description (const ITEM *);
extern NCURSES_EXPORT(const char *) item_name (const ITEM *);
extern NCURSES_EXPORT(const char *) menu_mark (const MENU *);
extern NCURSES_EXPORT(const char *) menu_request_name (int);
extern NCURSES_EXPORT(char *) menu_pattern (const MENU *);
extern NCURSES_EXPORT(void *) menu_userptr (const MENU *);
extern NCURSES_EXPORT(void *) item_userptr (const ITEM *);
extern NCURSES_EXPORT(chtype) menu_back (const MENU *);
extern NCURSES_EXPORT(chtype) menu_fore (const MENU *);
extern NCURSES_EXPORT(chtype) menu_grey (const MENU *);
extern NCURSES_EXPORT(int) free_item (ITEM *);
extern NCURSES_EXPORT(int) free_menu (MENU *);
extern NCURSES_EXPORT(int) item_count (const MENU *);
extern NCURSES_EXPORT(int) item_index (const ITEM *);
extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options);
extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options);
extern NCURSES_EXPORT(int) menu_driver (MENU *,int);
extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options);
extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options);
extern NCURSES_EXPORT(int) menu_pad (const MENU *);
extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *);
extern NCURSES_EXPORT(int) post_menu (MENU *);
extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *);
extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item);
extern NCURSES_EXPORT(int) set_item_init (MENU *, Menu_Hook);
extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options);
extern NCURSES_EXPORT(int) set_item_term (MENU *, Menu_Hook);
extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *);
extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool);
extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype);
extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype);
extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int);
extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype);
extern NCURSES_EXPORT(int) set_menu_init (MENU *, Menu_Hook);
extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **);
extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *);
extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options);
extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int);
extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *);
extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *);
extern NCURSES_EXPORT(int) set_menu_term (MENU *, Menu_Hook);
extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *);
extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *);
extern NCURSES_EXPORT(int) set_top_row (MENU *,int);
extern NCURSES_EXPORT(int) top_row (const MENU *);
extern NCURSES_EXPORT(int) unpost_menu (MENU *);
extern NCURSES_EXPORT(int) menu_request_by_name (const char *);
extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int);
extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *);
extern NCURSES_EXPORT(bool) item_value (const ITEM *);
extern NCURSES_EXPORT(bool) item_visible (const ITEM *);
extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *);
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(MENU *) NCURSES_SP_NAME(new_menu) (SCREEN*, ITEM **);
#endif
#ifdef __cplusplus
}
#endif
#endif /* ETI_MENU */

View File

@ -0,0 +1,77 @@
/****************************************************************************
* Copyright (c) 2006-2010,2012 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Thomas E. Dickey 2006 *
****************************************************************************/
/* $Id: nc_tparm.h,v 1.6 2012/02/18 21:34:42 tom Exp $ */
#ifndef NC_TPARM_included
#define NC_TPARM_included 1
/*
* Cast parameters past the formatting-string for tparm() to match the
* assumption of the varargs code.
*/
#ifndef TPARM_ARG
#ifdef NCURSES_TPARM_ARG
#define TPARM_ARG NCURSES_TPARM_ARG
#else
#define TPARM_ARG long
#endif
#endif /* TPARAM_ARG */
#define TPARM_N(n) (TPARM_ARG)(n)
#define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j))
#if NCURSES_TPARM_VARARGS
#define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i))
#define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h))
#define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g))
#define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f))
#define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e))
#define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d))
#define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c))
#define TPARM_1(a,b) tparm(a,TPARM_N(b))
#define TPARM_0(a) tparm(a)
#else
#define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0)
#define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0)
#define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0)
#define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0)
#define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0)
#define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
#define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
#define TPARM_1(a,b) TPARM_2(a,b,0)
#define TPARM_1(a,b) TPARM_2(a,b,0)
#define TPARM_0(a) TPARM_1(a,0)
#endif
#endif /* NC_TPARM_included */

View File

@ -0,0 +1 @@
curses.h

View File

@ -0,0 +1,102 @@
/****************************************************************************
* Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/* $Id: ncurses_dll.h.in,v 1.9 2014/08/02 21:30:20 tom Exp $ */
#ifndef NCURSES_DLL_H_incl
#define NCURSES_DLL_H_incl 1
/* 2014-08-02 workaround for broken MinGW compiler.
* Oddly, only TRACE is mapped to trace - the other -D's are okay.
* suggest TDM as an alternative.
*/
#if defined(__MINGW64__)
#elif defined(__MINGW32__)
#if (__GNUC__ == 4) && (__GNUC_MINOR__ == 8)
#ifdef trace
#undef trace
#define TRACE
#endif
#endif /* broken compiler */
#endif /* MingW */
/*
* For reentrant code, we map the various global variables into SCREEN by
* using functions to access them.
*/
#define NCURSES_PUBLIC_VAR(name) _nc_##name
#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)
/* no longer needed on cygwin or mingw, thanks to auto-import */
/* but this structure may be useful at some point for an MSVC build */
/* so, for now unconditionally define the important flags */
/* "the right way" for proper static and dll+auto-import behavior */
#undef NCURSES_DLL
#define NCURSES_STATIC
#if defined(__CYGWIN__) || defined(__MINGW32__)
# if defined(NCURSES_DLL)
# if defined(NCURSES_STATIC)
# undef NCURSES_STATIC
# endif
# endif
# undef NCURSES_IMPEXP
# undef NCURSES_API
# undef NCURSES_EXPORT
# undef NCURSES_EXPORT_VAR
# if defined(NCURSES_DLL)
/* building a DLL */
# define NCURSES_IMPEXP __declspec(dllexport)
# elif defined(NCURSES_STATIC)
/* building or linking to a static library */
# define NCURSES_IMPEXP /* nothing */
# else
/* linking to the DLL */
# define NCURSES_IMPEXP __declspec(dllimport)
# endif
# define NCURSES_API __cdecl
# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
#endif
/* Take care of non-cygwin platforms */
#if !defined(NCURSES_IMPEXP)
# define NCURSES_IMPEXP /* nothing */
#endif
#if !defined(NCURSES_API)
# define NCURSES_API /* nothing */
#endif
#if !defined(NCURSES_EXPORT)
# define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API
#endif
#if !defined(NCURSES_EXPORT_VAR)
# define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type
#endif
#endif /* NCURSES_DLL_H_incl */

View File

@ -0,0 +1,85 @@
/****************************************************************************
* Copyright (c) 1998-2006,2009 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Juergen Pfeifer 1996-1999,2008 *
****************************************************************************/
/* $Id: panel.h,v 1.11 2009/04/11 19:50:40 tom Exp $ */
/* panel.h -- interface file for panels library */
#ifndef NCURSES_PANEL_H_incl
#define NCURSES_PANEL_H_incl 1
#include <ncurses/curses.h>
typedef struct panel
{
WINDOW *win;
struct panel *below;
struct panel *above;
NCURSES_CONST void *user;
} PANEL;
#if defined(__cplusplus)
extern "C" {
#endif
extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *);
extern NCURSES_EXPORT(void) update_panels (void);
extern NCURSES_EXPORT(int) hide_panel (PANEL *);
extern NCURSES_EXPORT(int) show_panel (PANEL *);
extern NCURSES_EXPORT(int) del_panel (PANEL *);
extern NCURSES_EXPORT(int) top_panel (PANEL *);
extern NCURSES_EXPORT(int) bottom_panel (PANEL *);
extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *);
extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *);
extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *);
extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *);
extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);
extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int);
extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *);
extern NCURSES_EXPORT(int) panel_hidden (const PANEL *);
#if NCURSES_SP_FUNCS
extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *);
extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *);
extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*);
#endif
#if defined(__cplusplus)
}
#endif
#endif /* NCURSES_PANEL_H_incl */
/* end of panel.h */

View File

@ -0,0 +1,806 @@
/****************************************************************************
* Copyright (c) 1998-2011,2013 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************/
/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 */
/* and: Eric S. Raymond <esr@snark.thyrsus.com> */
/* and: Thomas E. Dickey 1995-on */
/****************************************************************************/
/* $Id: MKterm.h.awk.in,v 1.62 2013/08/17 19:21:56 tom Exp $ */
/*
** term.h -- Definition of struct term
*/
#ifndef NCURSES_TERM_H_incl
#define NCURSES_TERM_H_incl 1
#undef NCURSES_VERSION
#define NCURSES_VERSION "6.0"
#include <ncurses/ncurses_dll.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H
* definition (based on the system for which this was configured).
*/
#undef NCURSES_CONST
#define NCURSES_CONST const
#undef NCURSES_SBOOL
#define NCURSES_SBOOL char
#undef NCURSES_USE_DATABASE
#define NCURSES_USE_DATABASE 1
#undef NCURSES_USE_TERMCAP
#define NCURSES_USE_TERMCAP 0
#undef NCURSES_XNAMES
#define NCURSES_XNAMES 1
/* We will use these symbols to hide differences between
* termios/termio/sgttyb interfaces.
*/
#undef TTY
#undef SET_TTY
#undef GET_TTY
/* Assume POSIX termio if we have the header and function */
/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */
#if 1 && 1
#undef TERMIOS
#define TERMIOS 1
#include <termios.h>
#define TTY struct termios
#else /* !HAVE_TERMIOS_H */
/* #if HAVE_TERMIO_H */
#if 1
#undef TERMIOS
#define TERMIOS 1
#include <termio.h>
#define TTY struct termio
#else /* !HAVE_TERMIO_H */
#if __MINGW32__
# include <ncurses/ncurses_mingw.h>
# define TTY struct termios
#else
#undef TERMIOS
#include <sgtty.h>
#include <sys/ioctl.h>
#define TTY struct sgttyb
#endif /* MINGW32 */
#endif /* HAVE_TERMIO_H */
#endif /* HAVE_TERMIOS_H */
#ifdef TERMIOS
#define GET_TTY(fd, buf) tcgetattr(fd, buf)
#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)
#else
#define GET_TTY(fd, buf) gtty(fd, buf)
#define SET_TTY(fd, buf) stty(fd, buf)
#endif
#define NAMESIZE 256
#define CUR cur_term->type.
#define auto_left_margin CUR Booleans[0]
#define auto_right_margin CUR Booleans[1]
#define no_esc_ctlc CUR Booleans[2]
#define ceol_standout_glitch CUR Booleans[3]
#define eat_newline_glitch CUR Booleans[4]
#define erase_overstrike CUR Booleans[5]
#define generic_type CUR Booleans[6]
#define hard_copy CUR Booleans[7]
#define has_meta_key CUR Booleans[8]
#define has_status_line CUR Booleans[9]
#define insert_null_glitch CUR Booleans[10]
#define memory_above CUR Booleans[11]
#define memory_below CUR Booleans[12]
#define move_insert_mode CUR Booleans[13]
#define move_standout_mode CUR Booleans[14]
#define over_strike CUR Booleans[15]
#define status_line_esc_ok CUR Booleans[16]
#define dest_tabs_magic_smso CUR Booleans[17]
#define tilde_glitch CUR Booleans[18]
#define transparent_underline CUR Booleans[19]
#define xon_xoff CUR Booleans[20]
#define needs_xon_xoff CUR Booleans[21]
#define prtr_silent CUR Booleans[22]
#define hard_cursor CUR Booleans[23]
#define non_rev_rmcup CUR Booleans[24]
#define no_pad_char CUR Booleans[25]
#define non_dest_scroll_region CUR Booleans[26]
#define can_change CUR Booleans[27]
#define back_color_erase CUR Booleans[28]
#define hue_lightness_saturation CUR Booleans[29]
#define col_addr_glitch CUR Booleans[30]
#define cr_cancels_micro_mode CUR Booleans[31]
#define has_print_wheel CUR Booleans[32]
#define row_addr_glitch CUR Booleans[33]
#define semi_auto_right_margin CUR Booleans[34]
#define cpi_changes_res CUR Booleans[35]
#define lpi_changes_res CUR Booleans[36]
#define columns CUR Numbers[0]
#define init_tabs CUR Numbers[1]
#define lines CUR Numbers[2]
#define lines_of_memory CUR Numbers[3]
#define magic_cookie_glitch CUR Numbers[4]
#define padding_baud_rate CUR Numbers[5]
#define virtual_terminal CUR Numbers[6]
#define width_status_line CUR Numbers[7]
#define num_labels CUR Numbers[8]
#define label_height CUR Numbers[9]
#define label_width CUR Numbers[10]
#define max_attributes CUR Numbers[11]
#define maximum_windows CUR Numbers[12]
#define max_colors CUR Numbers[13]
#define max_pairs CUR Numbers[14]
#define no_color_video CUR Numbers[15]
#define buffer_capacity CUR Numbers[16]
#define dot_vert_spacing CUR Numbers[17]
#define dot_horz_spacing CUR Numbers[18]
#define max_micro_address CUR Numbers[19]
#define max_micro_jump CUR Numbers[20]
#define micro_col_size CUR Numbers[21]
#define micro_line_size CUR Numbers[22]
#define number_of_pins CUR Numbers[23]
#define output_res_char CUR Numbers[24]
#define output_res_line CUR Numbers[25]
#define output_res_horz_inch CUR Numbers[26]
#define output_res_vert_inch CUR Numbers[27]
#define print_rate CUR Numbers[28]
#define wide_char_size CUR Numbers[29]
#define buttons CUR Numbers[30]
#define bit_image_entwining CUR Numbers[31]
#define bit_image_type CUR Numbers[32]
#define back_tab CUR Strings[0]
#define bell CUR Strings[1]
#define carriage_return CUR Strings[2]
#define change_scroll_region CUR Strings[3]
#define clear_all_tabs CUR Strings[4]
#define clear_screen CUR Strings[5]
#define clr_eol CUR Strings[6]
#define clr_eos CUR Strings[7]
#define column_address CUR Strings[8]
#define command_character CUR Strings[9]
#define cursor_address CUR Strings[10]
#define cursor_down CUR Strings[11]
#define cursor_home CUR Strings[12]
#define cursor_invisible CUR Strings[13]
#define cursor_left CUR Strings[14]
#define cursor_mem_address CUR Strings[15]
#define cursor_normal CUR Strings[16]
#define cursor_right CUR Strings[17]
#define cursor_to_ll CUR Strings[18]
#define cursor_up CUR Strings[19]
#define cursor_visible CUR Strings[20]
#define delete_character CUR Strings[21]
#define delete_line CUR Strings[22]
#define dis_status_line CUR Strings[23]
#define down_half_line CUR Strings[24]
#define enter_alt_charset_mode CUR Strings[25]
#define enter_blink_mode CUR Strings[26]
#define enter_bold_mode CUR Strings[27]
#define enter_ca_mode CUR Strings[28]
#define enter_delete_mode CUR Strings[29]
#define enter_dim_mode CUR Strings[30]
#define enter_insert_mode CUR Strings[31]
#define enter_secure_mode CUR Strings[32]
#define enter_protected_mode CUR Strings[33]
#define enter_reverse_mode CUR Strings[34]
#define enter_standout_mode CUR Strings[35]
#define enter_underline_mode CUR Strings[36]
#define erase_chars CUR Strings[37]
#define exit_alt_charset_mode CUR Strings[38]
#define exit_attribute_mode CUR Strings[39]
#define exit_ca_mode CUR Strings[40]
#define exit_delete_mode CUR Strings[41]
#define exit_insert_mode CUR Strings[42]
#define exit_standout_mode CUR Strings[43]
#define exit_underline_mode CUR Strings[44]
#define flash_screen CUR Strings[45]
#define form_feed CUR Strings[46]
#define from_status_line CUR Strings[47]
#define init_1string CUR Strings[48]
#define init_2string CUR Strings[49]
#define init_3string CUR Strings[50]
#define init_file CUR Strings[51]
#define insert_character CUR Strings[52]
#define insert_line CUR Strings[53]
#define insert_padding CUR Strings[54]
#define key_backspace CUR Strings[55]
#define key_catab CUR Strings[56]
#define key_clear CUR Strings[57]
#define key_ctab CUR Strings[58]
#define key_dc CUR Strings[59]
#define key_dl CUR Strings[60]
#define key_down CUR Strings[61]
#define key_eic CUR Strings[62]
#define key_eol CUR Strings[63]
#define key_eos CUR Strings[64]
#define key_f0 CUR Strings[65]
#define key_f1 CUR Strings[66]
#define key_f10 CUR Strings[67]
#define key_f2 CUR Strings[68]
#define key_f3 CUR Strings[69]
#define key_f4 CUR Strings[70]
#define key_f5 CUR Strings[71]
#define key_f6 CUR Strings[72]
#define key_f7 CUR Strings[73]
#define key_f8 CUR Strings[74]
#define key_f9 CUR Strings[75]
#define key_home CUR Strings[76]
#define key_ic CUR Strings[77]
#define key_il CUR Strings[78]
#define key_left CUR Strings[79]
#define key_ll CUR Strings[80]
#define key_npage CUR Strings[81]
#define key_ppage CUR Strings[82]
#define key_right CUR Strings[83]
#define key_sf CUR Strings[84]
#define key_sr CUR Strings[85]
#define key_stab CUR Strings[86]
#define key_up CUR Strings[87]
#define keypad_local CUR Strings[88]
#define keypad_xmit CUR Strings[89]
#define lab_f0 CUR Strings[90]
#define lab_f1 CUR Strings[91]
#define lab_f10 CUR Strings[92]
#define lab_f2 CUR Strings[93]
#define lab_f3 CUR Strings[94]
#define lab_f4 CUR Strings[95]
#define lab_f5 CUR Strings[96]
#define lab_f6 CUR Strings[97]
#define lab_f7 CUR Strings[98]
#define lab_f8 CUR Strings[99]
#define lab_f9 CUR Strings[100]
#define meta_off CUR Strings[101]
#define meta_on CUR Strings[102]
#define newline CUR Strings[103]
#define pad_char CUR Strings[104]
#define parm_dch CUR Strings[105]
#define parm_delete_line CUR Strings[106]
#define parm_down_cursor CUR Strings[107]
#define parm_ich CUR Strings[108]
#define parm_index CUR Strings[109]
#define parm_insert_line CUR Strings[110]
#define parm_left_cursor CUR Strings[111]
#define parm_right_cursor CUR Strings[112]
#define parm_rindex CUR Strings[113]
#define parm_up_cursor CUR Strings[114]
#define pkey_key CUR Strings[115]
#define pkey_local CUR Strings[116]
#define pkey_xmit CUR Strings[117]
#define print_screen CUR Strings[118]
#define prtr_off CUR Strings[119]
#define prtr_on CUR Strings[120]
#define repeat_char CUR Strings[121]
#define reset_1string CUR Strings[122]
#define reset_2string CUR Strings[123]
#define reset_3string CUR Strings[124]
#define reset_file CUR Strings[125]
#define restore_cursor CUR Strings[126]
#define row_address CUR Strings[127]
#define save_cursor CUR Strings[128]
#define scroll_forward CUR Strings[129]
#define scroll_reverse CUR Strings[130]
#define set_attributes CUR Strings[131]
#define set_tab CUR Strings[132]
#define set_window CUR Strings[133]
#define tab CUR Strings[134]
#define to_status_line CUR Strings[135]
#define underline_char CUR Strings[136]
#define up_half_line CUR Strings[137]
#define init_prog CUR Strings[138]
#define key_a1 CUR Strings[139]
#define key_a3 CUR Strings[140]
#define key_b2 CUR Strings[141]
#define key_c1 CUR Strings[142]
#define key_c3 CUR Strings[143]
#define prtr_non CUR Strings[144]
#define char_padding CUR Strings[145]
#define acs_chars CUR Strings[146]
#define plab_norm CUR Strings[147]
#define key_btab CUR Strings[148]
#define enter_xon_mode CUR Strings[149]
#define exit_xon_mode CUR Strings[150]
#define enter_am_mode CUR Strings[151]
#define exit_am_mode CUR Strings[152]
#define xon_character CUR Strings[153]
#define xoff_character CUR Strings[154]
#define ena_acs CUR Strings[155]
#define label_on CUR Strings[156]
#define label_off CUR Strings[157]
#define key_beg CUR Strings[158]
#define key_cancel CUR Strings[159]
#define key_close CUR Strings[160]
#define key_command CUR Strings[161]
#define key_copy CUR Strings[162]
#define key_create CUR Strings[163]
#define key_end CUR Strings[164]
#define key_enter CUR Strings[165]
#define key_exit CUR Strings[166]
#define key_find CUR Strings[167]
#define key_help CUR Strings[168]
#define key_mark CUR Strings[169]
#define key_message CUR Strings[170]
#define key_move CUR Strings[171]
#define key_next CUR Strings[172]
#define key_open CUR Strings[173]
#define key_options CUR Strings[174]
#define key_previous CUR Strings[175]
#define key_print CUR Strings[176]
#define key_redo CUR Strings[177]
#define key_reference CUR Strings[178]
#define key_refresh CUR Strings[179]
#define key_replace CUR Strings[180]
#define key_restart CUR Strings[181]
#define key_resume CUR Strings[182]
#define key_save CUR Strings[183]
#define key_suspend CUR Strings[184]
#define key_undo CUR Strings[185]
#define key_sbeg CUR Strings[186]
#define key_scancel CUR Strings[187]
#define key_scommand CUR Strings[188]
#define key_scopy CUR Strings[189]
#define key_screate CUR Strings[190]
#define key_sdc CUR Strings[191]
#define key_sdl CUR Strings[192]
#define key_select CUR Strings[193]
#define key_send CUR Strings[194]
#define key_seol CUR Strings[195]
#define key_sexit CUR Strings[196]
#define key_sfind CUR Strings[197]
#define key_shelp CUR Strings[198]
#define key_shome CUR Strings[199]
#define key_sic CUR Strings[200]
#define key_sleft CUR Strings[201]
#define key_smessage CUR Strings[202]
#define key_smove CUR Strings[203]
#define key_snext CUR Strings[204]
#define key_soptions CUR Strings[205]
#define key_sprevious CUR Strings[206]
#define key_sprint CUR Strings[207]
#define key_sredo CUR Strings[208]
#define key_sreplace CUR Strings[209]
#define key_sright CUR Strings[210]
#define key_srsume CUR Strings[211]
#define key_ssave CUR Strings[212]
#define key_ssuspend CUR Strings[213]
#define key_sundo CUR Strings[214]
#define req_for_input CUR Strings[215]
#define key_f11 CUR Strings[216]
#define key_f12 CUR Strings[217]
#define key_f13 CUR Strings[218]
#define key_f14 CUR Strings[219]
#define key_f15 CUR Strings[220]
#define key_f16 CUR Strings[221]
#define key_f17 CUR Strings[222]
#define key_f18 CUR Strings[223]
#define key_f19 CUR Strings[224]
#define key_f20 CUR Strings[225]
#define key_f21 CUR Strings[226]
#define key_f22 CUR Strings[227]
#define key_f23 CUR Strings[228]
#define key_f24 CUR Strings[229]
#define key_f25 CUR Strings[230]
#define key_f26 CUR Strings[231]
#define key_f27 CUR Strings[232]
#define key_f28 CUR Strings[233]
#define key_f29 CUR Strings[234]
#define key_f30 CUR Strings[235]
#define key_f31 CUR Strings[236]
#define key_f32 CUR Strings[237]
#define key_f33 CUR Strings[238]
#define key_f34 CUR Strings[239]
#define key_f35 CUR Strings[240]
#define key_f36 CUR Strings[241]
#define key_f37 CUR Strings[242]
#define key_f38 CUR Strings[243]
#define key_f39 CUR Strings[244]
#define key_f40 CUR Strings[245]
#define key_f41 CUR Strings[246]
#define key_f42 CUR Strings[247]
#define key_f43 CUR Strings[248]
#define key_f44 CUR Strings[249]
#define key_f45 CUR Strings[250]
#define key_f46 CUR Strings[251]
#define key_f47 CUR Strings[252]
#define key_f48 CUR Strings[253]
#define key_f49 CUR Strings[254]
#define key_f50 CUR Strings[255]
#define key_f51 CUR Strings[256]
#define key_f52 CUR Strings[257]
#define key_f53 CUR Strings[258]
#define key_f54 CUR Strings[259]
#define key_f55 CUR Strings[260]
#define key_f56 CUR Strings[261]
#define key_f57 CUR Strings[262]
#define key_f58 CUR Strings[263]
#define key_f59 CUR Strings[264]
#define key_f60 CUR Strings[265]
#define key_f61 CUR Strings[266]
#define key_f62 CUR Strings[267]
#define key_f63 CUR Strings[268]
#define clr_bol CUR Strings[269]
#define clear_margins CUR Strings[270]
#define set_left_margin CUR Strings[271]
#define set_right_margin CUR Strings[272]
#define label_format CUR Strings[273]
#define set_clock CUR Strings[274]
#define display_clock CUR Strings[275]
#define remove_clock CUR Strings[276]
#define create_window CUR Strings[277]
#define goto_window CUR Strings[278]
#define hangup CUR Strings[279]
#define dial_phone CUR Strings[280]
#define quick_dial CUR Strings[281]
#define tone CUR Strings[282]
#define pulse CUR Strings[283]
#define flash_hook CUR Strings[284]
#define fixed_pause CUR Strings[285]
#define wait_tone CUR Strings[286]
#define user0 CUR Strings[287]
#define user1 CUR Strings[288]
#define user2 CUR Strings[289]
#define user3 CUR Strings[290]
#define user4 CUR Strings[291]
#define user5 CUR Strings[292]
#define user6 CUR Strings[293]
#define user7 CUR Strings[294]
#define user8 CUR Strings[295]
#define user9 CUR Strings[296]
#define orig_pair CUR Strings[297]
#define orig_colors CUR Strings[298]
#define initialize_color CUR Strings[299]
#define initialize_pair CUR Strings[300]
#define set_color_pair CUR Strings[301]
#define set_foreground CUR Strings[302]
#define set_background CUR Strings[303]
#define change_char_pitch CUR Strings[304]
#define change_line_pitch CUR Strings[305]
#define change_res_horz CUR Strings[306]
#define change_res_vert CUR Strings[307]
#define define_char CUR Strings[308]
#define enter_doublewide_mode CUR Strings[309]
#define enter_draft_quality CUR Strings[310]
#define enter_italics_mode CUR Strings[311]
#define enter_leftward_mode CUR Strings[312]
#define enter_micro_mode CUR Strings[313]
#define enter_near_letter_quality CUR Strings[314]
#define enter_normal_quality CUR Strings[315]
#define enter_shadow_mode CUR Strings[316]
#define enter_subscript_mode CUR Strings[317]
#define enter_superscript_mode CUR Strings[318]
#define enter_upward_mode CUR Strings[319]
#define exit_doublewide_mode CUR Strings[320]
#define exit_italics_mode CUR Strings[321]
#define exit_leftward_mode CUR Strings[322]
#define exit_micro_mode CUR Strings[323]
#define exit_shadow_mode CUR Strings[324]
#define exit_subscript_mode CUR Strings[325]
#define exit_superscript_mode CUR Strings[326]
#define exit_upward_mode CUR Strings[327]
#define micro_column_address CUR Strings[328]
#define micro_down CUR Strings[329]
#define micro_left CUR Strings[330]
#define micro_right CUR Strings[331]
#define micro_row_address CUR Strings[332]
#define micro_up CUR Strings[333]
#define order_of_pins CUR Strings[334]
#define parm_down_micro CUR Strings[335]
#define parm_left_micro CUR Strings[336]
#define parm_right_micro CUR Strings[337]
#define parm_up_micro CUR Strings[338]
#define select_char_set CUR Strings[339]
#define set_bottom_margin CUR Strings[340]
#define set_bottom_margin_parm CUR Strings[341]
#define set_left_margin_parm CUR Strings[342]
#define set_right_margin_parm CUR Strings[343]
#define set_top_margin CUR Strings[344]
#define set_top_margin_parm CUR Strings[345]
#define start_bit_image CUR Strings[346]
#define start_char_set_def CUR Strings[347]
#define stop_bit_image CUR Strings[348]
#define stop_char_set_def CUR Strings[349]
#define subscript_characters CUR Strings[350]
#define superscript_characters CUR Strings[351]
#define these_cause_cr CUR Strings[352]
#define zero_motion CUR Strings[353]
#define char_set_names CUR Strings[354]
#define key_mouse CUR Strings[355]
#define mouse_info CUR Strings[356]
#define req_mouse_pos CUR Strings[357]
#define get_mouse CUR Strings[358]
#define set_a_foreground CUR Strings[359]
#define set_a_background CUR Strings[360]
#define pkey_plab CUR Strings[361]
#define device_type CUR Strings[362]
#define code_set_init CUR Strings[363]
#define set0_des_seq CUR Strings[364]
#define set1_des_seq CUR Strings[365]
#define set2_des_seq CUR Strings[366]
#define set3_des_seq CUR Strings[367]
#define set_lr_margin CUR Strings[368]
#define set_tb_margin CUR Strings[369]
#define bit_image_repeat CUR Strings[370]
#define bit_image_newline CUR Strings[371]
#define bit_image_carriage_return CUR Strings[372]
#define color_names CUR Strings[373]
#define define_bit_image_region CUR Strings[374]
#define end_bit_image_region CUR Strings[375]
#define set_color_band CUR Strings[376]
#define set_page_length CUR Strings[377]
#define display_pc_char CUR Strings[378]
#define enter_pc_charset_mode CUR Strings[379]
#define exit_pc_charset_mode CUR Strings[380]
#define enter_scancode_mode CUR Strings[381]
#define exit_scancode_mode CUR Strings[382]
#define pc_term_options CUR Strings[383]
#define scancode_escape CUR Strings[384]
#define alt_scancode_esc CUR Strings[385]
#define enter_horizontal_hl_mode CUR Strings[386]
#define enter_left_hl_mode CUR Strings[387]
#define enter_low_hl_mode CUR Strings[388]
#define enter_right_hl_mode CUR Strings[389]
#define enter_top_hl_mode CUR Strings[390]
#define enter_vertical_hl_mode CUR Strings[391]
#define set_a_attributes CUR Strings[392]
#define set_pglen_inch CUR Strings[393]
#define BOOLWRITE 37
#define NUMWRITE 33
#define STRWRITE 394
/* older synonyms for some capabilities */
#define beehive_glitch no_esc_ctlc
#define teleray_glitch dest_tabs_magic_smso
#define micro_char_size micro_col_size
#ifdef __INTERNAL_CAPS_VISIBLE
#define termcap_init2 CUR Strings[394]
#define termcap_reset CUR Strings[395]
#define magic_cookie_glitch_ul CUR Numbers[33]
#define backspaces_with_bs CUR Booleans[37]
#define crt_no_scrolling CUR Booleans[38]
#define no_correctly_working_cr CUR Booleans[39]
#define carriage_return_delay CUR Numbers[34]
#define new_line_delay CUR Numbers[35]
#define linefeed_if_not_lf CUR Strings[396]
#define backspace_if_not_bs CUR Strings[397]
#define gnu_has_meta_key CUR Booleans[40]
#define linefeed_is_newline CUR Booleans[41]
#define backspace_delay CUR Numbers[36]
#define horizontal_tab_delay CUR Numbers[37]
#define number_of_function_keys CUR Numbers[38]
#define other_non_function_keys CUR Strings[398]
#define arrow_key_map CUR Strings[399]
#define has_hardware_tabs CUR Booleans[42]
#define return_does_clr_eol CUR Booleans[43]
#define acs_ulcorner CUR Strings[400]
#define acs_llcorner CUR Strings[401]
#define acs_urcorner CUR Strings[402]
#define acs_lrcorner CUR Strings[403]
#define acs_ltee CUR Strings[404]
#define acs_rtee CUR Strings[405]
#define acs_btee CUR Strings[406]
#define acs_ttee CUR Strings[407]
#define acs_hline CUR Strings[408]
#define acs_vline CUR Strings[409]
#define acs_plus CUR Strings[410]
#define memory_lock CUR Strings[411]
#define memory_unlock CUR Strings[412]
#define box_chars_1 CUR Strings[413]
#endif /* __INTERNAL_CAPS_VISIBLE */
/*
* Predefined terminfo array sizes
*/
#define BOOLCOUNT 44
#define NUMCOUNT 39
#define STRCOUNT 414
/* used by code for comparing entries */
#define acs_chars_index 146
typedef struct termtype { /* in-core form of terminfo data */
char *term_names; /* str_table offset of term names */
char *str_table; /* pointer to string table */
NCURSES_SBOOL *Booleans; /* array of boolean values */
short *Numbers; /* array of integer values */
char **Strings; /* array of string offsets */
#if NCURSES_XNAMES
char *ext_str_table; /* pointer to extended string table */
char **ext_Names; /* corresponding names */
unsigned short num_Booleans;/* count total Booleans */
unsigned short num_Numbers; /* count total Numbers */
unsigned short num_Strings; /* count total Strings */
unsigned short ext_Booleans;/* count extensions to Booleans */
unsigned short ext_Numbers; /* count extensions to Numbers */
unsigned short ext_Strings; /* count extensions to Strings */
#endif /* NCURSES_XNAMES */
} TERMTYPE;
typedef struct term { /* describe an actual terminal */
TERMTYPE type; /* terminal type description */
short Filedes; /* file description being written to */
TTY Ottyb, /* original state of the terminal */
Nttyb; /* current state of the terminal */
int _baudrate; /* used to compute padding */
char * _termname; /* used for termname() */
} TERMINAL;
#if 0 && !0
extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;
#elif 0
NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);
#define cur_term NCURSES_PUBLIC_VAR(cur_term())
#else
extern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;
#endif
#if 0 || 0
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);
NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);
#define boolnames NCURSES_PUBLIC_VAR(boolnames())
#define boolcodes NCURSES_PUBLIC_VAR(boolcodes())
#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())
#define numnames NCURSES_PUBLIC_VAR(numnames())
#define numcodes NCURSES_PUBLIC_VAR(numcodes())
#define numfnames NCURSES_PUBLIC_VAR(numfnames())
#define strnames NCURSES_PUBLIC_VAR(strnames())
#define strcodes NCURSES_PUBLIC_VAR(strcodes())
#define strfnames NCURSES_PUBLIC_VAR(strfnames())
#else
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];
#endif
/* internals */
extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);
extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);
extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);
extern NCURSES_EXPORT(void) _nc_init_termtype (TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);
extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);
extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);
extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);
/* entry points */
extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);
extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);
/* miscellaneous entry points */
extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);
extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);
/* terminfo entry points, also declared in curses.h */
#if !defined(__NCURSES_H)
extern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);
extern NCURSES_EXPORT_VAR(char) ttytype[];
extern NCURSES_EXPORT(int) putp (const char *);
extern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);
#if 1 /* NCURSES_TPARM_VARARGS */
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...); /* special */
#else
extern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */
extern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...); /* special */
#endif
extern NCURSES_EXPORT(char *) tiparm (const char *, ...); /* special */
#endif /* __NCURSES_H */
/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */
#if !defined(NCURSES_TERMCAP_H_incl)
extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);
extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
extern NCURSES_EXPORT(int) tgetent (char *, const char *);
extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
#endif /* NCURSES_TERMCAP_H_incl */
/*
* Include curses.h before term.h to enable these extensions.
*/
#if defined(NCURSES_SP_FUNCS) && (NCURSES_SP_FUNCS != 0)
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tigetstr) (SCREEN*, NCURSES_CONST char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(putp) (SCREEN*, const char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetflag) (SCREEN*, NCURSES_CONST char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tigetnum) (SCREEN*, NCURSES_CONST char *);
#if 1 /* NCURSES_TPARM_VARARGS */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, ...); /* special */
#else
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm) (SCREEN*, NCURSES_CONST char *, long,long,long,long,long,long,long,long,long); /* special */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tparm_varargs) (SCREEN*, NCURSES_CONST char *, ...); /* special */
#endif
/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgetstr) (SCREEN*, NCURSES_CONST char *, char **);
extern NCURSES_EXPORT(char *) NCURSES_SP_NAME(tgoto) (SCREEN*, const char *, int, int);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetent) (SCREEN*, char *, const char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetflag) (SCREEN*, NCURSES_CONST char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tgetnum) (SCREEN*, NCURSES_CONST char *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(tputs) (SCREEN*, const char *, int, NCURSES_SP_OUTC);
extern NCURSES_EXPORT(TERMINAL *) NCURSES_SP_NAME(set_curterm) (SCREEN*, TERMINAL *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(del_curterm) (SCREEN*, TERMINAL *);
extern NCURSES_EXPORT(int) NCURSES_SP_NAME(restartterm) (SCREEN*, NCURSES_CONST char *, int, int *);
#endif /* NCURSES_SP_FUNCS */
#ifdef __cplusplus
}
#endif
#endif /* NCURSES_TERM_H_incl */

View File

@ -0,0 +1,192 @@
/****************************************************************************
* Copyright (c) 1998-2013,2014 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1998-on *
****************************************************************************/
/* $Id: term_entry.h,v 1.45 2014/11/01 14:47:00 tom Exp $ */
/*
* term_entry.h -- interface to entry-manipulation code
*/
#ifndef NCURSES_TERM_ENTRY_H_incl
#define NCURSES_TERM_ENTRY_H_incl 1
#ifdef __cplusplus
extern "C" {
#endif
#include <ncurses/term.h>
/*
* see db_iterator.c - this enumeration lists the places searched for a
* terminal description and defines the order in which they are searched.
*/
typedef enum {
dbdTIC = 0, /* special, used by tic when writing entry */
#if NCURSES_USE_DATABASE
dbdEnvOnce, /* the $TERMINFO environment variable */
dbdHome, /* $HOME/.terminfo */
dbdEnvList, /* the $TERMINFO_DIRS environment variable */
dbdCfgList, /* the compiled-in TERMINFO_DIRS value */
dbdCfgOnce, /* the compiled-in TERMINFO value */
#endif
#if NCURSES_USE_TERMCAP
dbdEnvOnce2, /* the $TERMCAP environment variable */
dbdEnvList2, /* the $TERMPATH environment variable */
dbdCfgList2, /* the compiled-in TERMPATH */
#endif
dbdLAST
} DBDIRS;
#define MAX_USES 32
#define MAX_CROSSLINKS 16
typedef struct entry {
TERMTYPE tterm;
unsigned nuses;
struct {
char *name;
struct entry *link;
long line;
} uses[MAX_USES];
int ncrosslinks;
struct entry *crosslinks[MAX_CROSSLINKS];
long cstart, cend;
long startline;
struct entry *next;
struct entry *last;
} ENTRY;
/* *INDENT-OFF* */
#if NCURSES_XNAMES
#define NUM_BOOLEANS(tp) (tp)->num_Booleans
#define NUM_NUMBERS(tp) (tp)->num_Numbers
#define NUM_STRINGS(tp) (tp)->num_Strings
#define EXT_NAMES(tp,i,limit,index,table) (i >= limit) ? tp->ext_Names[index] : table[i]
#else
#define NUM_BOOLEANS(tp) BOOLCOUNT
#define NUM_NUMBERS(tp) NUMCOUNT
#define NUM_STRINGS(tp) STRCOUNT
#define EXT_NAMES(tp,i,limit,index,table) table[i]
#endif
#define NUM_EXT_NAMES(tp) (unsigned) ((tp)->ext_Booleans + (tp)->ext_Numbers + (tp)->ext_Strings)
#define for_each_boolean(n,tp) for(n = 0; n < NUM_BOOLEANS(tp); n++)
#define for_each_number(n,tp) for(n = 0; n < NUM_NUMBERS(tp); n++)
#define for_each_string(n,tp) for(n = 0; n < NUM_STRINGS(tp); n++)
#if NCURSES_XNAMES
#define for_each_ext_boolean(n,tp) for(n = BOOLCOUNT; n < NUM_BOOLEANS(tp); n++)
#define for_each_ext_number(n,tp) for(n = NUMCOUNT; n < NUM_NUMBERS(tp); n++)
#define for_each_ext_string(n,tp) for(n = STRCOUNT; n < NUM_STRINGS(tp); n++)
#endif
#define ExtBoolname(tp,i,names) EXT_NAMES(tp, i, BOOLCOUNT, (i - (tp->num_Booleans - tp->ext_Booleans)), names)
#define ExtNumname(tp,i,names) EXT_NAMES(tp, i, NUMCOUNT, (i - (tp->num_Numbers - tp->ext_Numbers)) + tp->ext_Booleans, names)
#define ExtStrname(tp,i,names) EXT_NAMES(tp, i, STRCOUNT, (i - (tp->num_Strings - tp->ext_Strings)) + (tp->ext_Numbers + tp->ext_Booleans), names)
extern NCURSES_EXPORT_VAR(ENTRY *) _nc_head;
extern NCURSES_EXPORT_VAR(ENTRY *) _nc_tail;
#define for_entry_list(qp) for (qp = _nc_head; qp; qp = qp->next)
#define MAX_LINE 132
#define NULLHOOK (bool(*)(ENTRY *))0
/*
* Note that WANTED and PRESENT are not simple inverses! If a capability
* has been explicitly cancelled, it's not considered WANTED.
*/
#define WANTED(s) ((s) == ABSENT_STRING)
#define PRESENT(s) (((s) != ABSENT_STRING) && ((s) != CANCELLED_STRING))
#define ANDMISSING(p,q) \
{if (PRESENT(p) && !PRESENT(q)) _nc_warning(#p " but no " #q);}
#define PAIRED(p,q) \
{ \
if (PRESENT(q) && !PRESENT(p)) \
_nc_warning(#q " but no " #p); \
if (PRESENT(p) && !PRESENT(q)) \
_nc_warning(#p " but no " #q); \
}
/* alloc_entry.c: elementary allocation code */
extern NCURSES_EXPORT(ENTRY *) _nc_copy_entry (ENTRY *oldp);
extern NCURSES_EXPORT(char *) _nc_save_str (const char *const);
extern NCURSES_EXPORT(void) _nc_init_entry (TERMTYPE *const);
extern NCURSES_EXPORT(void) _nc_merge_entry (TERMTYPE *const, TERMTYPE *const);
extern NCURSES_EXPORT(void) _nc_wrap_entry (ENTRY *const, bool);
/* alloc_ttype.c: elementary allocation code */
extern NCURSES_EXPORT(void) _nc_align_termtype (TERMTYPE *, TERMTYPE *);
extern NCURSES_EXPORT(void) _nc_copy_termtype (TERMTYPE *, const TERMTYPE *);
/* free_ttype.c: elementary allocation code */
extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *);
/* lib_acs.c */
extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */
/* lib_termcap.c: trim sgr0 string for termcap users */
extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE *);
/* parse_entry.c: entry-parsing code */
#if NCURSES_XNAMES
extern NCURSES_EXPORT_VAR(bool) _nc_user_definable;
extern NCURSES_EXPORT_VAR(bool) _nc_disable_period;
#endif
extern NCURSES_EXPORT(int) _nc_parse_entry (ENTRY *, int, bool);
extern NCURSES_EXPORT(int) _nc_capcmp (const char *, const char *);
/* write_entry.c: writing an entry to the file system */
extern NCURSES_EXPORT(void) _nc_set_writedir (const char *);
extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const);
/* comp_parse.c: entry list handling */
extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*));
extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *);
extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */
extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool);
extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *);
extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */
extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE *, bool);
/* trace_xnames.c */
extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *);
/* *INDENT-ON* */
#ifdef __cplusplus
}
#endif
#endif /* NCURSES_TERM_ENTRY_H_incl */

View File

@ -0,0 +1,75 @@
/****************************************************************************
* Copyright (c) 1998,2000 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
****************************************************************************/
/* $Id: termcap.h.in,v 1.16 2001/03/24 21:53:27 tom Exp $ */
#ifndef NCURSES_TERMCAP_H_incl
#define NCURSES_TERMCAP_H_incl 1
#undef NCURSES_VERSION
#define NCURSES_VERSION "6.0"
#include <ncurses/ncurses_dll.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <sys/types.h>
#undef NCURSES_CONST
#define NCURSES_CONST const
#undef NCURSES_OSPEED
#define NCURSES_OSPEED short
extern NCURSES_EXPORT_VAR(char) PC;
extern NCURSES_EXPORT_VAR(char *) UP;
extern NCURSES_EXPORT_VAR(char *) BC;
extern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed;
#if !defined(NCURSES_TERM_H_incl)
extern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);
extern NCURSES_EXPORT(char *) tgoto (const char *, int, int);
extern NCURSES_EXPORT(int) tgetent (char *, const char *);
extern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);
extern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));
#endif
#ifdef __cplusplus
}
#endif
#endif /* NCURSES_TERMCAP_H_incl */

View File

@ -0,0 +1,341 @@
/****************************************************************************
* Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. *
* *
* 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, distribute with modifications, 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 ABOVE 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. *
* *
* Except as contained in this notice, the name(s) of the above copyright *
* holders shall not be used in advertising or otherwise to promote the *
* sale, use or other dealings in this Software without prior written *
* authorization. *
****************************************************************************/
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
* and: Thomas E. Dickey 1996 on *
****************************************************************************/
/*
* $Id: tic.h,v 1.69 2012/03/17 18:22:10 tom Exp $
* tic.h - Global variables and structures for the terminfo
* compiler.
*/
#ifndef __TIC_H
#define __TIC_H
/* *INDENT-OFF* */
#ifdef __cplusplus
extern "C" {
#endif
#include <ncurses/curses.h> /* for the _tracef() prototype, ERR/OK, bool defs */
/*
** The format of compiled terminfo files is as follows:
**
** Header (12 bytes), containing information given below
** Names Section, containing the names of the terminal
** Boolean Section, containing the values of all of the
** boolean capabilities
** A null byte may be inserted here to make
** sure that the Number Section begins on an
** even word boundary.
** Number Section, containing the values of all of the numeric
** capabilities, each as a short integer
** String Section, containing short integer offsets into the
** String Table, one per string capability
** String Table, containing the actual characters of the string
** capabilities.
**
** NOTE that all short integers in the file are stored using VAX/PDP-style
** byte-order, i.e., least-significant byte first.
**
** There is no structure definition here because it would only confuse
** matters. Terminfo format is a raw byte layout, not a structure
** dump. If you happen to be on a little-endian machine with 16-bit
** shorts that requires no padding between short members in a struct,
** then there is a natural C structure that captures the header, but
** not very helpfully.
*/
#define MAGIC 0432 /* first two bytes of a compiled entry */
#undef BYTE
#define BYTE(p,n) (unsigned char)((p)[n])
#define IS_NEG1(p) ((BYTE(p,0) == 0377) && (BYTE(p,1) == 0377))
#define IS_NEG2(p) ((BYTE(p,0) == 0376) && (BYTE(p,1) == 0377))
#define LOW_MSB(p) (BYTE(p,0) + 256*BYTE(p,1))
#define IS_TIC_MAGIC(p) (LOW_MSB(p) == MAGIC)
/*
* The "maximum" here is misleading; XSI guarantees minimum values, which a
* given implementation may exceed.
*/
#define MAX_NAME_SIZE 512 /* maximum legal name field size (XSI:127) */
#define MAX_ENTRY_SIZE 4096 /* maximum legal entry size */
/*
* The maximum size of individual name or alias is guaranteed in XSI to be at
* least 14, since that corresponds to the older filename lengths. Newer
* systems allow longer aliases, though not many terminal descriptions are
* written to use them. The MAX_ALIAS symbol is used for warnings.
*/
#if HAVE_LONG_FILE_NAMES
#define MAX_ALIAS 32 /* smaller than POSIX minimum for PATH_MAX */
#else
#define MAX_ALIAS 14 /* SVr3 filename length */
#endif
/* location of user's personal info directory */
#define PRIVATE_INFO "%s/.terminfo" /* plug getenv("HOME") into %s */
/*
* Some traces are designed to be used via tic's verbose option (and similar in
* infocmp and toe) rather than the 'trace()' function. So we use the bits
* above the normal trace() parameter as a debug-level.
*/
#define MAX_DEBUG_LEVEL 15
#define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT)
#define set_trace_level(n) \
_nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \
_nc_tracing |= DEBUG_LEVEL(n)
#ifdef TRACE
#define DEBUG(n, a) if (_nc_tracing >= DEBUG_LEVEL(n)) _tracef a
#else
#define DEBUG(n, a) /*nothing*/
#endif
extern NCURSES_EXPORT_VAR(unsigned) _nc_tracing;
extern NCURSES_EXPORT(void) _nc_tracef (char *, ...) GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);
extern NCURSES_EXPORT(const char *) _nc_visbuf2 (int, const char *);
/*
* These are the types of tokens returned by the scanner. The first
* three are also used in the hash table of capability names. The scanner
* returns one of these values after loading the specifics into the global
* structure curr_token.
*/
#define BOOLEAN 0 /* Boolean capability */
#define NUMBER 1 /* Numeric capability */
#define STRING 2 /* String-valued capability */
#define CANCEL 3 /* Capability to be cancelled in following tc's */
#define NAMES 4 /* The names for a terminal type */
#define UNDEF 5 /* Undefined */
#define NO_PUSHBACK -1 /* used in pushtype to indicate no pushback */
/*
* The global structure in which the specific parts of a
* scanned token are returned.
*
*/
struct token
{
char *tk_name; /* name of capability */
int tk_valnumber; /* value of capability (if a number) */
char *tk_valstring; /* value of capability (if a string) */
};
extern NCURSES_EXPORT_VAR(struct token) _nc_curr_token;
/*
* Offsets to string capabilities, with the corresponding functionkey
* codes.
*/
struct tinfo_fkeys {
unsigned offset;
chtype code;
};
#if BROKEN_LINKER
#define _nc_tinfo_fkeys _nc_tinfo_fkeysf()
extern NCURSES_EXPORT(const struct tinfo_fkeys *) _nc_tinfo_fkeysf (void);
#else
extern NCURSES_EXPORT_VAR(const struct tinfo_fkeys) _nc_tinfo_fkeys[];
#endif
typedef short HashValue;
/*
* The file comp_captab.c contains an array of these structures, one
* per possible capability. These are indexed by a hash table array of
* pointers to the same structures for use by the parser.
*/
struct name_table_entry
{
const char *nte_name; /* name to hash on */
int nte_type; /* BOOLEAN, NUMBER or STRING */
HashValue nte_index; /* index of associated variable in its array */
HashValue nte_link; /* index in table of next hash, or -1 */
};
/*
* Use this structure to hide differences between terminfo and termcap
* tables.
*/
typedef struct {
unsigned table_size;
const HashValue *table_data;
HashValue (*hash_of)(const char *);
int (*compare_names)(const char *, const char *);
} HashData;
struct alias
{
const char *from;
const char *to;
const char *source;
};
extern NCURSES_EXPORT(const struct name_table_entry *) _nc_get_table (bool);
extern NCURSES_EXPORT(const HashData *) _nc_get_hash_info (bool);
extern NCURSES_EXPORT(const HashValue *) _nc_get_hash_table (bool);
extern NCURSES_EXPORT(const struct alias *) _nc_get_alias_table (bool);
#define NOTFOUND ((struct name_table_entry *) 0)
/*
* The casts are required for correct sign-propagation with systems such as
* AIX, IRIX64, Solaris which default to unsigned characters. The C standard
* leaves this detail unspecified.
*/
/* out-of-band values for representing absent capabilities */
#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */
#define ABSENT_NUMERIC (-1)
#define ABSENT_STRING (char *)0
/* out-of-band values for representing cancels */
#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */
#define CANCELLED_NUMERIC (-2)
#define CANCELLED_STRING (char *)(-1)
#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */
#define VALID_NUMERIC(s) ((s) >= 0)
#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)
/* termcap entries longer than this may break old binaries */
#define MAX_TERMCAP_LENGTH 1023
/* this is a documented limitation of terminfo */
#define MAX_TERMINFO_LENGTH 4096
#ifndef TERMINFO
#define TERMINFO "/usr/share/terminfo"
#endif
#ifdef NCURSES_TERM_ENTRY_H_incl
/* access.c */
extern NCURSES_EXPORT(unsigned) _nc_pathlast (const char *);
extern NCURSES_EXPORT(bool) _nc_is_abs_path (const char *);
extern NCURSES_EXPORT(bool) _nc_is_dir_path (const char *);
extern NCURSES_EXPORT(bool) _nc_is_file_path (const char *);
extern NCURSES_EXPORT(char *) _nc_basename (char *);
extern NCURSES_EXPORT(char *) _nc_rootname (char *);
/* comp_hash.c: name lookup */
extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_entry
(const char *, const HashValue *);
extern NCURSES_EXPORT(struct name_table_entry const *) _nc_find_type_entry
(const char *, int, bool);
/* comp_scan.c: lexical analysis */
extern NCURSES_EXPORT(int) _nc_get_token (bool);
extern NCURSES_EXPORT(void) _nc_panic_mode (char);
extern NCURSES_EXPORT(void) _nc_push_token (int);
extern NCURSES_EXPORT(void) _nc_reset_input (FILE *, char *);
extern NCURSES_EXPORT_VAR(int) _nc_curr_col;
extern NCURSES_EXPORT_VAR(int) _nc_curr_line;
extern NCURSES_EXPORT_VAR(int) _nc_syntax;
extern NCURSES_EXPORT_VAR(int) _nc_strict_bsd;
extern NCURSES_EXPORT_VAR(long) _nc_comment_end;
extern NCURSES_EXPORT_VAR(long) _nc_comment_start;
extern NCURSES_EXPORT_VAR(long) _nc_curr_file_pos;
extern NCURSES_EXPORT_VAR(long) _nc_start_line;
#define SYN_TERMINFO 0
#define SYN_TERMCAP 1
/* comp_error.c: warning & abort messages */
extern NCURSES_EXPORT(const char *) _nc_get_source (void);
extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
extern NCURSES_EXPORT(void) _nc_get_type (char *name);
extern NCURSES_EXPORT(void) _nc_set_source (const char *const);
extern NCURSES_EXPORT(void) _nc_set_type (const char *const);
extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2);
extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings;
/* comp_expand.c: expand string into readable form */
extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int);
/* comp_scan.c: decode string from readable form */
extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *);
/* captoinfo.c: capability conversion */
extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const);
extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int const);
/* home_terminfo.c */
extern NCURSES_EXPORT(char *) _nc_home_terminfo (void);
/* lib_tparm.c */
#define NUM_PARM 9
extern NCURSES_EXPORT_VAR(int) _nc_tparm_err;
extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *, char **, int *);
/* lib_tputs.c */
extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */
/* comp_main.c: compiler main */
extern const char * _nc_progname;
/* db_iterator.c */
extern NCURSES_EXPORT(const char *) _nc_next_db(DBDIRS *, int *);
extern NCURSES_EXPORT(const char *) _nc_tic_dir (const char *);
extern NCURSES_EXPORT(void) _nc_first_db(DBDIRS *, int *);
extern NCURSES_EXPORT(void) _nc_last_db(void);
/* write_entry.c */
extern NCURSES_EXPORT(int) _nc_tic_written (void);
#endif /* NCURSES_TERM_ENTRY_H_incl */
#ifdef __cplusplus
}
#endif
/* *INDENT-ON* */
#endif /* __TIC_H */

Some files were not shown because too many files have changed in this diff Show More