Haxchi v2.0 - now with its own installer!

This commit is contained in:
FIX94 2016-11-28 05:35:13 +01:00
parent 97fa900877
commit 527d39deb7
194 changed files with 22063 additions and 566 deletions

20
Build.bat Normal file
View File

@ -0,0 +1,20 @@
@echo off
cd installer
mkdir data 2>/nul
cd ../dsrom
echo.
echo Building DS ROMs
echo.
make clean
make
cd ../installer
echo.
echo Building WiiU Installer
echo.
make clean
make
echo.
pause

View File

@ -1,31 +1,13 @@
# haxchi
# Haxchi
This is a ported version of the haxchi exploit created by smea and others for all sorts of different ds vc games.
In addition to being ported it also includes a homebrew launcher loader as its payload so you can use it for a lot of things.
This is the continuation of the POC Haxchi exploit by smea.
It features compatibility with a lot of DS VC and can be easly installed and further configured.
## install process
## Installation
haxchi can be very easily installed using iosuhax's wupclient. for example, if hachihachi is installed to the MLC, it suffices to do:
```
w.up("rom.zip", "/vol/storage_mlc01/usr/title/00050000/YOUR_GAME_TITLE_ID/content/0010/rom.zip")
```
of course, using wupclient to install haxchi permanently requires that redNAND be disabled, unless hachihachi is installed to USB, in which case it can be installed from redNAND using:
```
w.up("rom.zip", "/vol/storage_usb01/usr/title/00050000/YOUR_GAME_TITLE_ID/content/0010/rom.zip")
```
To upload a config.txt as well you will have to do the following if the title is installed on NAND:
```
w.up("config.txt", "/vol/storage_mlc01/usr/title/00050000/YOUR_GAME_TITLE_ID/content/config.txt")
w.chmod("/vol/storage_mlc01/usr/title/00050000/YOUR_GAME_TITLE_ID/content/config.txt", 0x644)
```
and for the title being installed to USB you do the following:
```
w.up("config.txt", "/vol/storage_usb01/usr/title/00050000/YOUR_GAME_TITLE_ID/content/config.txt")
w.chmod("/vol/storage_usb01/usr/title/00050000/YOUR_GAME_TITLE_ID/content/config.txt", 0x644)
```
make sure to replace YOUR_GAME_TITLE_ID with one of the following:
Grab the current .elf from the release tab and put it into sd:/wiiu/apps so it can be run by the homebrew launcher later.
For extras such as replaced icon, startup logo, startup sound, game title and button configuration download the "haxchi" archive and put its content into a folder on your sd called "sd:/haxchi". This folder will be used during installation to set up the game of your choice and you can adjust its content to your liking.
The following games right now are supported by the installer:
| Game | JPN | US | PAL |
|---|:---:|:---:|:---:|
@ -47,22 +29,6 @@ make sure to replace YOUR_GAME_TITLE_ID with one of the following:
|Zelda Phantom Hourglass|101C3600|101C3700|101C3800|
|Kirby Mass Attack|101C8600|101C8700|101C8800|
a config.txt can look like this for example:
```
a=fw.img
b=rednand/fw.img
x=wiiu/apps/ftpiiu/ftpiiu.elf
down=wiiu/apps/snes9x2010_libretro/snes9x2010_libretro.elf
default=wiiu/apps/homebrew_launcher/homebrew_launcher.elf
```
please note though that if you want to load a fw.img the name HAS to be named fw.img in whatever folder you use, nothing else will work.
## contents
* hbl_loader: a loader which will load up the homebrew launcher from sd card
* haxchi_rop.s: hachihachi process ROP which will emit hbl_loader as executable
* haxchi.s: generates a malicious SRL file
## credit
smea, plutoo, yellows8, naehrwert, derrek, FIX94 and dimok

View File

@ -1,215 +1,215 @@
.PHONY := all code550.bin
ifeq ($(Windows_NT), 1)
ZIP = zip/zip.exe
else
ZIP = zip
endif
all: setup brainage dkjclimber kirby kirbymassattack mariokartds masterofdisguise newsmb_eur partnersintime sfcommand sm64ds yoshids zeldaph zeldast \
brainage.zip dkjclimber.zip kirby.zip kirbymassattack.zip mariokartds.zip masterofdisguise.zip newsmb_eur.zip partnersintime.zip \
sfcommand.zip sm64ds.zip yoshids.zip yoshitouchandgo.zip zeldaph.zip zeldast.zip
brainage: setup_brainage brainage.nds
dkjclimber: setup_dkjclimber dkjclimber.nds
kirby: setup_kirby kirby.nds
kirbymassattack: setup_kirbymassattack kirbymassattack.nds
.PHONY := all code550.bin
ifeq ($(Windows_NT), 1)
ZIP = zip/zip.exe
else
ZIP = zip
endif
all: setup brainage dkjclimber kirby kirbymassattack mariokartds masterofdisguise newsmb_eur partnersintime sfcommand sm64ds yoshids zeldaph zeldast \
brainage.zip dkjclimber.zip kirby.zip kirbymassattack.zip mariokartds.zip masterofdisguise.zip newsmb_eur.zip partnersintime.zip \
sfcommand.zip sm64ds.zip yoshids.zip zeldaph.zip zeldast.zip
brainage: setup_brainage brainage.nds
dkjclimber: setup_dkjclimber dkjclimber.nds
kirby: setup_kirby kirby.nds
kirbymassattack: setup_kirbymassattack kirbymassattack.nds
mariokartds: setup_mariokartds mariokartds.nds
masterofdisguise: setup_masterofdisguise masterofdisguise.nds
newsmb_eur: setup_newsmb_eur newsmb_eur.nds
partnersintime: setup_partnersintime partnersintime.nds
sfcommand: setup_sfcommand sfcommand.nds
sm64ds: setup_sm64ds sm64ds.nds
yoshids: setup_yoshids yoshids.nds
zeldaph: setup_zeldaph zeldaph.nds
zeldast: setup_zeldast zeldast.nds
setup:
@cd option_select && make && cd ..
@cd hbl_loader && make && cd ..
@cd cfw_booter && make && cd ..
setup_brainage:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
masterofdisguise: setup_masterofdisguise masterofdisguise.nds
newsmb_eur: setup_newsmb_eur newsmb_eur.nds
partnersintime: setup_partnersintime partnersintime.nds
sfcommand: setup_sfcommand sfcommand.nds
sm64ds: setup_sm64ds sm64ds.nds
yoshids: setup_yoshids yoshids.nds
zeldaph: setup_zeldaph zeldaph.nds
zeldast: setup_zeldast zeldast.nds
setup:
@cd option_select && make && cd ..
@cd hbl_loader && make && cd ..
@cd cfw_booter && make && cd ..
setup_brainage:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f brainage_defs.s defines.s
setup_dkjclimber:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f dkjclimber_defs.s defines.s
setup_kirby:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
setup_dkjclimber:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f dkjclimber_defs.s defines.s
setup_kirby:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f kirby_defs.s defines.s
setup_kirbymassattack:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f kirbymassattack_defs.s defines.s
setup_mariokartds:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f mariokartds_defs.s defines.s
setup_masterofdisguise:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f masterofdisguise_defs.s defines.s
setup_newsmb_eur:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f newsmb_eur_defs.s defines.s
setup_partnersintime:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f partnersintime_defs.s defines.s
setup_sfcommand:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f sfcommand_defs.s defines.s
setup_sm64ds:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f sm64ds_defs.s defines.s
setup_yoshids:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f yoshids_defs.s defines.s
setup_zeldaph:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
setup_kirbymassattack:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f kirbymassattack_defs.s defines.s
setup_mariokartds:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f mariokartds_defs.s defines.s
setup_masterofdisguise:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f masterofdisguise_defs.s defines.s
setup_newsmb_eur:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f newsmb_eur_defs.s defines.s
setup_partnersintime:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f partnersintime_defs.s defines.s
setup_sfcommand:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f sfcommand_defs.s defines.s
setup_sm64ds:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f sm64ds_defs.s defines.s
setup_yoshids:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f yoshids_defs.s defines.s
setup_zeldaph:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f zeldaph_defs.s defines.s
setup_zeldast:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f zeldast_defs.s defines.s
brainage.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds brainage.nds
@cp brainage.nds yoshitouchandgo.nds
dkjclimber.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds dkjclimber.nds
kirby.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds kirby.nds
kirbymassattack.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds kirbymassattack.nds
mariokartds.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds mariokartds.nds
@cp mariokartds.nds newsmb.nds
masterofdisguise.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds masterofdisguise.nds
newsmb_eur.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds newsmb_eur.nds
partnersintime.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds partnersintime.nds
sfcommand.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds sfcommand.nds
sm64ds.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds sm64ds.nds
@cp sm64ds.nds kirbycanvascurse.nds
yoshids.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds yoshids.nds
@cp yoshids.nds wwtouched.nds
@cp yoshids.nds bigbrainacademy.nds
zeldaph.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds zeldaph.nds
zeldast.nds:
@armips haxchi_rop.s
@armips haxchi.s
setup_zeldast:
@rm -f defines.s haxchi_rop.bin haxchi_rop_hook.bin
@cp -f zeldast_defs.s defines.s
brainage.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds brainage.nds
@cp brainage.nds yoshitouchandgo.nds
dkjclimber.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds dkjclimber.nds
kirby.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds kirby.nds
kirbymassattack.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds kirbymassattack.nds
mariokartds.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds mariokartds.nds
@cp mariokartds.nds newsmb.nds
masterofdisguise.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds masterofdisguise.nds
newsmb_eur.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds newsmb_eur.nds
partnersintime.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds partnersintime.nds
sfcommand.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds sfcommand.nds
sm64ds.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds sm64ds.nds
@cp sm64ds.nds kirbycanvascurse.nds
yoshids.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds yoshids.nds
@cp yoshids.nds wwtouched.nds
@cp yoshids.nds bigbrainacademy.nds
zeldaph.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds zeldaph.nds
zeldast.nds:
@armips haxchi_rop.s
@armips haxchi.s
@mv rom.nds zeldast.nds
brainage.zip:
$(ZIP) -JXjq9 brainage.zip brainage.nds
$(ZIP) -JXjq9 yoshitouchandgo.zip yoshitouchandgo.nds
dkjclimber.zip:
$(ZIP) -JXjq9 dkjclimber.zip dkjclimber.nds
kirby.zip:
$(ZIP) -JXjq9 kirby.zip kirby.nds
kirbymassattack.zip:
$(ZIP) -JXjq9 kirbymassattack.zip kirbymassattack.nds
mariokartds.zip:
$(ZIP) -JXjq9 mariokartds.zip mariokartds.nds
$(ZIP) -JXjq9 newsmb.zip newsmb.nds
masterofdisguise.zip:
$(ZIP) -JXjq9 masterofdisguise.zip masterofdisguise.nds
newsmb_eur.zip:
$(ZIP) -JXjq9 newsmb_eur.zip newsmb_eur.nds
partnersintime.zip:
$(ZIP) -JXjq9 partnersintime.zip partnersintime.nds
sfcommand.zip:
$(ZIP) -JXjq9 sfcommand.zip sfcommand.nds
sm64ds.zip:
$(ZIP) -JXjq9 sm64ds.zip sm64ds.nds
$(ZIP) -JXjq9 kirbycanvascurse.zip kirbycanvascurse.nds
yoshids.zip:
$(ZIP) -JXjq9 yoshids.zip yoshids.nds
$(ZIP) -JXjq9 wwtouched.zip wwtouched.nds
$(ZIP) -JXjq9 bigbrainacademy.zip bigbrainacademy.nds
zeldaph.zip:
$(ZIP) -JXjq9 zeldaph.zip zeldaph.nds
zeldast.zip:
$(ZIP) -JXjq9 zeldast.zip zeldast.nds
clean:
@rm -f *.bin *.nds *.zip defines.s
@cd option_select && make clean && cd ..
@cd hbl_loader && make clean && cd ..
@cd cfw_booter && make clean && cd ..
@echo "all cleaned up !"
brainage.zip:
$(ZIP) -JXjq9 ../installer/data/brainage.zip brainage.nds
$(ZIP) -JXjq9 ../installer/data/yoshitouchandgo.zip yoshitouchandgo.nds
dkjclimber.zip:
$(ZIP) -JXjq9 ../installer/data/dkjclimber.zip dkjclimber.nds
kirby.zip:
$(ZIP) -JXjq9 ../installer/data/kirby.zip kirby.nds
kirbymassattack.zip:
$(ZIP) -JXjq9 ../installer/data/kirbymassattack.zip kirbymassattack.nds
mariokartds.zip:
$(ZIP) -JXjq9 ../installer/data/mariokartds.zip mariokartds.nds
$(ZIP) -JXjq9 ../installer/data/newsmb.zip newsmb.nds
masterofdisguise.zip:
$(ZIP) -JXjq9 ../installer/data/masterofdisguise.zip masterofdisguise.nds
newsmb_eur.zip:
$(ZIP) -JXjq9 ../installer/data/newsmb_eur.zip newsmb_eur.nds
partnersintime.zip:
$(ZIP) -JXjq9 ../installer/data/partnersintime.zip partnersintime.nds
sfcommand.zip:
$(ZIP) -JXjq9 ../installer/data/sfcommand.zip sfcommand.nds
sm64ds.zip:
$(ZIP) -JXjq9 ../installer/data/sm64ds.zip sm64ds.nds
$(ZIP) -JXjq9 ../installer/data/kirbycanvascurse.zip kirbycanvascurse.nds
yoshids.zip:
$(ZIP) -JXjq9 ../installer/data/yoshids.zip yoshids.nds
$(ZIP) -JXjq9 ../installer/data/wwtouched.zip wwtouched.nds
$(ZIP) -JXjq9 ../installer/data/bigbrainacademy.zip bigbrainacademy.nds
zeldaph.zip:
$(ZIP) -JXjq9 ../installer/data/zeldaph.zip zeldaph.nds
zeldast.zip:
$(ZIP) -JXjq9 ../installer/data/zeldast.zip zeldast.nds
clean:
@rm -f *.bin *.nds ../installer/data/*.zip defines.s
@cd option_select && make clean && cd ..
@cd hbl_loader && make clean && cd ..
@cd cfw_booter && make clean && cd ..
@echo "all cleaned up !"

View File

@ -1,40 +1,40 @@
.include "defines.s"
.create "rom.nds", 0
.nds
.org 0x000
.ascii "HAXCHI" ; Game Title
.org 0x00C
.ascii "HAXX" ; Gamecode
.ascii "01" ; Makercode
.byte 0x00 ; Unitcode
.org 0x020
.word arm9_data ; ARM9 rom_offset
.word 0x2000800 ; ARM9 entry_address
.word 0x2000000 ; ARM9 ram_address
.word arm9_data_end - arm9_data ; ARM9 size
.word arm7_data ; ARM7 rom_offset
.word 0x2000000 ; ARM7 entry_address
.word ARM7_ROM_MEM2_START + HAX_TARGET_ADDRESS ; ARM7 ram_address
.word arm7_data_end - arm7_data ; ARM7 size
.org 0x080
.word total_size ; Total Used ROM size
.word 0x4000 ; ROM Header Size
.org 0x8000
arm9_data:
.incbin "haxchi_rop.bin"
arm9_data_end:
.align 0x1000
arm7_data:
.incbin "haxchi_rop_hook.bin"
arm7_data_end:
total_size:
.Close
.include "defines.s"
.create "rom.nds", 0
.nds
.org 0x000
.ascii "HAXCHI" ; Game Title
.org 0x00C
.ascii "HAXX" ; Gamecode
.ascii "01" ; Makercode
.byte 0x00 ; Unitcode
.org 0x020
.word arm9_data ; ARM9 rom_offset
.word 0x2000800 ; ARM9 entry_address
.word 0x2000000 ; ARM9 ram_address
.word arm9_data_end - arm9_data ; ARM9 size
.word arm7_data ; ARM7 rom_offset
.word 0x2000000 ; ARM7 entry_address
.word ARM7_ROM_MEM2_START + HAX_TARGET_ADDRESS ; ARM7 ram_address
.word arm7_data_end - arm7_data ; ARM7 size
.org 0x080
.word total_size ; Total Used ROM size
.word 0x4000 ; ROM Header Size
.org 0x8000
arm9_data:
.incbin "haxchi_rop.bin"
arm9_data_end:
.align 0x1000
arm7_data:
.incbin "haxchi_rop_hook.bin"
arm7_data_end:
total_size:
.Close

View File

@ -1,275 +1,275 @@
.include "coreinit.s"
.include "defines.s"
; more useful definitions
HBL_LOADER_ADR equ (0x01800000)
SELECTOR_ADDRESS equ (0x01808000)
CFW_BOOTER_ADR equ (0x0180C000)
NERD_THREAD0OBJECT equ (HAX_TARGET_ADDRESS - 0x1000)
NERD_THREAD2OBJECT equ (HAX_TARGET_ADDRESS - 0x2000)
.macro set_sp,v
.word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEADBABE ; r30
.word v ; r31
.word 0xDEAD0001 ; garbage
.word MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR
.word 0xDEADBABE ; r26
.word 0xDEADBABE ; r27
.word 0xDEADBABE ; r28
.word 0xDEADBABE ; r29
.word 0xDEADBABE ; r30
.word 0xDEADBABE ; r31
.word 0xDEAD0001 ; garbage
.word LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR
.endmacro
.macro call_func,f,arg1,arg2,arg3,arg4
.word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEADBABE ; r21
.word 0xDEADBABE ; r22
.word 0xDEADBABE ; r23
.word 0xDEADBABE ; r24
.word 0xDEADBABE ; r25
.word 0xDEADBABE ; r26
.word f ; r27 (ctr)
.word arg4 ; r28 (r6)
.word arg3 ; r29 (r5)
.word arg2 ; r30 (r4)
.word arg1 - 2 ; r31 (r3 - 2)
; sp is here when LMW_R26R1x18 happens
.word 0xDEAD0004 ; garbage
.word MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR
.word 0xDEAD0008 ; garbage
.word 0xDEAD000C ; garbage
.word 0xDEAD0010 ; garbage
.word 0xDEAD0014 ; garbage
.word 0xDEADBABE ; r26
.word 0xDEADBABE ; r27
.word 0xDEADBABE ; r28
.word 0xDEADBABE ; r29
.word 0xDEADBABE ; r30
.word 0xDEADBABE ; r31
; final sp is here
.word 0xDEADBABE ; garbage
.endmacro
.macro call_func_6args,f,arg1,arg2,arg3,arg4,arg5,arg6
.word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR
.word 0xDEAD0001 ; garbage
.word arg6 ; r21 (r8)
.word 0xDEADBABE ; r22
.word 0xDEADBABE ; r23
.word arg1 ; r24 (r3)
.word arg2 ; r25 (r4)
.word 0xDEADBABE ; r26
.word arg3 ; r27 (r5)
.word arg4 ; r28 (r6)
.word arg5 ; r29 (r7)
.word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR ; r30 (ctr)
.word 0xDEADBABE ; r31
; sp is here when LMW_R26R1x18 happens
.word 0xDEAD0004 ; garbage
.word MTCTR_R30_MR_R8R21_R7R29_R6R28_R5R27_R4R25_R3R24_BCTRL
.word 0xDEAD0001 ; garbage
.word 0xDEADBABE ; r21
.word 0xDEADBABE ; r22
.word 0xDEADBABE ; r23
.word 0xDEADBABE ; r24
.word 0xDEADBABE ; r25
.word 0xDEADBABE ; r26
.word f ; r27 (ctr)
.word arg4 ; r28 (r6)
.word arg3 ; r29 (r5)
.word arg2 ; r30 (r4)
.word arg1 - 2 ; r31 (r3 - 2)
; sp is here when LMW_R26R1x18 happens
.word 0xDEAD0004 ; garbage
.word MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR
.word 0xDEAD0008 ; garbage
.word 0xDEAD000C ; garbage
.word 0xDEAD0010 ; garbage
.word 0xDEAD0014 ; garbage
.word 0xDEADBABE ; r26
.word 0xDEADBABE ; r27
.word 0xDEADBABE ; r28
.word 0xDEADBABE ; r29
.word 0xDEADBABE ; r30
.word 0xDEADBABE ; r31
; final sp is here
.word 0xDEADBABE ; garbage
.endmacro
; hacked from arm7 ram offset (unsafe, game stack pointer)
.create "haxchi_rop_hook.bin", HAX_TARGET_ADDRESS
.arm.big
rop_hook_start:
;call_func BCTRL, 0x0, 0x0, 0x0, 0x0 ; infinite loop
;call_func OSFATAL, 0x1007E7A8, 0, 0, 0
; move stack pointer to safe area
set_sp (rop_start - 4)
.Close
; original game arm9 ram offset (safe, normally arm9 code)
.create "haxchi_rop.bin", ARM9_ROM_LOCATION
.arm.big
rop_start:
; do hachihachi cleanups so we can use everything safely
call_func HACHI_APPLICATION_SHUTDOWNANDDESTROY, HACHI_APPLICATION_PTR, 0, 0, 0
call_func NERD_FASTWIIU_SHUTDOWN, 0, 0, 0, 0
call_func CORE_SHUTDOWN, 0, 0, 0, 0
; set up hbl_loader in core 0
call_func_6args NERD_CREATETHREAD, NERD_THREAD0OBJECT, LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR, 0x1007E7A8, thread0_param, 0x0, 0x0
; the code below prepares the stack for the thread in core 0
; load memcpy jump into r3
.word LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR
.word MEMCPY ; r3
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
; more r3 into r12 for our memcpy jump at the end of this
.word MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
; prepare r31 to be a valid value for the next call
.word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEADBABE ; r30
.word (core0rop_end - core0rop) ; r31 (has to be the same as r5 in the next call)
.word 0xDEAD0001 ; garbage
; get r5 ready for the length we want to copy
.word LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR
.word (core0rop_end - core0rop) ; r5
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; r30
.word 0xDEAD0001 ; r31
.word 0xDEAD0001 ; garbage
; get r4 ready for the data we want to copy
.word LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR
.word 0xDEAD0001 ; garbage
.word core0rop ; r4
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
; prepare r31 to be a valid value for the next call
.word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEADBABE ; r30
.word (HAX_TARGET_ADDRESS-0x3000) ; r31 (has to be valid here)
.word 0xDEAD0001 ; garbage
; loads the required value for the addition onto r3 later on
.word LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word (0x00800000 - 0x30 + 0xAFC) ; r7
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; r30
.word 0xDEAD0001 ; r31
.word 0xDEAD0001 ; garbage
; loads pointer to new thread sp into r3
.word LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR
.word (NERD_THREAD0OBJECT+4) ; r3
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
; r3 contains new thread sp end after this load
.word LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR
.word 0xDEAD0001 ; garbage
; r3 contains code injection thread sp after this add
.word LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; r30
.word 0xDEAD0001 ; r31
.word 0xDEAD0001 ; garbage
; jump to previously prepared r12 for memcpy
.word MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; r31
.word 0xDEAD0001 ; garbage
; thread stack is prepared after this point
; wait for hbl_loader to do its job
call_func NERD_STARTTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0
call_func NERD_JOINTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0
; prepare system for foreground release
call_func OSSAVESDONE_READYTORELEASE, 0, 0, 0, 0
; instruct all 3 cores to release foreground to prepare mii studio app launch
call_func_6args NERD_CREATETHREAD, NERD_THREAD0OBJECT, OSRELEASEFOREGROUND, 0, thread0_param, 0x0, 0x0
call_func NERD_STARTTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0
call_func_6args NERD_CREATETHREAD, NERD_THREAD2OBJECT, OSRELEASEFOREGROUND, 0, thread2_param, 0x0, 0x0
call_func NERD_STARTTHREAD, NERD_THREAD2OBJECT, 0x0, 0x0, 0x0
; we are the main thread in core 1 so we call this direct
call_func OSRELEASEFOREGROUND, 0, 0, 0, 0
; launch mii studio app
.word _START_EXIT
core0rop:
; switch codegen to RW
call_func OSCODEGEN_SWITCHSECMODE, 0x0, 0x0, 0x0, 0x0
; memcpy code
call_func MEMCPY, HBL_LOADER_ADR, hbl_loader, hbl_loader_end - hbl_loader, 0x0
call_func MEMCPY, SELECTOR_ADDRESS, code, code_end - code, 0x0
call_func MEMCPY, CFW_BOOTER_ADR, cfw_booter, cfw_booter_end - cfw_booter, 0x0
call_func DC_FLUSHRANGE, HBL_LOADER_ADR, 0xE000, 0x0, 0x0
; switch codegen to RX
call_func OSCODEGEN_SWITCHSECMODE, 0x1, 0x0, 0x0, 0x0
call_func IC_INVALIDATERANGE, HBL_LOADER_ADR, 0xE000, 0x0, 0x0
; execute hbl_loader in codegen
.word SELECTOR_ADDRESS
core0rop_end:
; core 0 thread params
output0_string:
.ascii "hax0thread"
.byte 0x00
.align 0x4
thread0_param:
.word output0_string
.word 0x00800000 ; stack size
.word 0x00000010 ; thread prio
.halfword 0x0001 ; thread affinity (core0)
; core 2 thread params
output2_string:
.ascii "hax2thread"
.byte 0x00
.align 0x4
thread2_param:
.word output2_string
.word 0x00800000 ; stack size
.word 0x00000010 ; thread prio
.halfword 0x0004 ; thread affinity (core2)
code:
.incbin "code550.bin"
code_end:
hbl_loader:
.incbin "hbl_loader.bin"
hbl_loader_end:
cfw_booter:
.incbin "cfw_booter.bin"
cfw_booter_end:
.Close
.include "coreinit.s"
.include "defines.s"
; more useful definitions
HBL_LOADER_ADR equ (0x01800000)
SELECTOR_ADDRESS equ (0x01808000)
CFW_BOOTER_ADR equ (0x0180C000)
NERD_THREAD0OBJECT equ (HAX_TARGET_ADDRESS - 0x1000)
NERD_THREAD2OBJECT equ (HAX_TARGET_ADDRESS - 0x2000)
.macro set_sp,v
.word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEADBABE ; r30
.word v ; r31
.word 0xDEAD0001 ; garbage
.word MR_R11R31_LMW_R26R1x8_LWZ_R0x24_MTLR_R0_ADDI_R1x20_CLRLWI_R3R11x18_BLR
.word 0xDEADBABE ; r26
.word 0xDEADBABE ; r27
.word 0xDEADBABE ; r28
.word 0xDEADBABE ; r29
.word 0xDEADBABE ; r30
.word 0xDEADBABE ; r31
.word 0xDEAD0001 ; garbage
.word LWZ_R0R11x4_R31R11xM4_MTLR_R0_MR_R1R11_BLR
.endmacro
.macro call_func,f,arg1,arg2,arg3,arg4
.word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEADBABE ; r21
.word 0xDEADBABE ; r22
.word 0xDEADBABE ; r23
.word 0xDEADBABE ; r24
.word 0xDEADBABE ; r25
.word 0xDEADBABE ; r26
.word f ; r27 (ctr)
.word arg4 ; r28 (r6)
.word arg3 ; r29 (r5)
.word arg2 ; r30 (r4)
.word arg1 - 2 ; r31 (r3 - 2)
; sp is here when LMW_R26R1x18 happens
.word 0xDEAD0004 ; garbage
.word MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR
.word 0xDEAD0008 ; garbage
.word 0xDEAD000C ; garbage
.word 0xDEAD0010 ; garbage
.word 0xDEAD0014 ; garbage
.word 0xDEADBABE ; r26
.word 0xDEADBABE ; r27
.word 0xDEADBABE ; r28
.word 0xDEADBABE ; r29
.word 0xDEADBABE ; r30
.word 0xDEADBABE ; r31
; final sp is here
.word 0xDEADBABE ; garbage
.endmacro
.macro call_func_6args,f,arg1,arg2,arg3,arg4,arg5,arg6
.word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR
.word 0xDEAD0001 ; garbage
.word arg6 ; r21 (r8)
.word 0xDEADBABE ; r22
.word 0xDEADBABE ; r23
.word arg1 ; r24 (r3)
.word arg2 ; r25 (r4)
.word 0xDEADBABE ; r26
.word arg3 ; r27 (r5)
.word arg4 ; r28 (r6)
.word arg5 ; r29 (r7)
.word LMW_R21R1xC_LWZ_R0R1x3C_MTLR_R0_ADDI_R1_x38_BLR ; r30 (ctr)
.word 0xDEADBABE ; r31
; sp is here when LMW_R26R1x18 happens
.word 0xDEAD0004 ; garbage
.word MTCTR_R30_MR_R8R21_R7R29_R6R28_R5R27_R4R25_R3R24_BCTRL
.word 0xDEAD0001 ; garbage
.word 0xDEADBABE ; r21
.word 0xDEADBABE ; r22
.word 0xDEADBABE ; r23
.word 0xDEADBABE ; r24
.word 0xDEADBABE ; r25
.word 0xDEADBABE ; r26
.word f ; r27 (ctr)
.word arg4 ; r28 (r6)
.word arg3 ; r29 (r5)
.word arg2 ; r30 (r4)
.word arg1 - 2 ; r31 (r3 - 2)
; sp is here when LMW_R26R1x18 happens
.word 0xDEAD0004 ; garbage
.word MTCTR_R27_ADDI_R31x2_MR_R3R31_R4R30_R5R29_R6R28_BCTRL_LMW_R26R1x18_MTLR_R1x34_ADDI_R1x30_BLR
.word 0xDEAD0008 ; garbage
.word 0xDEAD000C ; garbage
.word 0xDEAD0010 ; garbage
.word 0xDEAD0014 ; garbage
.word 0xDEADBABE ; r26
.word 0xDEADBABE ; r27
.word 0xDEADBABE ; r28
.word 0xDEADBABE ; r29
.word 0xDEADBABE ; r30
.word 0xDEADBABE ; r31
; final sp is here
.word 0xDEADBABE ; garbage
.endmacro
; hacked from arm7 ram offset (unsafe, game stack pointer)
.create "haxchi_rop_hook.bin", HAX_TARGET_ADDRESS
.arm.big
rop_hook_start:
;call_func BCTRL, 0x0, 0x0, 0x0, 0x0 ; infinite loop
;call_func OSFATAL, 0x1007E7A8, 0, 0, 0
; move stack pointer to safe area
set_sp (rop_start - 4)
.Close
; original game arm9 ram offset (safe, normally arm9 code)
.create "haxchi_rop.bin", ARM9_ROM_LOCATION
.arm.big
rop_start:
; do hachihachi cleanups so we can use everything safely
call_func HACHI_APPLICATION_SHUTDOWNANDDESTROY, HACHI_APPLICATION_PTR, 0, 0, 0
call_func NERD_FASTWIIU_SHUTDOWN, 0, 0, 0, 0
call_func CORE_SHUTDOWN, 0, 0, 0, 0
; set up hbl_loader in core 0
call_func_6args NERD_CREATETHREAD, NERD_THREAD0OBJECT, LWZ_R0xAFC_MTLR_R0_ADDI_R1xAF8_BLR, 0x1007E7A8, thread0_param, 0x0, 0x0
; the code below prepares the stack for the thread in core 0
; load memcpy jump into r3
.word LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR
.word MEMCPY ; r3
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
; more r3 into r12 for our memcpy jump at the end of this
.word MR_R12_R3_CMPLW_R12_R0_LI_R3_0_BEQ_ADDI_R3_R12x10_LWZ_R0_R1x14_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
; prepare r31 to be a valid value for the next call
.word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEADBABE ; r30
.word (core0rop_end - core0rop) ; r31 (has to be the same as r5 in the next call)
.word 0xDEAD0001 ; garbage
; get r5 ready for the length we want to copy
.word LWZ_R5_R1x8_CMPLW_R5_R31_BNE_MR_R3_R5_LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_BLR
.word (core0rop_end - core0rop) ; r5
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; r30
.word 0xDEAD0001 ; r31
.word 0xDEAD0001 ; garbage
; get r4 ready for the data we want to copy
.word LWZ_R4_R1xC_STW_R12_R1x8_LWZ_R3_R1x8_LWZ_R0_R1x1C_MTLR_R0_ADDI_R1x18_BLR
.word 0xDEAD0001 ; garbage
.word core0rop ; r4
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
; prepare r31 to be a valid value for the next call
.word LWZ_R0R1x14_LWZ_R30R1x8_R31R1xC_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEADBABE ; r30
.word (HAX_TARGET_ADDRESS-0x3000) ; r31 (has to be valid here)
.word 0xDEAD0001 ; garbage
; loads the required value for the addition onto r3 later on
.word LWZ_R7_R1x10_LWZ_R8_R1x14_STW_R7_R31x0_STW_R8_R31x0_LWZ_R0_R1x2C_LWZ_R31_R0x24_MTLR_R0_LWZ_R30_R0x20_ADDI_R1x28_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word (0x00800000 - 0x30 + 0xAFC) ; r7
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; r30
.word 0xDEAD0001 ; r31
.word 0xDEAD0001 ; garbage
; loads pointer to new thread sp into r3
.word LWZ_R3_8_R1_LWZ_R0x14_MTLR_R0_ADDI_R1x10_BLR
.word (NERD_THREAD0OBJECT+4) ; r3
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
; r3 contains new thread sp end after this load
.word LWZ_R3_4_R3_LWZ_R0xC_MTLR_R0_ADDI_R1x8_BLR
.word 0xDEAD0001 ; garbage
; r3 contains code injection thread sp after this add
.word LWZ_R0_R1x1C_LWZ_R30_R1x10_MTLR_R0_LWZ_R31_R1x14_ADDI_R1x18_ADD_R3_R7_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; r30
.word 0xDEAD0001 ; r31
.word 0xDEAD0001 ; garbage
; jump to previously prepared r12 for memcpy
.word MTCTR_R12_BCTRL_LI_R3_0_LWZ_R0_R1x14_LWZ_R31_R1xC_MTLR_R0_ADDI_R1x10_BLR
.word 0xDEAD0001 ; garbage
.word 0xDEAD0001 ; r31
.word 0xDEAD0001 ; garbage
; thread stack is prepared after this point
; wait for hbl_loader to do its job
call_func NERD_STARTTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0
call_func NERD_JOINTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0
; prepare system for foreground release
call_func OSSAVESDONE_READYTORELEASE, 0, 0, 0, 0
; instruct all 3 cores to release foreground to prepare mii studio app launch
call_func_6args NERD_CREATETHREAD, NERD_THREAD0OBJECT, OSRELEASEFOREGROUND, 0, thread0_param, 0x0, 0x0
call_func NERD_STARTTHREAD, NERD_THREAD0OBJECT, 0x0, 0x0, 0x0
call_func_6args NERD_CREATETHREAD, NERD_THREAD2OBJECT, OSRELEASEFOREGROUND, 0, thread2_param, 0x0, 0x0
call_func NERD_STARTTHREAD, NERD_THREAD2OBJECT, 0x0, 0x0, 0x0
; we are the main thread in core 1 so we call this direct
call_func OSRELEASEFOREGROUND, 0, 0, 0, 0
; launch mii studio app
.word _START_EXIT
core0rop:
; switch codegen to RW
call_func OSCODEGEN_SWITCHSECMODE, 0x0, 0x0, 0x0, 0x0
; memcpy code
call_func MEMCPY, HBL_LOADER_ADR, hbl_loader, hbl_loader_end - hbl_loader, 0x0
call_func MEMCPY, SELECTOR_ADDRESS, code, code_end - code, 0x0
call_func MEMCPY, CFW_BOOTER_ADR, cfw_booter, cfw_booter_end - cfw_booter, 0x0
call_func DC_FLUSHRANGE, HBL_LOADER_ADR, 0xE000, 0x0, 0x0
; switch codegen to RX
call_func OSCODEGEN_SWITCHSECMODE, 0x1, 0x0, 0x0, 0x0
call_func IC_INVALIDATERANGE, HBL_LOADER_ADR, 0xE000, 0x0, 0x0
; execute hbl_loader in codegen
.word SELECTOR_ADDRESS
core0rop_end:
; core 0 thread params
output0_string:
.ascii "hax0thread"
.byte 0x00
.align 0x4
thread0_param:
.word output0_string
.word 0x00800000 ; stack size
.word 0x00000010 ; thread prio
.halfword 0x0001 ; thread affinity (core0)
; core 2 thread params
output2_string:
.ascii "hax2thread"
.byte 0x00
.align 0x4
thread2_param:
.word output2_string
.word 0x00800000 ; stack size
.word 0x00000010 ; thread prio
.halfword 0x0004 ; thread affinity (core2)
code:
.incbin "code550.bin"
code_end:
hbl_loader:
.incbin "hbl_loader.bin"
hbl_loader_end:
cfw_booter:
.incbin "cfw_booter.bin"
cfw_booter_end:
.Close

235
installer/Makefile Normal file
View File

@ -0,0 +1,235 @@
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPRO")
endif
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
export LIBOGC_INC := $(DEVKITPRO)/libogc/include
export LIBOGC_LIB := $(DEVKITPRO)/libogc/lib/wii
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
PREFIX := powerpc-eabi-
export AS := $(PREFIX)as
export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET := haxchi
BUILD := build
BUILD_DBG := $(TARGET)_dbg
SOURCES := src \
src/dynamic_libs \
src/fs \
src/system \
src/utils
DATA := data
INCLUDES := src payload
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS := -std=gnu11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
CXXFLAGS := -std=gnu++11 -mrvl -mcpu=750 -meabi -mhard-float -ffast-math \
-O3 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing $(INCLUDE)
ASFLAGS := -mregnames
LDFLAGS := -nostartfiles -Wl,-Map,$(notdir $@).map,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,_malloc_r,-wrap,_free_r,-wrap,_realloc_r,-wrap,_calloc_r,-wrap,_memalign_r,-wrap,_malloc_usable_size_r,-wrap,valloc,-wrap,_valloc_r,-wrap,_pvalloc_r,--gc-sections
#---------------------------------------------------------------------------------
Q := @
MAKEFLAGS += --no-print-directory
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -liosuhax -lxml2 -lm
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR) \
$(DEVKITPPC)/lib
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export PROJECTDIR := $(CURDIR)
export OUTPUT := $(CURDIR)/$(TARGETDIR)/$(TARGET)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
export LD := $(CC)
else
export LD := $(CXX)
endif
export OFILES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \
$(sFILES:.s=.o) $(SFILES:.S=.o) \
$(PNGFILES:.png=.png.o) $(addsuffix .o,$(BINFILES))
#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD) -I$(LIBOGC_INC) \
-I$(PORTLIBS)/include -I$(PORTLIBS)/include/freetype2 -I$(CURDIR)/libxml2/include
#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
-L$(LIBOGC_LIB) -L$(PORTLIBS)/lib -L$(CURDIR)/libxml2/lib
export OUTPUT := $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean install
#---------------------------------------------------------------------------------
$(BUILD): $(CURDIR)/payload/arm_kernel_bin.h
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
$(CURDIR)/payload/arm_kernel_bin.h: $(CURDIR)/payload/wupserver_bin.h $(CURDIR)/payload/arm_user_bin.h
@$(MAKE) --no-print-directory -C $(CURDIR)/arm_kernel -f $(CURDIR)/arm_kernel/Makefile
@-mkdir -p $(CURDIR)/payload
@cp -p $(CURDIR)/arm_kernel/arm_kernel_bin.h $@
$(CURDIR)/payload/wupserver_bin.h:
@$(MAKE) --no-print-directory -C $(CURDIR)/wupserver -f $(CURDIR)/wupserver/Makefile
@-mkdir -p $(CURDIR)/payload
@cp -p $(CURDIR)/wupserver/wupserver_bin.h $@
$(CURDIR)/payload/arm_user_bin.h:
@$(MAKE) --no-print-directory -C $(CURDIR)/arm_user -f $(CURDIR)/arm_user/Makefile
@-mkdir -p $(CURDIR)/payload
@cp -p $(CURDIR)/arm_user/arm_user_bin.h $@
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).bin $(BUILD_DBG).elf $(CURDIR)/payload
@$(MAKE) --no-print-directory -C $(CURDIR)/arm_user -f $(CURDIR)/arm_user/Makefile clean
@$(MAKE) --no-print-directory -C $(CURDIR)/wupserver -f $(CURDIR)/wupserver/Makefile clean
@$(MAKE) --no-print-directory -C $(CURDIR)/arm_kernel -f $(CURDIR)/arm_kernel/Makefile clean
#---------------------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .jpg extension
#---------------------------------------------------------------------------------
%.elf: link.ld $(OFILES)
@echo "linking ... $(TARGET).elf"
$(Q)$(LD) -n -T $^ $(LDFLAGS) -o ../$(BUILD_DBG).elf $(LIBPATHS) $(LIBS)
$(Q)$(OBJCOPY) -S -R .comment -R .gnu.attributes ../$(BUILD_DBG).elf $@
../data/loader.bin:
$(MAKE) -C ../loader clean
$(MAKE) -C ../loader
#---------------------------------------------------------------------------------
%.a:
#---------------------------------------------------------------------------------
@echo $(notdir $@)
@rm -f $@
@$(AR) -rc $@ $^
#---------------------------------------------------------------------------------
%.o: %.cpp
@echo $(notdir $<)
@$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.c
@echo $(notdir $<)
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.o: %.S
@echo $(notdir $<)
@$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d -x assembler-with-cpp $(ASFLAGS) -c $< -o $@ $(ERROR_FILTER)
#---------------------------------------------------------------------------------
%.png.o : %.png
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.jpg.o : %.jpg
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.ttf.o : %.ttf
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.bin.o : %.bin
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.wav.o : %.wav
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.mp3.o : %.mp3
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.ogg.o : %.ogg
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
#---------------------------------------------------------------------------------
%.zip.o : %.zip
@echo $(notdir $<)
@bin2s -a 32 $< | $(AS) -o $(@)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------

View File

@ -0,0 +1,72 @@
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),)
export PATH:=$(DEVKITARM)/bin:$(PATH)
endif
CC = arm-none-eabi-gcc
# LINK = arm-none-eabi-gcc
LINK = arm-none-eabi-ld
AS = arm-none-eabi-as
OBJCOPY = arm-none-eabi-objcopy
CFLAGS += -Wall -mbig-endian -std=gnu99 -march=armv5 -Os -I$(DEVKITPRO)/libnds/include
LDFLAGS += --script=link.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib"
CFILES = $(wildcard source/*.c)
BINFILES = $(wildcard data/*.bin)
OFILES = $(BINFILES:data/%.bin=build/%.bin.o)
OFILES += $(CFILES:source/%.c=build/%.o)
DFILES = $(CFILES:source/%.c=build/%.d)
SFILES = $(wildcard source/*.s)
OFILES += $(SFILES:source/%.s=build/%.o)
PROJECTNAME = ${shell basename "$(CURDIR)"}
CWD = "$(CURDIR)""
#---------------------------------------------------------------------------------
# canned command sequence for binary data, taken from devkitARM
#---------------------------------------------------------------------------------
define bin2o
bin2s $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > source/`(echo $(<F) | tr . _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> source/`(echo $(<F) | tr . _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> source/`(echo $(<F) | tr . _)`.h
endef
.PHONY:=all dirs
all: dirs $(PROJECTNAME).bin $(PROJECTNAME)_bin.h
dirs:
@mkdir -p build
$(PROJECTNAME).bin: $(PROJECTNAME).elf
# $(OBJCOPY) -O binary $< $@
$(OBJCOPY) -j .text -j .rodata -O binary $< $@
$(PROJECTNAME)_bin.h: $(PROJECTNAME).bin
xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@
$(PROJECTNAME).elf: $(OFILES)
$(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES))
clean:
@rm -f build/*.o build/*.d
@rmdir build 2>/nul; true
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h
@echo "all cleaned up !"
-include $(DFILES)
build/%.o: source/%.c
$(CC) $(CFLAGS) -c $< -o $@
@$(CC) -MM $< > build/$*.d
build/%.o: source/%.s
$(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@
@$(CC) -MM $< > build/$*.d
build/%.bin.o: data/%.bin
@echo $(notdir $<)
@$(bin2o)

View File

@ -0,0 +1,18 @@
OUTPUT_ARCH(arm)
MEMORY
{
RAMX (rx) : ORIGIN = 0x08134100, LENGTH = 0x000BF00
}
SECTIONS
{
.text : ALIGN(0x100) {
build/crt0.o(.init)
*(.text)
}
.rodata : {
*(.rodata*)
}
}

View File

@ -0,0 +1,12 @@
.section ".init"
.arm
.align 4
.extern _main
.type _main, %function
.extern memset
.type memset, %function
_start:
b _main

View File

@ -0,0 +1,130 @@
#include "types.h"
#include "utils.h"
#include "../../payload/arm_user_bin.h"
#include "../../payload/wupserver_bin.h"
static const char repairData_set_fault_behavior[] = {
0xE1,0x2F,0xFF,0x1E,0xE9,0x2D,0x40,0x30,0xE5,0x93,0x20,0x00,0xE1,0xA0,0x40,0x00,
0xE5,0x92,0x30,0x54,0xE1,0xA0,0x50,0x01,0xE3,0x53,0x00,0x01,0x0A,0x00,0x00,0x02,
0xE1,0x53,0x00,0x00,0xE3,0xE0,0x00,0x00,0x18,0xBD,0x80,0x30,0xE3,0x54,0x00,0x0D,
};
static const char repairData_set_panic_behavior[] = {
0x08,0x16,0x6C,0x00,0x00,0x00,0x18,0x0C,0x08,0x14,0x40,0x00,0x00,0x00,0x9D,0x70,
0x08,0x16,0x84,0x0C,0x00,0x00,0xB4,0x0C,0x00,0x00,0x01,0x01,0x08,0x14,0x40,0x00,
0x08,0x15,0x00,0x00,0x08,0x17,0x21,0x80,0x08,0x17,0x38,0x00,0x08,0x14,0x30,0xD4,
0x08,0x14,0x12,0x50,0x08,0x14,0x12,0x94,0xE3,0xA0,0x35,0x36,0xE5,0x93,0x21,0x94,
0xE3,0xC2,0x2E,0x21,0xE5,0x83,0x21,0x94,0xE5,0x93,0x11,0x94,0xE1,0x2F,0xFF,0x1E,
0xE5,0x9F,0x30,0x1C,0xE5,0x9F,0xC0,0x1C,0xE5,0x93,0x20,0x00,0xE1,0xA0,0x10,0x00,
0xE5,0x92,0x30,0x54,0xE5,0x9C,0x00,0x00,
};
static const char repairData_usb_root_thread[] = {
0xE5,0x8D,0xE0,0x04,0xE5,0x8D,0xC0,0x08,0xE5,0x8D,0x40,0x0C,0xE5,0x8D,0x60,0x10,
0xEB,0x00,0xB2,0xFD,0xEA,0xFF,0xFF,0xC9,0x10,0x14,0x03,0xF8,0x10,0x62,0x4D,0xD3,
0x10,0x14,0x50,0x00,0x10,0x14,0x50,0x20,0x10,0x14,0x00,0x00,0x10,0x14,0x00,0x90,
0x10,0x14,0x00,0x70,0x10,0x14,0x00,0x98,0x10,0x14,0x00,0x84,0x10,0x14,0x03,0xE8,
0x10,0x14,0x00,0x3C,0x00,0x00,0x01,0x73,0x00,0x00,0x01,0x76,0xE9,0x2D,0x4F,0xF0,
0xE2,0x4D,0xDE,0x17,0xEB,0x00,0xB9,0x92,0xE3,0xA0,0x10,0x00,0xE3,0xA0,0x20,0x03,
0xE5,0x9F,0x0E,0x68,0xEB,0x00,0xB3,0x20,
};
/* from smealum's iosuhax: must be placed at 0x05059938 */
static const char os_launch_hook[] = {
0x47, 0x78, 0x00, 0x00, 0xe9, 0x2d, 0x40, 0x0f, 0xe2, 0x4d, 0xd0, 0x08, 0xeb,
0xff, 0xfd, 0xfd, 0xe3, 0xa0, 0x00, 0x00, 0xeb, 0xff, 0xfe, 0x03, 0xe5, 0x9f,
0x10, 0x4c, 0xe5, 0x9f, 0x20, 0x4c, 0xe3, 0xa0, 0x30, 0x00, 0xe5, 0x8d, 0x30,
0x00, 0xe5, 0x8d, 0x30, 0x04, 0xeb, 0xff, 0xfe, 0xf1, 0xe2, 0x8d, 0xd0, 0x08,
0xe8, 0xbd, 0x80, 0x0f, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x64, 0x63, 0x61,
0x72, 0x64, 0x30, 0x31, 0x00, 0x2f, 0x76, 0x6f, 0x6c, 0x2f, 0x73, 0x64, 0x63,
0x61, 0x72, 0x64, 0x00, 0x00, 0x00, 0x2f, 0x76, 0x6f, 0x6c, 0x2f, 0x73, 0x64,
0x63, 0x61, 0x72, 0x64, 0x00, 0x05, 0x11, 0x60, 0x00, 0x05, 0x0b, 0xe0, 0x00,
0x05, 0x0b, 0xcf, 0xfc, 0x05, 0x05, 0x99, 0x70, 0x05, 0x05, 0x99, 0x7e,
};
//static const char sd_path[] = "/vol/sdcard";
static unsigned int __attribute__((noinline)) disable_mmu(void)
{
unsigned int control_register = 0;
asm volatile("MRC p15, 0, %0, c1, c0, 0" : "=r" (control_register));
asm volatile("MCR p15, 0, %0, c1, c0, 0" : : "r" (control_register & 0xFFFFEFFA));
return control_register;
}
static void __attribute__((noinline)) restore_mmu(unsigned int control_register)
{
asm volatile("MCR p15, 0, %0, c1, c0, 0" : : "r" (control_register));
}
int _main()
{
int(*disable_interrupts)() = (int(*)())0x0812E778;
int(*enable_interrupts)(int) = (int(*)(int))0x0812E78C;
void(*invalidate_icache)() = (void(*)())0x0812DCF0;
void(*invalidate_dcache)(unsigned int, unsigned int) = (void(*)())0x08120164;
void(*flush_dcache)(unsigned int, unsigned int) = (void(*)())0x08120160;
char* (*kernel_memcpy)(void*, void*, int) = (char*(*)(void*, void*, int))0x08131D04;
flush_dcache(0x081200F0, 0x4001); // giving a size >= 0x4000 flushes all cache
int level = disable_interrupts();
unsigned int control_register = disable_mmu();
/* Save the request handle so we can reply later */
*(volatile u32*)0x01E10000 = *(volatile u32*)0x1016AD18;
/* Patch kernel_error_handler to BX LR immediately */
*(int*)0x08129A24 = 0xE12FFF1E;
void * pset_fault_behavior = (void*)0x081298BC;
kernel_memcpy(pset_fault_behavior, (void*)repairData_set_fault_behavior, sizeof(repairData_set_fault_behavior));
void * pset_panic_behavior = (void*)0x081296E4;
kernel_memcpy(pset_panic_behavior, (void*)repairData_set_panic_behavior, sizeof(repairData_set_panic_behavior));
void * pusb_root_thread = (void*)0x10100174;
kernel_memcpy(pusb_root_thread, (void*)repairData_usb_root_thread, sizeof(repairData_usb_root_thread));
void * pUserBinSource = (void*)0x01E50000;
void * pUserBinDest = (void*)0x101312D0;
kernel_memcpy(pUserBinDest, (void*)pUserBinSource, sizeof(arm_user_bin));
void * test = (void*)(0x05100000 - 0x05100000 + 0x13D80000);
kernel_memcpy(test, (void*)wupserver_bin, sizeof(wupserver_bin));
invalidate_dcache((u32)test, sizeof(wupserver_bin));
invalidate_icache();
// replace ioctl 0x62 code with jump to wupserver
*(unsigned int*)(0x05026BA8 - 0x05000000 + 0x081C0000) = 0x47780000; // bx pc
*(unsigned int*)(0x05026BAC - 0x05000000 + 0x081C0000) = 0xE59F1000; // ldr r1, [pc]
*(unsigned int*)(0x05026BB0 - 0x05000000 + 0x081C0000) = 0xE12FFF11; // bx r1
*(unsigned int*)(0x05026BB4 - 0x05000000 + 0x081C0000) = 0x05100000; // wupserver code
*(unsigned int*)(0x050282AE - 0x05000000 + 0x081C0000) = 0xF031FB43; // bl launch_os_hook
*(unsigned int*)(0x05052C44 - 0x05000000 + 0x081C0000) = 0xE3A00000; // mov r0, #0
*(unsigned int*)(0x05052C48 - 0x05000000 + 0x081C0000) = 0xE12FFF1E; // bx lr
*(unsigned int*)(0x0500A818 - 0x05000000 + 0x081C0000) = 0x20002000; // mov r0, #0; mov r0, #0
*(unsigned int*)(0x040017E0 - 0x04000000 + 0x08280000) = 0xE3A00000; // mov r0, #0
*(unsigned int*)(0x040019C4 - 0x04000000 + 0x08280000) = 0xE3A00000; // mov r0, #0
*(unsigned int*)(0x04001BB0 - 0x04000000 + 0x08280000) = 0xE3A00000; // mov r0, #0
*(unsigned int*)(0x04001D40 - 0x04000000 + 0x08280000) = 0xE3A00000; // mov r0, #0
int i;
for (i = 0; i < sizeof(os_launch_hook); i++)
((char*)(0x05059938 - 0x05000000 + 0x081C0000))[i] = os_launch_hook[i];
*(int*)(0x1555500) = 0;
/* REENABLE MMU */
restore_mmu(control_register);
invalidate_dcache(0x081298BC, 0x4001); // giving a size >= 0x4000 invalidates all cache
invalidate_icache();
enable_interrupts(level);
return 0;
}

View File

@ -0,0 +1,16 @@
#ifndef _TYPES_H
#define _TYPES_H
#include <stdint.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
#endif

View File

@ -0,0 +1,25 @@
void* m_memcpy(void *dst, const void *src, unsigned int len)
{
const unsigned char *src_ptr = (const unsigned char *)src;
unsigned char *dst_ptr = (unsigned char *)dst;
while(len)
{
*dst_ptr++ = *src_ptr++;
--len;
}
return dst;
}
void* m_memset(void *dst, int val, unsigned int bytes)
{
unsigned char *dst_ptr = (unsigned char *)dst;
unsigned int i = 0;
while(i < bytes)
{
dst_ptr[i] = val;
++i;
}
return dst;
}

View File

@ -0,0 +1,7 @@
#ifndef _UTILS_H_
#define _UTILS_H_
void* m_memcpy(void *dst, const void *src, unsigned int len);
void* m_memset(void *dst, int val, unsigned int len);
#endif

View File

@ -0,0 +1,72 @@
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
ifeq ($(filter $(DEVKITARM)/bin,$(PATH)),)
export PATH:=$(DEVKITARM)/bin:$(PATH)
endif
CC = arm-none-eabi-gcc
# LINK = arm-none-eabi-gcc
LINK = arm-none-eabi-ld
AS = arm-none-eabi-as
OBJCOPY = arm-none-eabi-objcopy
CFLAGS += -Wall -mbig-endian -std=gnu99 -march=armv5 -Os -I$(DEVKITPRO)/libnds/include
LDFLAGS += --script=link.ld -EB -L"$(DEVKITARM)/arm-none-eabi/lib"
CFILES = $(wildcard source/*.c)
BINFILES = $(wildcard data/*.bin)
OFILES = $(BINFILES:data/%.bin=build/%.bin.o)
OFILES += $(CFILES:source/%.c=build/%.o)
DFILES = $(CFILES:source/%.c=build/%.d)
SFILES = $(wildcard source/*.s)
OFILES += $(SFILES:source/%.s=build/%.o)
PROJECTNAME = ${shell basename "$(CURDIR)"}
CWD = "$(CURDIR)""
#---------------------------------------------------------------------------------
# canned command sequence for binary data, taken from devkitARM
#---------------------------------------------------------------------------------
define bin2o
bin2s $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > source/`(echo $(<F) | tr . _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> source/`(echo $(<F) | tr . _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> source/`(echo $(<F) | tr . _)`.h
endef
.PHONY:=all dirs
all: dirs $(PROJECTNAME).bin $(PROJECTNAME)_bin.h
dirs:
@mkdir -p build
$(PROJECTNAME).bin: $(PROJECTNAME).elf
# $(OBJCOPY) -O binary $< $@
$(OBJCOPY) -j .text -j .rodata -O binary $< $@
$(PROJECTNAME)_bin.h: $(PROJECTNAME).bin
xxd -i $< | sed "s/unsigned/static const unsigned/g;s/$(PROJECTNAME)$*/$(PROJECTNAME)/g" > $@
$(PROJECTNAME).elf: $(OFILES)
$(LINK) $(LDFLAGS) -o $(PROJECTNAME).elf $(filter-out build/crt0.o, $(OFILES))
clean:
@rm -f build/*.o build/*.d
@rmdir build 2>/nul; true
@rm -f $(PROJECTNAME).elf $(PROJECTNAME).bin $(PROJECTNAME)_bin.h
@echo "all cleaned up !"
-include $(DFILES)
build/%.o: source/%.c
$(CC) $(CFLAGS) -c $< -o $@
@$(CC) -MM $< > build/$*.d
build/%.o: source/%.s
$(CC) $(CFLAGS) -xassembler-with-cpp -c $< -o $@
@$(CC) -MM $< > build/$*.d
build/%.bin.o: data/%.bin
@echo $(notdir $<)
@$(bin2o)

View File

@ -0,0 +1,18 @@
OUTPUT_ARCH(arm)
MEMORY
{
RAMX (rx) : ORIGIN = 0x101312D0, LENGTH = 0x000BF00
}
SECTIONS
{
.text : ALIGN(0x04) {
build/crt0.o(.init)
*(.text)
}
.rodata : {
*(.rodata*)
}
}

View File

@ -0,0 +1,20 @@
.section ".init"
.arm
.align 4
.extern _main
.type _main, %function
.extern memset
.type memset, %function
_start:
b _main
.global IOS_DCFlushAllCache
IOS_DCFlushAllCache:
MOV R15, R0
clean_loop:
MRC p15, 0, r15, c7, c10, 3
BNE clean_loop
MCR p15, 0, R0, c7, c10, 4

View File

@ -0,0 +1,30 @@
#include "types.h"
#include "utils.h"
void _main()
{
void(*ios_shutdown)(int) = (void(*)(int))0x1012EE4C;
int(*reply)(int, int) = (int(*)(int, int))0x1012ED04;
int saved_handle = *(volatile u32*)0x01E10000;
int myret = reply(saved_handle, 0);
if (myret != 0)
ios_shutdown(1);
// stack pointer will be 0x1016AE30
// link register will be 0x1012EACC
asm("LDR SP, newsp\n"
"LDR R0, newr0\n"
"LDR LR, newlr\n"
"LDR PC, newpc\n"
"newsp: .word 0x1016AE30\n"
"newlr: .word 0x1012EACC\n"
"newr0: .word 0x10146080\n"
"newpc: .word 0x10111164\n");
}

View File

@ -0,0 +1,16 @@
#ifndef _TYPES_H
#define _TYPES_H
#include <stdint.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;
#endif

View File

@ -0,0 +1,25 @@
void* m_memcpy(void *dst, const void *src, unsigned int len)
{
const unsigned char *src_ptr = (const unsigned char *)src;
unsigned char *dst_ptr = (unsigned char *)dst;
while(len)
{
*dst_ptr++ = *src_ptr++;
--len;
}
return dst;
}
void* m_memset(void *dst, int val, unsigned int bytes)
{
unsigned char *dst_ptr = (unsigned char *)dst;
unsigned int i = 0;
while(i < bytes)
{
dst_ptr[i] = val;
++i;
}
return dst;
}

View File

@ -0,0 +1,7 @@
#ifndef _UTILS_H_
#define _UTILS_H_
void* m_memcpy(void *dst, const void *src, unsigned int len);
void* m_memset(void *dst, int val, unsigned int len);
#endif

View File

@ -0,0 +1,2 @@
Built from libxml2-2.9.4 with the following config:
./autogen.sh --disable-shared --enable-static --with-minimum=yes --with-output=yes --host=powerpc-eabi

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 (xmlChar *cur,
const char *encoding,
htmlSAXHandlerPtr sax,
void *userData);
XMLPUBFUN htmlDocPtr XMLCALL
htmlParseDoc (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,240 @@
/*
* 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
struct _uconv_t {
UConverter *uconv; /* for conversion between an encoding and UTF-16 */
UConverter *utf8; /* for conversion between UTF-8 and UTF-16 */
};
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,509 @@
/*
* 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/SAX.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,233 @@
/*
* 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, 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, 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, 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);
/*
* 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__ */

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