first commit - moved from local dev to git
This commit is contained in:
7
tools/sboot-03/change.log
Normal file
7
tools/sboot-03/change.log
Normal file
@@ -0,0 +1,7 @@
|
||||
ColdBoot Changelog
|
||||
|
||||
- Version 0.3
|
||||
|
||||
- Switch to medium resolution when low resolution is detected.
|
||||
- New script commands "rewrite"
|
||||
- Fixed file sort under plain TOS.
|
||||
BIN
tools/sboot-03/m68k/sboot.prg
Normal file
BIN
tools/sboot-03/m68k/sboot.prg
Normal file
Binary file not shown.
66
tools/sboot-03/multboot.txt
Normal file
66
tools/sboot-03/multboot.txt
Normal file
@@ -0,0 +1,66 @@
|
||||
|
||||
|
||||
Multi-GUI System HOW-TO
|
||||
|
||||
|
||||
In this text I will explain how to setup an multi-boot
|
||||
system with SBOOT. I assume you have already both types
|
||||
of AES installed: MyAES and XaAES.
|
||||
|
||||
We begin by creating 2 sets:
|
||||
|
||||
Press Shift + F2 and enter "mint-xaaes" (for XaAES)
|
||||
Press Shift + F3 and enter "mint-myaes" (for MyAES)
|
||||
|
||||
Now press F2 to load the xaaes set. Press "E" to edit the
|
||||
script for the set "XaAES". Now we will create an script
|
||||
which:
|
||||
|
||||
- Disables the MyAES configuration entry.
|
||||
- Enables the XaAES configuration entry.
|
||||
|
||||
The fact that XaAES mostly uses the INIT= statement
|
||||
to be loaded and MyAES set uses the GEM= statement makes
|
||||
the script a bit more easy to write. It's maybe a bit
|
||||
tricky to see why we rename the Variables GEM= and INIT= to
|
||||
_GEM_ and _INIT_ when we deactivate them: That's
|
||||
because otherwise the variable is rewritten each time the
|
||||
script is executed, that shall not happen...
|
||||
|
||||
|
||||
# === XaAES Startup Script ===
|
||||
|
||||
# disable MyAES (GEM= line):
|
||||
rewrite U:/c/mint/1-18-cur/mint.cnf GEM= #_GEM_=
|
||||
|
||||
# enable XaAES (INIT= line):
|
||||
rewrite U:/c/mint/1-18-cur/mint.cnf #_INIT_= INIT=
|
||||
|
||||
# === END OF SCRIPT ===
|
||||
|
||||
Press F2 to save the script.
|
||||
Now create the MyAES startup script. First load the MyAES
|
||||
set by pressing F3, then press E to edit the script.
|
||||
The script will:
|
||||
Enable the MyAES entry,
|
||||
then disable the XaAES entry.
|
||||
|
||||
# === MyAES Startup Script ===
|
||||
|
||||
# enable MyAES (GEM= line):
|
||||
rewrite U:/c/mint/1-18-cur/mint.cnf #_GEM_= GEM=
|
||||
|
||||
# disable XaAES (INIT= line):
|
||||
rewrite U:/c/mint/1-18-cur/mint.cnf INIT= #_INIT_=
|
||||
|
||||
# === END OF SCRIPT ===
|
||||
|
||||
Press F2 to save the script. Now make a choice,
|
||||
press F2 to load the XaAES set, or F3 to load the
|
||||
MyAES set. Press ESC or Q to continue the boot process.
|
||||
|
||||
That's it!
|
||||
|
||||
Regards,
|
||||
m0n0 - November 2012
|
||||
|
||||
139
tools/sboot-03/readme.txt
Normal file
139
tools/sboot-03/readme.txt
Normal file
@@ -0,0 +1,139 @@
|
||||
SBOOT 0.3
|
||||
|
||||
|
||||
|
||||
Startup Manager for the Firebee...
|
||||
... and other TOS compatibles.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Features:
|
||||
==========
|
||||
|
||||
|
||||
|
||||
- Configurable timeout & Folder settings for: PRG,CPX,ACC
|
||||
- Comfortable & fast console User interface.
|
||||
- Up to 10 different Sets which can be selected by F1-10 keys.
|
||||
- Change the startup order of your AUTO folder Programs.
|
||||
- Custom startup script for each Set (since version 0.2).
|
||||
Supported commands since version 0.2:
|
||||
copy, echo, pause, set echo off/on (similar to DOS batch )
|
||||
Supported commands since version 0.3:
|
||||
rewrite
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Installation:
|
||||
===============
|
||||
|
||||
|
||||
|
||||
- Simply copy SBOOT.PRG into your AUTO folder
|
||||
- press "C" for initial setup
|
||||
- move SBOOT.PRG to the top of program list.
|
||||
|
||||
|
||||
|
||||
Keybindings:
|
||||
==============
|
||||
|
||||
Mainscreen:
|
||||
|
||||
|
||||
|
||||
Help: Show this screen
|
||||
|
||||
|
||||
|
||||
Enter: Toogle active/inactive
|
||||
|
||||
|
||||
|
||||
ESC/Q/q: Continue boot / save changes
|
||||
|
||||
|
||||
|
||||
Shift+A: Move file up
|
||||
|
||||
|
||||
|
||||
Shift+Y: Move file down
|
||||
|
||||
|
||||
|
||||
Shift+F1-F10: Save Set 1-10
|
||||
|
||||
|
||||
|
||||
F1-F10: Load Set 1-10
|
||||
|
||||
|
||||
|
||||
C: Configuration
|
||||
|
||||
|
||||
|
||||
D: Delete current set
|
||||
|
||||
|
||||
|
||||
E: Edit Script for current set
|
||||
|
||||
|
||||
|
||||
L: List available sets
|
||||
|
||||
|
||||
|
||||
S: Save without exit
|
||||
|
||||
|
||||
|
||||
Editor:
|
||||
|
||||
|
||||
|
||||
ESC: Exit without save
|
||||
|
||||
F2: Save data
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Script Commands:
|
||||
==================
|
||||
|
||||
|
||||
|
||||
(optional parameters marked with *)
|
||||
|
||||
|
||||
|
||||
pause *message - waits for any keypress
|
||||
|
||||
|
||||
|
||||
echo *message - prints message to screen or just newline
|
||||
|
||||
|
||||
|
||||
set echo off - turn on/off verbose command output
|
||||
|
||||
|
||||
|
||||
copy src dst - copy file from source to destination
|
||||
|
||||
|
||||
|
||||
rewrite file needle replacement - Replace all occurences of "needle"
|
||||
in file X with a string "replacement".
|
||||
(this command is not case sensitive)
|
||||
1249
tools/sboot-03/src/ahcc.adb
Normal file
1249
tools/sboot-03/src/ahcc.adb
Normal file
File diff suppressed because it is too large
Load Diff
32
tools/sboot-03/src/ahcc.prj
Normal file
32
tools/sboot-03/src/ahcc.prj
Normal file
@@ -0,0 +1,32 @@
|
||||
;C:\AUTO\SBOOT.PRG
|
||||
bin\v4e\SBOOT.PRG
|
||||
|
||||
; compiler setup:
|
||||
; allow nested comments
|
||||
; char is unsigned,
|
||||
; no string mergin
|
||||
; use absolute calls
|
||||
.C [-C -K -M -P]
|
||||
.C [-DEZXML_NOMMAP -D__COLDFIRE__ -7 -DWITHOUT_VDI -DWITHOUT_GFX ]
|
||||
.L [-S=16384]
|
||||
=
|
||||
AHCSTART.O ; Startup code
|
||||
;
|
||||
;--------------- Sources: ---------
|
||||
;
|
||||
LINEA.S
|
||||
GFX.C (GFX.H, LINEA.H)
|
||||
GUI.C (GUI.H, LINEA.H)
|
||||
EDITOR.C
|
||||
SCRIPT.C
|
||||
SETS.C
|
||||
EZXML/EZXML.C
|
||||
MAIN.C (LINEA.H, GFX.H, GUI.H)
|
||||
|
||||
;**********************************
|
||||
;* LIBS
|
||||
;**********************************
|
||||
AHCCGEMF.LIB
|
||||
;AHCCSTDF.LIB
|
||||
AHCCSTDF.LIB
|
||||
AHCCTOS.LIB
|
||||
43
tools/sboot-03/src/ahccm68k.prj
Normal file
43
tools/sboot-03/src/ahccm68k.prj
Normal file
@@ -0,0 +1,43 @@
|
||||
;SBOOT.PRG
|
||||
C:\AUTO\SBOOT.PRG
|
||||
|
||||
; THIS PROJECT DOESN'T RUN CLEAN,
|
||||
; AT LEAST NOT ON THE FIREBEE.
|
||||
; USE THE PC PROJECT FILE + PUREC
|
||||
; TO COMPILE FOR M68K
|
||||
|
||||
|
||||
; compiler setup:
|
||||
; allow nested comments
|
||||
; char is unsigned,
|
||||
; no string mergin
|
||||
; use absolute calls
|
||||
.C [-C -K -M -P]
|
||||
.C [-DEZXML_NOMMAP -DWITHOUT_GFX ]
|
||||
.L [-S=16384]
|
||||
=
|
||||
AHCSTART.O ; Startup code
|
||||
;
|
||||
;--------------- Sources: ---------
|
||||
;
|
||||
LINEA.S
|
||||
GFX.C (GFX.H, LINEA.H)
|
||||
;GFX.O
|
||||
GUI.C (GUI.H, LINEA.H)
|
||||
;GUI.O
|
||||
EDITOR.C
|
||||
;EDITOR.O
|
||||
SETS.C
|
||||
;SETS.O
|
||||
SCRIPT.C
|
||||
;SCRIPT.O
|
||||
;EZXML\EZXML.C
|
||||
EZXML\EZXML.O
|
||||
MAIN.C (LINEA.H, GFX.H, GUI.H)
|
||||
;MAIN.O
|
||||
|
||||
;**********************************
|
||||
;* LIBS
|
||||
;**********************************
|
||||
AHCCGEM.LIB
|
||||
AHCCSTDI.LIB
|
||||
320
tools/sboot-03/src/editor.c
Normal file
320
tools/sboot-03/src/editor.c
Normal file
@@ -0,0 +1,320 @@
|
||||
|
||||
#include <tos.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gui.h"
|
||||
#include "editor.h"
|
||||
#include "keys.h"
|
||||
|
||||
struct s_edit_buf edit_buf;
|
||||
|
||||
int edit_buf_init( struct s_edit_buf * buf )
|
||||
{
|
||||
memset( (char*)buf, 0, sizeof(struct s_edit_buf) );
|
||||
buf->blocksize = EDIT_BUF_DEFAULT_BLOCKSIZE;
|
||||
edit_buf_destroy( buf );
|
||||
buf->data = malloc( buf->blocksize );
|
||||
if( buf->data == NULL )
|
||||
return( 1 );
|
||||
buf->size = buf->blocksize;
|
||||
buf->data[0] = 0;
|
||||
buf->used = 1;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
void edit_buf_destroy( struct s_edit_buf * buf )
|
||||
{
|
||||
if( buf->data )
|
||||
free( buf->data );
|
||||
|
||||
buf->data = NULL;
|
||||
}
|
||||
|
||||
void edit_buf_alloc( struct s_edit_buf * buf, int amount )
|
||||
{
|
||||
int blocks = 1;
|
||||
|
||||
if( buf->size < (buf->used + amount)+1 ){
|
||||
if( amount > buf->blocksize)
|
||||
blocks = (amount / buf->blocksize)+1;
|
||||
buf->data = realloc( buf->data, buf->size+(buf->blocksize*blocks));
|
||||
buf->size += (buf->blocksize*blocks);
|
||||
}
|
||||
}
|
||||
|
||||
long edit_buf_find_linestart( struct s_edit_buf * buf, long curpos, long skip, long direction )
|
||||
{
|
||||
long i;
|
||||
|
||||
if( direction == 0 )
|
||||
return( -1 );
|
||||
|
||||
if( buf == NULL)
|
||||
return( -1 );
|
||||
|
||||
if( curpos > buf->used-1 )
|
||||
return( buf->used-1 );
|
||||
|
||||
if( skip > 0 ) {
|
||||
curpos = edit_buf_find_linestart( buf, curpos, 0, direction );
|
||||
skip--;
|
||||
if( curpos > 0 && skip >0 ){
|
||||
return( edit_buf_find_linestart( buf, curpos, skip, direction ) );
|
||||
}
|
||||
|
||||
return( curpos );
|
||||
}
|
||||
|
||||
curpos += direction;
|
||||
if( direction > 0 && curpos <= 0 ) {
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
||||
for( i=curpos; i>=1; i=i+direction){
|
||||
if(buf->data[i] == 10 || buf->data[i] == 13 || buf->data[i] == 0 ){
|
||||
return( i ) ;
|
||||
}
|
||||
}
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
void edit_buf_redraw( struct s_edit_buf * buf )
|
||||
{
|
||||
char * out = " ";
|
||||
int cury = 1;
|
||||
int curx = 0;
|
||||
int curline = 1;
|
||||
int i=0;
|
||||
int len;
|
||||
long lines_limit;
|
||||
long lines_done=0;
|
||||
short inv=0;
|
||||
|
||||
len = strlen( buf->data );
|
||||
lines_limit = c_rows-2;
|
||||
|
||||
#ifndef WITHOUT_GFX
|
||||
cury = 4;
|
||||
lines_limit -= 3;
|
||||
#endif
|
||||
|
||||
if( i >= buf->redraw_start_at_char )
|
||||
fillspace(0, cury, c_cols, 0);
|
||||
for( i = 0; i<=len; i++ ) {
|
||||
if( buf->data[i] == 13 || buf->data[i] == 10 ) {
|
||||
if( i >= buf->redraw_start_at_char ){
|
||||
fillspace(curx, cury, c_cols, 0);
|
||||
if( buf->cursor == i )
|
||||
textxy( curx, cury, 1, " " );
|
||||
lines_done++;
|
||||
if( lines_done >= lines_limit )
|
||||
break;
|
||||
}
|
||||
curx = 0;
|
||||
cury++;
|
||||
if( cury > c_rows-2 )
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if( buf->scroll_y < cury && curx < c_cols-1 )
|
||||
{
|
||||
*out = buf->data[i];
|
||||
if( *out == 0 )
|
||||
*out = ' ';
|
||||
if( i == buf->cursor )
|
||||
inv = 1;
|
||||
if( i >= buf->redraw_start_at_char ){
|
||||
textxy( curx, cury, inv, out );
|
||||
}
|
||||
if( inv == 1 )
|
||||
inv = 0;
|
||||
if( buf->data[i] == 0 ){
|
||||
break;
|
||||
}
|
||||
}
|
||||
curx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void edit_buf_insert(
|
||||
struct s_edit_buf * buf,
|
||||
unsigned char * c
|
||||
)
|
||||
{
|
||||
int i, pos;
|
||||
int len = strlen( c );
|
||||
edit_buf_alloc( buf, len );
|
||||
memmove(
|
||||
&buf->data[buf->cursor+len],
|
||||
&buf->data[buf->cursor],
|
||||
strlen(&buf->data[buf->cursor])
|
||||
);
|
||||
for( i=0; i<len; i++) {
|
||||
pos = buf->cursor+i;
|
||||
if( c[i] == 13 || c[i] == 10 ) {
|
||||
buf->lines++;
|
||||
}
|
||||
buf->data[pos] = c[i];
|
||||
buf->used++;
|
||||
}
|
||||
buf->data[buf->used-1] = 0;
|
||||
buf->redraw_start_at_char = (buf->cursor>0 ) ? buf->cursor-1 : 0;
|
||||
buf->redraw_limit_lines = -1; /* newline may cause reflow */
|
||||
buf->cursor += len;
|
||||
edit_buf_redraw( buf );
|
||||
}
|
||||
|
||||
void edit_buf_remove( struct s_edit_buf * buf )
|
||||
{
|
||||
buf->used--;
|
||||
}
|
||||
|
||||
char * edit_text( char * title, char * text )
|
||||
{
|
||||
short code, key;
|
||||
char ascii, sh;
|
||||
char exit = 0;
|
||||
int i=0, x=0, z=0;
|
||||
char ig=0;
|
||||
char tmp[3]="";
|
||||
char * result=NULL;
|
||||
long nextbest;
|
||||
long maybest;
|
||||
|
||||
draw_info("ESC=Exit without save, F2=Save");
|
||||
for( i=1; i<c_rows-1; i++ ){
|
||||
fillspace(0, i, c_cols, 0);
|
||||
}
|
||||
draw_title( title );
|
||||
|
||||
edit_buf_init( (struct s_edit_buf*)&edit_buf );
|
||||
edit_buf_insert( &edit_buf, text );
|
||||
|
||||
do{
|
||||
ig = 0;
|
||||
key = getkey(&sh, &code, &ascii);
|
||||
switch( code ){
|
||||
|
||||
case ESC:
|
||||
exit = 1;
|
||||
break;
|
||||
|
||||
case F1_BASE+1*0x100:
|
||||
/*case CTRL_S: */
|
||||
/*if( ascii == ){*/
|
||||
result = edit_buf.data;
|
||||
exit = 1;
|
||||
/*}*/
|
||||
break;
|
||||
|
||||
case BACKSPACE:
|
||||
ig = 1;
|
||||
if( edit_buf.cursor > 0 ) {
|
||||
edit_buf.cursor--;
|
||||
edit_buf.redraw_limit_lines = 2;
|
||||
edit_buf.redraw_start_at_char = edit_buf.cursor;
|
||||
edit_buf_redraw( &edit_buf );
|
||||
edit_buf.cursor++;
|
||||
memmove( &edit_buf.data[edit_buf.cursor-1],
|
||||
&edit_buf.data[edit_buf.cursor],
|
||||
strlen(&edit_buf.data[edit_buf.cursor])+1
|
||||
);
|
||||
edit_buf.cursor--;
|
||||
edit_buf.redraw_start_at_char = (edit_buf.cursor>0 ) ? edit_buf.cursor-1 : 0;
|
||||
edit_buf.redraw_limit_lines = -1;
|
||||
edit_buf.used--;
|
||||
edit_buf.data[edit_buf.used-1] = 0;
|
||||
edit_buf_redraw( &edit_buf );
|
||||
}
|
||||
break;
|
||||
|
||||
case CURS_UP:
|
||||
ig = 1;
|
||||
nextbest = edit_buf_find_linestart( &edit_buf, edit_buf.cursor, 0, -1);
|
||||
maybest = edit_buf_find_linestart( &edit_buf, nextbest-1, 0, -1);
|
||||
if( nextbest != -1 && maybest < nextbest && maybest >= 0 ) {
|
||||
if( maybest+(edit_buf.cursor-nextbest) < nextbest ){
|
||||
nextbest = maybest+(edit_buf.cursor-nextbest);
|
||||
}
|
||||
}
|
||||
if( nextbest > -1 ) {
|
||||
edit_buf.redraw_start_at_char = nextbest;
|
||||
edit_buf.redraw_limit_lines = 4;
|
||||
edit_buf.cursor = nextbest;
|
||||
edit_buf_redraw( &edit_buf );
|
||||
}
|
||||
break;
|
||||
|
||||
case CURS_DOWN:
|
||||
ig = 1;
|
||||
z = edit_buf_find_linestart( &edit_buf, edit_buf.cursor, 0, -1);
|
||||
if( z>=0 ){
|
||||
z = edit_buf.cursor-z;
|
||||
} else {
|
||||
z = 0;
|
||||
}
|
||||
nextbest = edit_buf_find_linestart( &edit_buf, edit_buf.cursor-1, 0, +1);
|
||||
if( nextbest != -1 ) {
|
||||
maybest = edit_buf_find_linestart( &edit_buf, nextbest+1, 0, +1);
|
||||
nextbest += z;
|
||||
if( nextbest > maybest ) {
|
||||
nextbest = maybest;
|
||||
}
|
||||
if( nextbest > -1 ) {
|
||||
edit_buf.redraw_start_at_char = edit_buf.cursor;
|
||||
edit_buf.redraw_limit_lines = 4;
|
||||
edit_buf.cursor = nextbest;
|
||||
edit_buf_redraw( &edit_buf );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CURS_LEFT:
|
||||
if( edit_buf.cursor > 0 ){
|
||||
edit_buf.cursor--;
|
||||
edit_buf.redraw_limit_lines = 2;
|
||||
edit_buf.redraw_start_at_char = edit_buf.cursor;
|
||||
edit_buf_redraw( &edit_buf );
|
||||
}
|
||||
ig = 1;
|
||||
break;
|
||||
|
||||
case CURS_RIGHT:
|
||||
if( edit_buf.cursor < edit_buf.used-1 ){
|
||||
edit_buf.redraw_start_at_char = edit_buf.cursor;
|
||||
edit_buf.cursor++;
|
||||
edit_buf.redraw_limit_lines = 2;
|
||||
edit_buf_redraw( &edit_buf );
|
||||
}
|
||||
ig = 1;
|
||||
break;
|
||||
|
||||
|
||||
default: break;
|
||||
}
|
||||
if( ig == 1 || exit == 1 )
|
||||
continue;
|
||||
|
||||
if( (char)key == 0 )
|
||||
continue;
|
||||
if( key == 13 )
|
||||
key = 10;
|
||||
*tmp = (char)key;
|
||||
edit_buf_insert( &edit_buf, tmp );
|
||||
|
||||
} while( exit != 1 );
|
||||
|
||||
return( result );
|
||||
}
|
||||
|
||||
void end_edit_text( )
|
||||
{
|
||||
edit_buf_destroy( &edit_buf );
|
||||
}
|
||||
29
tools/sboot-03/src/editor.h
Normal file
29
tools/sboot-03/src/editor.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef EDITOR_H
|
||||
|
||||
#define EDIT_BUF_DEFAULT_BLOCKSIZE 255;
|
||||
|
||||
struct s_edit_buf {
|
||||
char * data;
|
||||
unsigned long used;
|
||||
unsigned long size;
|
||||
int blocksize;
|
||||
int lines;
|
||||
unsigned long scroll_x;
|
||||
unsigned long scroll_y;
|
||||
unsigned long cursor;
|
||||
long redraw_start_at_char;
|
||||
long redraw_limit_lines;
|
||||
long redraw_limit_chars;
|
||||
};
|
||||
|
||||
int edit_buf_init( struct s_edit_buf * buf);
|
||||
void edit_buf_destroy( struct s_edit_buf * buf );
|
||||
char * edit_text( char * title, char * text );
|
||||
void end_edit_text( void );
|
||||
|
||||
/*void editor_input( char c, unsigned long where );
|
||||
void editor_scroll_x( int n, unsigned char abs );
|
||||
void editor_scroll_y( int n, unsigned char abs );
|
||||
void editor_place_caret( unsigned long x, unsigned long y );
|
||||
*/
|
||||
#endif
|
||||
54
tools/sboot-03/src/ezxml/changelo.txt
Normal file
54
tools/sboot-03/src/ezxml/changelo.txt
Normal file
@@ -0,0 +1,54 @@
|
||||
ezXML 0.8.6
|
||||
- fixed a bug in ezxml_add_child() that can occur when adding tags out of order
|
||||
- for consistency, ezxml_set_attr() now returns the tag given
|
||||
- added ezxml_move() and supporting functions ezxml_cut() and ezxml_insert()
|
||||
- fixed a bug where parsing an empty file could cause a segfault
|
||||
|
||||
ezXML 0.8.5
|
||||
- fixed ezxml_toxml() to not output siblings of tag being converted
|
||||
- fixed a segfault when ezxml_set_attr() was used on a new root tag
|
||||
- added ezxml_name() function macro
|
||||
- all external functions now handle NULL ezxml_t structs without segfaulting
|
||||
|
||||
ezXML 0.8.4
|
||||
- fixed to compile under win-doze when NOMMAP make option is set
|
||||
- fixed a bug where ezxml_toxml() could segfault if tag offset is out of bounds
|
||||
- ezxml_add_child() now works properly when tags are added out of order
|
||||
- improved error messages now include line numbers
|
||||
- fixed memory leak when entity reference is shorter than replacement text
|
||||
- added ezxml_new_d(), ezxml_add_child_d(), ezxml_set_txt_d() and
|
||||
ezxml_set_attr_d() function macros as wrappers that strdup() their arguments
|
||||
|
||||
ezXML 0.8.3
|
||||
- fixed a UTF-16 decoding bug affecting larger unicode values
|
||||
- added internal dtd processing for entity declarations and default attributes
|
||||
- now correctly normalizes attribute values in compliance with the XML 1.0 spec
|
||||
- added check for correct tag nesting
|
||||
- ezxml_toxml() now generates canonical xml (apart from the namespace stuff)
|
||||
|
||||
ezXML 0.8.2
|
||||
- fixed compiler warning about lvalue type casting
|
||||
- ezxml_get() argument list can now be terminated by an empty string tag name
|
||||
- added NOMMAP make option for systems without posix memory mapping
|
||||
- added support for UTF-16
|
||||
- fixed bug in ezxml_toxml() where UTF-8 sequences were being ampersand encoded
|
||||
- added ezxml_new(), ezxml_add_child(), ezxml_set_txt(), ezxml_set_attr(),
|
||||
and ezxml_remove() to facilitate creating and modifying xml
|
||||
|
||||
ezXML 0.8.1
|
||||
- fixed bug where tags of same name were not recognized as such
|
||||
- fixed a memory allocation bug in ezxml_toxml() that could cause a segfault
|
||||
- added an extra check for missing root tag
|
||||
- now allows for space between ] and > when closing <!DOCTYPE [ ... ]>
|
||||
- now allows : as tag name start char
|
||||
- added ezxml_next() and ezxml_txt() function macros
|
||||
|
||||
ezXML 0.8
|
||||
- added ezxml_toxml() function
|
||||
- removed ezxml_print(), just use printf() with ezxml_toxml() (minor version
|
||||
api changes will all be backwards compatible after 1.0 release)
|
||||
- added ezxml_pi() for retrieving <? ?> parsing instructions
|
||||
- whitespace in tag data is now preserved in compliance with the XML 1.0 spec
|
||||
|
||||
ezXML 0.7
|
||||
- initial public release
|
||||
356
tools/sboot-03/src/ezxml/ezxml.adb
Normal file
356
tools/sboot-03/src/ezxml/ezxml.adb
Normal file
@@ -0,0 +1,356 @@
|
||||
ahcc_dep AHCC V4.4 project database
|
||||
files 18
|
||||
dependencies
|
||||
{
|
||||
[2]E:\SRC\SBOOT\EZXML\EZXML.C
|
||||
{
|
||||
[8]D:\DEVEL\AHCCST.BIN\INCLUDE\AHCC_RT.H
|
||||
[9]D:\DEVEL\AHCCST.BIN\INCLUDE\STDLIB.H
|
||||
[11]D:\DEVEL\AHCCST.BIN\INCLUDE\STDIO.H
|
||||
[12]D:\DEVEL\AHCCST.BIN\INCLUDE\STDARG.H
|
||||
[13]D:\DEVEL\AHCCST.BIN\INCLUDE\STRING.H
|
||||
[14]D:\DEVEL\AHCCST.BIN\INCLUDE\CTYPE.H
|
||||
[15]D:\DEVEL\AHCCST.BIN\INCLUDE\EXT.H
|
||||
[3]E:\SRC\SBOOT\EZXML\EZXML.H
|
||||
}
|
||||
[8]D:\DEVEL\AHCCST.BIN\INCLUDE\AHCC_RT.H
|
||||
[9]D:\DEVEL\AHCCST.BIN\INCLUDE\STDLIB.H
|
||||
{
|
||||
[10]D:\DEVEL\AHCCST.BIN\INCLUDE\STDDEF.H
|
||||
}
|
||||
[10]D:\DEVEL\AHCCST.BIN\INCLUDE\STDDEF.H
|
||||
[11]D:\DEVEL\AHCCST.BIN\INCLUDE\STDIO.H
|
||||
{
|
||||
[12]D:\DEVEL\AHCCST.BIN\INCLUDE\STDARG.H
|
||||
}
|
||||
[12]D:\DEVEL\AHCCST.BIN\INCLUDE\STDARG.H
|
||||
[13]D:\DEVEL\AHCCST.BIN\INCLUDE\STRING.H
|
||||
[14]D:\DEVEL\AHCCST.BIN\INCLUDE\CTYPE.H
|
||||
[15]D:\DEVEL\AHCCST.BIN\INCLUDE\EXT.H
|
||||
{
|
||||
[16]D:\DEVEL\AHCCST.BIN\INCLUDE\TIME.H
|
||||
[17]D:\DEVEL\AHCCST.BIN\INCLUDE\SYS\STAT.H
|
||||
[18]D:\DEVEL\AHCCST.BIN\INCLUDE\UNISTD.H
|
||||
}
|
||||
[16]D:\DEVEL\AHCCST.BIN\INCLUDE\TIME.H
|
||||
[17]D:\DEVEL\AHCCST.BIN\INCLUDE\SYS\STAT.H
|
||||
[18]D:\DEVEL\AHCCST.BIN\INCLUDE\UNISTD.H
|
||||
[3]E:\SRC\SBOOT\EZXML\EZXML.H
|
||||
{
|
||||
[9]D:\DEVEL\AHCCST.BIN\INCLUDE\STDLIB.H
|
||||
[11]D:\DEVEL\AHCCST.BIN\INCLUDE\STDIO.H
|
||||
[12]D:\DEVEL\AHCCST.BIN\INCLUDE\STDARG.H
|
||||
[15]D:\DEVEL\AHCCST.BIN\INCLUDE\EXT.H
|
||||
}
|
||||
}
|
||||
|
||||
identifiers
|
||||
{
|
||||
[8/34]AHCC_RUN_H
|
||||
[8/38]operator
|
||||
[8/39]cast
|
||||
[8/55]Aint
|
||||
[8/56]Auint
|
||||
[8/62]__HAVE_SW_LONG_MUL_DIV__
|
||||
[9/11]__STDLIB
|
||||
[10/11]__STDDEF
|
||||
[10/13]size_t
|
||||
[10/15]__SIZE_TYPEDEF__
|
||||
[10/17]ptrdiff_t
|
||||
[10/18]_SIZE_T
|
||||
[10/21]offsetof
|
||||
[10/27]NULL
|
||||
[9/18]EXIT_FAILURE
|
||||
[9/19]EXIT_SUCCESS
|
||||
[9/20]RAND_MAX
|
||||
[9/26]div_t
|
||||
[9/32]ldiv_t
|
||||
[9/42,-1]atoi
|
||||
[9/43,-1]atol
|
||||
[9/45,-1]itoa
|
||||
[9/46,-1]ltoa
|
||||
[9/47,-1]ultoa
|
||||
[9/49,-1]malloc
|
||||
[9/50,-1]lalloc
|
||||
[9/51,-1]calloc
|
||||
[9/52,-1]free
|
||||
[9/53,-1]realloc
|
||||
[9/55,-1]abs
|
||||
[9/56,-1]labs
|
||||
[9/57,-1]div
|
||||
[9/58,-1]ldiv
|
||||
[9/60,-1]rand
|
||||
[9/61,-1]srand
|
||||
[9/62]random
|
||||
[9/64,-1]system
|
||||
[9/66,-1]exit
|
||||
[9/67,-1]abort
|
||||
[9/68,-1]atexit
|
||||
[9/70,-1]getenv
|
||||
[9/72,-1]bsearch
|
||||
[9/75,-1]qsort
|
||||
[11/11]__STDIO
|
||||
[12/11]__STDARG
|
||||
[12/14]va_list
|
||||
[12/16]va_start
|
||||
[12/17]va_arg
|
||||
[12/21]va_end
|
||||
[11/20]fpos_t
|
||||
[11/33]FILE
|
||||
[11/43]OPEN_MAX
|
||||
[11/44]FOPEN_MAX
|
||||
[11/45]FILENAME_MAX
|
||||
[11/46]PATH_MAX
|
||||
[11/47]BUFSIZ
|
||||
[11/48]EOF
|
||||
[11/50]O_RDONLY
|
||||
[11/51]O_WRONLY
|
||||
[11/52]O_RDWR
|
||||
[11/53]O_APPEND
|
||||
[11/54]O_CREAT
|
||||
[11/55]O_TRUNC
|
||||
[11/56]O_EXCL
|
||||
[11/58]SEEK_SET
|
||||
[11/59]SEEK_CUR
|
||||
[11/60]SEEK_END
|
||||
[11/62]TMP_MAX
|
||||
[11/63]L_tmpnam
|
||||
[11/65]_IOFBF
|
||||
[11/66]_IOLBF
|
||||
[11/67]_IONBF
|
||||
[11/69]stdout
|
||||
[11/70]stdin
|
||||
[11/71]stderr
|
||||
[11/72]stdaux
|
||||
[11/73]stdprn
|
||||
[11/77,-1]_StdOutF
|
||||
[11/78,-1]_StdInF
|
||||
[11/79,-1]_StdErrF
|
||||
[11/80,-1]_StdAuxF
|
||||
[11/81,-1]_StdPrnF
|
||||
[11/83,-1]errno
|
||||
[11/84,-1]sys_errlist
|
||||
[11/89,-1]clearerr
|
||||
[11/90,-1]fclose
|
||||
[11/91,-1]feof
|
||||
[11/92,-1]ferror
|
||||
[11/93,-1]fflush
|
||||
[11/94,-1]fgetc
|
||||
[11/136]getc
|
||||
[11/137]getchar
|
||||
[11/97,-1]fgetpos
|
||||
[11/98,-1]fgets
|
||||
[11/99,-1]fopen
|
||||
[11/100,-1]fprintf
|
||||
[11/101,-1]fputc
|
||||
[11/138]putc
|
||||
[11/139]putchar
|
||||
[11/104,-1]fputs
|
||||
[11/105,-1]fread
|
||||
[11/106,-1]freopen
|
||||
[11/107,-1]fscanf
|
||||
[11/108,-1]fseek
|
||||
[11/109,-1]rewind
|
||||
[11/110,-1]fsetpos
|
||||
[11/111,-1]ftell
|
||||
[11/112,-1]fwrite
|
||||
[11/114,-1]gets
|
||||
[11/115,-1]perror
|
||||
[11/116,-1]printf
|
||||
[11/117,-1]puts
|
||||
[11/118,-1]scanf
|
||||
[11/119,-1]setbuf
|
||||
[11/120,-1]setvbuf
|
||||
[11/121,-1]sprintf
|
||||
[11/122,-1]sscanf
|
||||
[11/123,-1]tmpnam
|
||||
[11/124,-1]tmpfile
|
||||
[11/125,-1]ungetc
|
||||
[11/126,-1]vfprintf
|
||||
[11/127,-1]vprintf
|
||||
[11/128,-1]vsprintf
|
||||
[11/129,-1]vfscanf
|
||||
[11/130,-1]vscanf
|
||||
[11/131,-1]vsscanf
|
||||
[11/140]fileno
|
||||
[11/144,-1]open
|
||||
[11/145,-1]close
|
||||
[11/146,-1]creat
|
||||
[11/147,-1]read
|
||||
[11/148,-1]write
|
||||
[11/149,-1]lseek
|
||||
[11/150,-1]remove
|
||||
[11/151,-1]unlink
|
||||
[11/152,-1]rename
|
||||
[13/11]__STRING
|
||||
[13/18,-1]strcat
|
||||
[13/19,-1]strncat
|
||||
[13/20,-1]strcmp
|
||||
[13/21,-1]stricmp
|
||||
[13/22,-1]strcmpi
|
||||
[13/23,-1]strncmp
|
||||
[13/24,-1]strnicmp
|
||||
[13/25,-1]strncmpi
|
||||
[13/26,-1]strcpy
|
||||
[13/27,-1]strncpy
|
||||
[13/28,-1]strdup
|
||||
[13/30,-1]strlen
|
||||
[13/32,-1]strchr
|
||||
[13/33,-1]strrchr
|
||||
[13/35,-1]strspn
|
||||
[13/36,-1]strcspn
|
||||
[13/37,-1]strpbrk
|
||||
[13/39,-1]strstr
|
||||
[13/40,-1]strtok
|
||||
[13/42,-1]strupr
|
||||
[13/43,-1]strlwr
|
||||
[13/44,-1]strrev
|
||||
[13/45,-1]strset
|
||||
[13/46,-1]strnset
|
||||
[13/51,-1]strtol
|
||||
[13/52,-1]strtoul
|
||||
[13/54,-1]strerror
|
||||
[13/56,-1]memchr
|
||||
[13/57,-1]memcmp
|
||||
[13/58,-1]memcpy
|
||||
[13/59,-1]memmove
|
||||
[13/60,-1]memset
|
||||
[13/62]zero
|
||||
[13/63]pzero
|
||||
[14/11]__CTYPE
|
||||
[14/14,-1]isalnum
|
||||
[14/15,-1]isalpha
|
||||
[14/16,-1]isascii
|
||||
[14/17,-1]iscntrl
|
||||
[14/18,-1]isdigit
|
||||
[14/19,-1]isodigit
|
||||
[14/20,-1]isxdigit
|
||||
[14/21,-1]isgraph
|
||||
[14/22,-1]isprint
|
||||
[14/23,-1]ispunct
|
||||
[14/24,-1]islower
|
||||
[14/25,-1]isupper
|
||||
[14/26,-1]isspace
|
||||
[14/27,-1]tolower
|
||||
[14/28,-1]toupper
|
||||
[14/30]toascii
|
||||
[15/22]__EXT
|
||||
[16/11]__TIME
|
||||
[16/13]CLK_TCK
|
||||
[16/19]time_t
|
||||
[16/22]_TIME_T
|
||||
[16/21]clock_t
|
||||
[16/24,-1]timezone
|
||||
[16/25,-1]daylight
|
||||
[16/41,-1]asctime
|
||||
[16/42,-1]ctime
|
||||
[16/44,-1]gmtime
|
||||
[16/45,-1]localtime
|
||||
[16/47,-1]time
|
||||
[16/48,-1]mktime
|
||||
[16/50,-1]clock
|
||||
[16/52,-1]strftime
|
||||
[17/26]_SYS_STAT_H
|
||||
[17/32]S_IFCHR
|
||||
[17/33]S_IFDIR
|
||||
[17/34]S_IFREG
|
||||
[17/35]S_IEXEC
|
||||
[17/36]S_IREAD
|
||||
[17/37]S_IWRITE
|
||||
[17/54,-1]fstat
|
||||
[17/55,-1]stat
|
||||
[18/21]_UNISTD_H
|
||||
[18/23,-1]getcwd
|
||||
[18/24,-1]sleep
|
||||
[18/25,-1]chdir
|
||||
[18/26,-1]isatty
|
||||
[15/30,-1]__text
|
||||
[15/30,-1]__data
|
||||
[15/30,-1]__bss
|
||||
[15/31]_text
|
||||
[15/32]_data
|
||||
[15/33]_bss
|
||||
[15/35]FA_UPDATE
|
||||
[15/36]FA_RDONLY
|
||||
[15/37]FA_HIDDEN
|
||||
[15/38]FA_SYSTEM
|
||||
[15/39]FA_LABEL
|
||||
[15/40]FA_DIREC
|
||||
[15/41]FA_ARCH
|
||||
[15/43]MAXPATH
|
||||
[15/44]MAXDRIVE
|
||||
[15/45]MAXDIR
|
||||
[15/46]MAXFILE
|
||||
[15/47]MAXEXT
|
||||
[15/93,-1]getcurdir
|
||||
[15/94,-1]getdisk
|
||||
[15/95,-1]getdfree
|
||||
[15/96,-1]setdisk
|
||||
[15/98,-1]findfirst
|
||||
[15/99,-1]findnext
|
||||
[15/101,-1]getdate
|
||||
[15/102,-1]gettime
|
||||
[15/103,-1]setdate
|
||||
[15/104,-1]settime
|
||||
[15/105,-1]getftime
|
||||
[15/106,-1]setftime
|
||||
[15/108,-1]ftimtotm
|
||||
[15/110,-1]delay
|
||||
[15/112,-1]kbhit
|
||||
[15/113,-1]getch
|
||||
[15/114,-1]getche
|
||||
[15/115,-1]putch
|
||||
[15/117,-1]filelength
|
||||
[15/119,-1]coreleft
|
||||
[3/4]_EZXML_H
|
||||
[3/15]EZXML_BUFSIZE
|
||||
[3/16]EZXML_NAMEM
|
||||
[3/17]EZXML_TXTM
|
||||
[3/18]EZXML_DUP
|
||||
[3/20]ezxml_t
|
||||
[2/446]ezxml_parse_str
|
||||
[2/602]ezxml_parse_fd
|
||||
[2/632]ezxml_parse_file
|
||||
[2/581]ezxml_parse_fp
|
||||
[2/36]ezxml_child
|
||||
[3/59]ezxml_next
|
||||
[2/45]ezxml_idx
|
||||
[3/66]ezxml_name
|
||||
[3/69]ezxml_txt
|
||||
[2/52]ezxml_attr
|
||||
[2/87]ezxml_get
|
||||
[2/721]ezxml_toxml
|
||||
[2/100]ezxml_pi
|
||||
[2/760]ezxml_free
|
||||
[2/803]ezxml_error
|
||||
[2/810]ezxml_new
|
||||
[3/100]ezxml_new_d
|
||||
[2/868]ezxml_add_child
|
||||
[3/107]ezxml_add_child_d
|
||||
[2/883]ezxml_set_txt
|
||||
[3/114]ezxml_set_txt_d
|
||||
[2/894]ezxml_set_attr
|
||||
[3/122]ezxml_set_attr_d
|
||||
[2/935]ezxml_set_flag
|
||||
[2/942]ezxml_cut
|
||||
[2/825]ezxml_insert
|
||||
[3/136]ezxml_move
|
||||
[3/139]ezxml_remove
|
||||
[2/14]EZXML_WS
|
||||
[2/15]EZXML_ERRL
|
||||
[2/17]ezxml_root_t
|
||||
[2/33]EZXML_NIL
|
||||
[2/69]ezxml_vget
|
||||
[2/112]ezxml_err
|
||||
[2/134]ezxml_decode
|
||||
[2/197]ezxml_open_tag
|
||||
[2/209]ezxml_char_content
|
||||
[2/233]ezxml_close_tag
|
||||
[2/244]ezxml_ent_ok
|
||||
[2/258]ezxml_proc_inst
|
||||
[2/295]ezxml_internal_dtd
|
||||
[2/398]ezxml_str2utf8
|
||||
[2/430]ezxml_free_attr
|
||||
[2/643]ezxml_ampencode
|
||||
[2/669]ezxml_toxml_r
|
||||
}
|
||||
1
tools/sboot-03/src/ezxml/ezxml.c
Normal file
1
tools/sboot-03/src/ezxml/ezxml.c
Normal file
File diff suppressed because one or more lines are too long
1
tools/sboot-03/src/ezxml/ezxml.h
Normal file
1
tools/sboot-03/src/ezxml/ezxml.h
Normal file
File diff suppressed because one or more lines are too long
121
tools/sboot-03/src/ezxml/ezxml.htm
Normal file
121
tools/sboot-03/src/ezxml/ezxml.htm
Normal file
@@ -0,0 +1,121 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head><title>ezXML</title></head>
|
||||
<body>
|
||||
<h1>ezXML - XML Parsing C Library</h1>
|
||||
<h3>version 0.8.6</h3>
|
||||
<p>
|
||||
ezXML is a C library for parsing XML documents inspired by
|
||||
<a href="http://www.php.net/SimpleXML">simpleXML</a> for
|
||||
PHP. As the name implies, it's easy to use. It's ideal for parsing XML
|
||||
configuration files or REST web service responses. It's also fast and
|
||||
lightweight (less than 20k compiled). The latest version is available
|
||||
here:
|
||||
<a href="http://prdownloads.sf.net/ezxml/ezxml-0.8.6.tar.gz?download"
|
||||
>ezxml-0.8.6.tar.gz</a>
|
||||
</p>
|
||||
|
||||
<b>Example Usage</b>
|
||||
<p>
|
||||
Given the following example XML document:
|
||||
</p>
|
||||
<code>
|
||||
<?xml version="1.0"?><br />
|
||||
<formula1><br />
|
||||
<team name="McLaren"><br />
|
||||
<driver><br />
|
||||
<name>Kimi
|
||||
Raikkonen</name><br />
|
||||
<points>112</points><br />
|
||||
</driver><br />
|
||||
<driver><br />
|
||||
<name>Juan Pablo
|
||||
Montoya</name><br />
|
||||
<points>60</points><br />
|
||||
</driver><br />
|
||||
</team><br />
|
||||
</formula1>
|
||||
</code>
|
||||
<p>
|
||||
This code snippet prints out a list of drivers, which team they drive for,
|
||||
and how many championship points they have:
|
||||
</p>
|
||||
<code>
|
||||
ezxml_t f1 = ezxml_parse_file("formula1.xml"), team, driver;<br />
|
||||
const char *teamname;<br />
|
||||
<br />
|
||||
for (team = ezxml_child(f1, "team"); team; team = team->next) {<br />
|
||||
teamname = ezxml_attr(team, "name");<br />
|
||||
for (driver = ezxml_child(team, "driver"); driver;
|
||||
driver = driver->next) {<br />
|
||||
printf("%s, %s: %s\n",
|
||||
ezxml_child(driver, "name")->txt, teamname,<br />
|
||||
|
||||
ezxml_child(driver, "points")->txt);<br />
|
||||
}<br />
|
||||
}<br />
|
||||
ezxml_free(f1);
|
||||
</code>
|
||||
<p>
|
||||
Alternately, the following would print out the name of the second driver
|
||||
on the first team:
|
||||
</p>
|
||||
<code>
|
||||
ezxml_t f1 = ezxml_parse_file("formula1.xml");<br />
|
||||
<br />
|
||||
printf("%s\n", ezxml_get(f1, "team", 0, "driver", 1, "name", -1)->txt);
|
||||
<br />ezxml_free(f1);
|
||||
</code>
|
||||
<p>
|
||||
The -1 indicates the end of the argument list. That's pretty much all
|
||||
there is to it. Complete API documentation can be found in ezxml.h.
|
||||
</p>
|
||||
|
||||
<b>Known Limitations</b>
|
||||
<ul>
|
||||
<li>
|
||||
ezXML is not a validating parser.
|
||||
<br />
|
||||
</li>
|
||||
<li>
|
||||
Loads the entire XML document into memory at once and does not allow for
|
||||
documents to be passed in a chunk at a time. Large XML files can still
|
||||
be handled though through <code>ezxml_parse_file()</code> and
|
||||
<code>ezxml_parse_fd()</code>, which use mmap to map the file to a
|
||||
virtual address space and rely on the virtual memory system to page in
|
||||
data as needed.
|
||||
<br />
|
||||
</li>
|
||||
<li>
|
||||
Does not currently recognize all possible well-formedness errors. It
|
||||
should correctly handle all well-formed XML documents and will either
|
||||
ignore or halt XML processing on well-formedness errors. More
|
||||
well-formedness checking will be added in subsiquent releases.
|
||||
<br />
|
||||
</li>
|
||||
<li>
|
||||
In making the character content of tags easy to access, there is no
|
||||
way provided to keep track of the location of sub tags relative to the
|
||||
character data. Example:
|
||||
<p>
|
||||
<code><doc>line one<br/><br />line two</doc></code>
|
||||
</p>
|
||||
<p>
|
||||
The character content of the doc tag is reported as
|
||||
<code>"line one\nline two"</code>, and <code><br/></code> is
|
||||
reported as a sub tag, but the location of <code><br/></code>
|
||||
within the character data is not. The function
|
||||
<code>ezxml_toxml()</code> will convert an ezXML structure back to XML
|
||||
with sub tag locations intact.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<b>Licensing</b>
|
||||
<p>
|
||||
ezXML was written by Aaron Voisine and is distributed under the terms of
|
||||
the <a href="license.txt">MIT license</a>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
BIN
tools/sboot-03/src/ezxml/ezxml.o
Normal file
BIN
tools/sboot-03/src/ezxml/ezxml.o
Normal file
Binary file not shown.
BIN
tools/sboot-03/src/ezxml/ezxml.pdb
Normal file
BIN
tools/sboot-03/src/ezxml/ezxml.pdb
Normal file
Binary file not shown.
17
tools/sboot-03/src/ezxml/ezxml.prj
Normal file
17
tools/sboot-03/src/ezxml/ezxml.prj
Normal file
@@ -0,0 +1,17 @@
|
||||
;>>>>>>> LIBFETCH <<<<<<<<
|
||||
|
||||
D:\DEVEL\PURE_C\LIB\ezxml.lib ; name of executable program is topmost window
|
||||
|
||||
.C [ -DEZXML_NOMMAP -Y ]
|
||||
.L [ -J -Y ]
|
||||
|
||||
= ; list of modules follows...
|
||||
|
||||
ezxml.c (ezxml.h)
|
||||
|
||||
PCFLTLIB.LIB ; floating point library
|
||||
PCSTDLIB.LIB ; standard library
|
||||
PCTOSLIB.LIB ; TOS library
|
||||
PCEXTLIB.LIB ; PureC Extensions
|
||||
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
84
tools/sboot-03/src/ezxml/ezxml.txt
Normal file
84
tools/sboot-03/src/ezxml/ezxml.txt
Normal file
@@ -0,0 +1,84 @@
|
||||
ezXML - XML Parsing C Library
|
||||
version 0.8.5
|
||||
|
||||
ezXML is a C library for parsing XML documents inspired by simpleXML for PHP.
|
||||
As the name implies, it's easy to use. It's ideal for parsing XML configuration
|
||||
files or REST web service responses. It's also fast and lightweight (less than
|
||||
20k compiled). The latest verions is available here:
|
||||
http://prdownloads.sf.net/ezxml/ezxml-0.8.6.tar.gz?download
|
||||
|
||||
Example Usage
|
||||
|
||||
Given the following example XML document:
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<formula1>
|
||||
<team name="McLaren">
|
||||
<driver>
|
||||
<name>Kimi Raikkonen</name>
|
||||
<points>112</points>
|
||||
</driver>
|
||||
<driver>
|
||||
<name>Juan Pablo Montoya</name>
|
||||
<points>60</points>
|
||||
</driver>
|
||||
</team>
|
||||
</formula1>
|
||||
|
||||
This code snippet prints out a list of drivers, which team they drive for,
|
||||
and how many championship points they have:
|
||||
|
||||
ezxml_t f1 = ezxml_parse_file("formula1.xml"), team, driver;
|
||||
const char *teamname;
|
||||
|
||||
for (team = ezxml_child(f1, "team"); team; team = team->next) {
|
||||
teamname = ezxml_attr(team, "name");
|
||||
for (driver = ezxml_child(team, "driver"); driver; driver = driver->next) {
|
||||
printf("%s, %s: %s\n", ezxml_child(driver, "name")->txt, teamname,
|
||||
ezxml_child(driver, "points")->txt);
|
||||
}
|
||||
}
|
||||
ezxml_free(f1);
|
||||
|
||||
Alternately, the following would print out the name of the second driver on the
|
||||
first team:
|
||||
|
||||
ezxml_t f1 = ezxml_parse_file("formula1.xml");
|
||||
|
||||
printf("%s\n", ezxml_get(f1, "team", 0, "driver", 1, "name", -1)->txt);
|
||||
ezxml_free(f1);
|
||||
|
||||
The -1 indicates the end of the argument list. That's pretty much all
|
||||
there is to it. Complete API documentation can be found in ezxml.h.
|
||||
|
||||
Known Limitations
|
||||
|
||||
- ezXML is not a validating parser
|
||||
|
||||
- Loads the entire XML document into memory at once and does not allow for
|
||||
documents to be passed in a chunk at a time. Large XML files can still be
|
||||
handled though through ezxml_parse_file() and ezxml_parse_fd(), which use mmap
|
||||
to map the file to a virtual address space and rely on the virtual memory
|
||||
system to page in data as needed.
|
||||
|
||||
- Does not currently recognize all possible well-formedness errors. It should
|
||||
correctly handle all well-formed XML documents and will either ignore or halt
|
||||
XML processing on well-formedness errors. More well-formedness checking will
|
||||
be added in subsiquent releases.
|
||||
|
||||
- In making the character content of tags easy to access, there is no way
|
||||
provided to keep track of the location of sub tags relative to the character
|
||||
data. Example:
|
||||
|
||||
<doc>line one<br/>
|
||||
line two</doc>
|
||||
|
||||
The character content of the doc tag is reported as "line one\nline two", and
|
||||
<br/> is reported as a sub tag, but the location of <br/> within the
|
||||
character data is not. The function ezxml_toxml() will convert an ezXML
|
||||
structure back to XML with sub tag locations intact.
|
||||
|
||||
Licensing
|
||||
|
||||
ezXML was written by Aaron Voisine <aaron@voisine.org> and is distributed under
|
||||
the terms of the MIT license, described in license.txt.
|
||||
20
tools/sboot-03/src/ezxml/license.txt
Normal file
20
tools/sboot-03/src/ezxml/license.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright 2004-2006 Aaron Voisine <aaron@voisine.org>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
3
tools/sboot-03/src/ezxml/test.c
Normal file
3
tools/sboot-03/src/ezxml/test.c
Normal file
@@ -0,0 +1,3 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
19
tools/sboot-03/src/ezxml/test.prj
Normal file
19
tools/sboot-03/src/ezxml/test.prj
Normal file
@@ -0,0 +1,19 @@
|
||||
;>>>>>>> DEFAULT.PRJ for use with single module programs <<<<<<<<
|
||||
|
||||
ezxml.ttp ; name of executable program is topmost window
|
||||
|
||||
.C
|
||||
.L
|
||||
|
||||
= ; list of modules follows...
|
||||
PCSTART.O ; startup code
|
||||
test.c
|
||||
|
||||
;PCBGILIB.LIB ; BGI library
|
||||
PCFLTLIB.LIB ; floating point library
|
||||
PCSTDLIB.LIB ; standard library
|
||||
|
||||
PCEXTLIB.LIB ; extended library
|
||||
PCTOSLIB.LIB ; TOS library
|
||||
PCGEMLIB.LIB ; AES and VDI library
|
||||
ezxml.lib
|
||||
1
tools/sboot-03/src/ezxml/test.xml
Normal file
1
tools/sboot-03/src/ezxml/test.xml
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0"?>
|
||||
160
tools/sboot-03/src/gfx.c
Normal file
160
tools/sboot-03/src/gfx.c
Normal file
@@ -0,0 +1,160 @@
|
||||
#include <vdi.h>
|
||||
#include <tos.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "gfx.h"
|
||||
|
||||
extern short vdih;
|
||||
|
||||
|
||||
/* calculate MFDB compatible rowstride (in number of bits) */
|
||||
#define MFDB_STRIDE( w ) (((w & 15) != 0) ? (w | 15)+1 : w)
|
||||
|
||||
/*
|
||||
Calculate size of an mfdb, params:
|
||||
Bits per pixel,
|
||||
Word aligned rowstride (width) as returned by MFDB_STRIDE,
|
||||
height in pixels
|
||||
*/
|
||||
#define MFDB_SIZE( bpp, stride, h ) ( ((stride >> 3) * h) * bpp )
|
||||
|
||||
/* Flags for init_mfdb function: */
|
||||
#define MFDB_FLAG_STAND 0x01
|
||||
#define MFDB_FLAG_ZEROMEM 0x02
|
||||
#define MFDB_FLAG_NOALLOC 0x04
|
||||
|
||||
#ifndef WITHOUT_GFX
|
||||
static int logo_img[] = {
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x03c0,0x3018,0x0300,0xfe01,0x8003,0xfc00,
|
||||
0x0000,0x3f00,0x01f0,0x000f,0x800f,0xff00,0x0000,0x07e0,
|
||||
0x301c,0x0700,0xff01,0x8003,0xfc00,0x0000,0x3f80,0x07fc,
|
||||
0x003f,0xe00f,0xff00,0x0000,0x0c28,0x321e,0x8f20,0xcba1,
|
||||
0x8803,0x2a80,0x0000,0x32e0,0x0e0e,0x0070,0xf800,0xeaa0,
|
||||
0x0000,0x0c54,0x311f,0x5f50,0xc5d1,0x9003,0x1540,0x0000,
|
||||
0x31d0,0x1c57,0x40e1,0x7c00,0x7550,0x0000,0x0e82,0x321b,
|
||||
0xbba0,0xcba9,0x8803,0x2000,0x0000,0x33e8,0x18a3,0xa0c2,
|
||||
0x1e00,0x6200,0x0000,0x0740,0x3119,0xf350,0xff11,0x9003,
|
||||
0xfc00,0x0000,0x3f54,0x3141,0xd184,0x0d00,0x6400,0x0000,
|
||||
0x03e0,0x3218,0xe3a0,0xfe29,0x8803,0xfc00,0x0000,0x3fe8,
|
||||
0x3081,0xa988,0x0c80,0x6200,0x0000,0x01f0,0x3119,0xf310,
|
||||
0xc551,0x9003,0x1540,0x0000,0x31d0,0x3101,0x9190,0x0c40,
|
||||
0x6400,0x0000,0x0078,0x3218,0xcb20,0xcaa1,0x8803,0x2a80,
|
||||
0x3e00,0x32e8,0x3201,0x8988,0x0c80,0x6200,0x0000,0x0034,
|
||||
0x3119,0x0710,0xc401,0x9003,0x1000,0x3e00,0x3164,0x1903,
|
||||
0x90d0,0x1c40,0x6400,0x0000,0x0832,0x3218,0x8320,0xc801,
|
||||
0x8803,0x2000,0x02a0,0x3262,0x1e07,0x08e8,0x3880,0x6200,
|
||||
0x0000,0x0c71,0x3119,0x0310,0xc401,0x9003,0x1000,0x0140,
|
||||
0x31e4,0x0f0e,0x1074,0x7140,0x6400,0x0000,0x0fe2,0x3218,
|
||||
0x8320,0xc801,0xfe03,0xfc00,0x0000,0x3fc2,0x07fc,0x203f,
|
||||
0xe280,0x6200,0x0000,0x07c5,0x3119,0x0310,0xc401,0xfe03,
|
||||
0xfc00,0x0000,0x3f84,0x01f0,0x400f,0x8500,0x6400,0x0000,
|
||||
0x00aa,0x0200,0x8020,0x0800,0x0aa0,0x2a80,0x0000,0x02a8,
|
||||
0x002a,0x8002,0xaa00,0x0200,0x0000,0x0054,0x0101,0x0010,
|
||||
0x0400,0x1540,0x1540,0x0000,0x0150,0x0015,0x0000,0x5000,
|
||||
0x0400,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0112,0x4955,0x56db,0x6eff,0xffff,
|
||||
0xffff,0xffff,0xff00,0x0000,0x0000,0x0000,0x0004,0x92aa,
|
||||
0xda49,0x2aaa,0xa955,0xb592,0xaadb,0x7fff,0xffff,0xffa0,
|
||||
0x0000,0x0000,0x0000,0x4948,0x4912,0x24aa,0xd525,0x5aaa,
|
||||
0xab6d,0x776e,0xd56e,0xffff,0xff40,0x0000,0x0000,0x0012,
|
||||
0x0022,0x0044,0x8524,0x92d5,0x56db,0x5dbf,0xbbbb,0xfff7,
|
||||
0xdfff,0xffa0,0x0000,0x0000,0x0100,0x2481,0x2a22,0x5252,
|
||||
0x4a5a,0xa955,0xb552,0xdb77,0x6edf,0xf6ff,0xff40,0x0000
|
||||
};
|
||||
|
||||
/* real dim: 194 * 24 */
|
||||
/* BITBLK LOGO = {logo_img, 26, 24, 0, 0, 1}; */
|
||||
MFDB LOGO = {
|
||||
logo_img,
|
||||
208,
|
||||
24,
|
||||
208 >> 4,
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
long init_mfdb(int bpp, int w, int h, unsigned long flags, MFDB * out )
|
||||
{
|
||||
long size;
|
||||
short dststride;
|
||||
dststride = MFDB_STRIDE( w );
|
||||
size = MFDB_SIZE( bpp, dststride, h );
|
||||
if( bpp > 0 ) {
|
||||
if( (flags & MFDB_FLAG_NOALLOC) == 0 ) {
|
||||
out->fd_addr = malloc( size );
|
||||
if( out->fd_addr == 0 ){
|
||||
return( 0 );
|
||||
}
|
||||
if( (flags & MFDB_FLAG_ZEROMEM) ){
|
||||
memset( out->fd_addr, 0, size );
|
||||
}
|
||||
}
|
||||
out->fd_stand = (flags & MFDB_FLAG_STAND) ? 1 : 0;
|
||||
out->fd_nplanes = (short)bpp;
|
||||
out->fd_r1 = out->fd_r2 = out->fd_r3 = 0;
|
||||
} else {
|
||||
memset( out, 0, sizeof(MFDB) );
|
||||
}
|
||||
out->fd_w = dststride;
|
||||
out->fd_h = h;
|
||||
out->fd_wdwidth = dststride >> 4;
|
||||
return( size );
|
||||
}
|
||||
|
||||
void draw_logo( short x, short y )
|
||||
{
|
||||
short c[2] = {1, 0};
|
||||
long size;
|
||||
MFDB screen, tran;
|
||||
short pxy[8];
|
||||
|
||||
init_mfdb( 0, LOGO.fd_w, LOGO.fd_h, 0, &screen );
|
||||
|
||||
size = init_mfdb( 1, LOGO.fd_w, LOGO.fd_h,
|
||||
MFDB_FLAG_NOALLOC, &tran );
|
||||
tran.fd_addr = malloc( size );
|
||||
|
||||
vr_trnfm( vdih, &LOGO, &tran );
|
||||
|
||||
pxy[0] = 0;
|
||||
pxy[1] = 0;
|
||||
pxy[2] = LOGO.fd_w -1;
|
||||
pxy[3] = LOGO.fd_h -1;
|
||||
pxy[4] = x;
|
||||
pxy[5] = y;
|
||||
pxy[6] = x+LOGO.fd_w-1;
|
||||
pxy[7] = y+LOGO.fd_h-1;
|
||||
|
||||
vrt_cpyfm( vdih, MD_TRANS, (short*)&pxy,
|
||||
(MFDB*)&tran, (MFDB*)&screen,
|
||||
(short*)&c
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITHOUT_VDI
|
||||
void print_var( char * desc, short idx )
|
||||
{
|
||||
short laitem = *(short*)(lineavar+idx);
|
||||
printf("%s -> %d\r\n", desc, laitem );
|
||||
}
|
||||
|
||||
|
||||
void linea_info(void)
|
||||
{
|
||||
linea_init_cf();
|
||||
print_var("bpp", LINEA_BYTES_PER_ROW);
|
||||
print_var("h", LINEA_RES_H);
|
||||
print_var("w", LINEA_RES_W);
|
||||
print_var("fh", -0x2e);
|
||||
print_var("pl", 0);
|
||||
print_var("bs", 2);
|
||||
}
|
||||
#else
|
||||
|
||||
#endif
|
||||
11
tools/sboot-03/src/gfx.h
Normal file
11
tools/sboot-03/src/gfx.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef GFX_H
|
||||
#define GFX_H
|
||||
|
||||
|
||||
#include "linea.h"
|
||||
|
||||
void draw_logo( short, short );
|
||||
void linea_info(void);
|
||||
|
||||
|
||||
#endif
|
||||
240
tools/sboot-03/src/gui.c
Normal file
240
tools/sboot-03/src/gui.c
Normal file
@@ -0,0 +1,240 @@
|
||||
#include <tos.h>
|
||||
#include <vdi.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ext.h>
|
||||
#include <screen.h>
|
||||
|
||||
#include "gfx.h"
|
||||
#include "gui.h"
|
||||
|
||||
#ifdef WITHOUT_VDI
|
||||
# ifndef WITHOUT_GFX
|
||||
# error "GFX without VDI currently unsupported!"
|
||||
# endif
|
||||
#else
|
||||
static short old_bgcolor[3];
|
||||
static short old_fgcolor[3];
|
||||
static short old_rez = -1;
|
||||
static short medres = 0;
|
||||
#endif
|
||||
|
||||
short vdih;
|
||||
short vdiph;
|
||||
short vdivh;
|
||||
short workin[16];
|
||||
short workout[58];
|
||||
|
||||
/* textmode resolution: */
|
||||
short c_rows;
|
||||
short c_cols;
|
||||
|
||||
short cell_h = 16;
|
||||
short cell_w = 8;
|
||||
|
||||
short res_w;
|
||||
short res_h;
|
||||
|
||||
void * screen;
|
||||
short screen_bpp;
|
||||
long screen_ncolors;
|
||||
|
||||
static short appl_id;
|
||||
|
||||
extern void die(char *);
|
||||
|
||||
static short linea_word( short idx )
|
||||
{
|
||||
return( *(short*)(lineavar+idx) );
|
||||
}
|
||||
|
||||
|
||||
void textxy(short x, short y, short inv, char * str)
|
||||
{
|
||||
if( inv ) {
|
||||
Rev_on();
|
||||
}
|
||||
Goto_pos( y, x );
|
||||
Cconws( str );
|
||||
if( inv ) {
|
||||
Rev_off();
|
||||
}
|
||||
}
|
||||
|
||||
void fillspace(short x, short y, short w, short black)
|
||||
{
|
||||
short n = w;
|
||||
char mem[1024];
|
||||
char * line = (char*)&mem;
|
||||
n = ( n > 1023 ) ? 1023 : n;
|
||||
memset( line, ' ', n );
|
||||
line[n] = 0;
|
||||
textxy( x, y, black, line );
|
||||
}
|
||||
|
||||
void draw_title( char * txt )
|
||||
{
|
||||
|
||||
char spare[255];
|
||||
#ifndef WITHOUT_GFX /* Grahic support enabled? */
|
||||
txt = txt;
|
||||
textxy( 26, 1, 0, VERSION );
|
||||
sprintf(spare, "%dx%d@%d", res_w, res_h, screen_bpp );
|
||||
textxy( c_cols-(strlen((char*)&spare)+4), 0, 1, (char*)&spare );
|
||||
draw_logo( 0, 0 );
|
||||
#else
|
||||
fillspace(0, 0, c_cols, 1);
|
||||
if( txt == NULL ) {
|
||||
textxy( 1, 0, 1, "ColdBoot " VERSION );
|
||||
sprintf(spare, "%dx%d@%d", res_w, res_h, screen_bpp );
|
||||
textxy( c_cols-(strlen((char*)&spare)+4), 0, 1, (char*)&spare );
|
||||
} else {
|
||||
textxy( 1, 0, 1, txt );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void draw_info( char * txt )
|
||||
{
|
||||
fillspace( 0, c_rows-1, c_cols, 1);
|
||||
textxy( 0, c_rows-1, 1, txt );
|
||||
}
|
||||
|
||||
void clear_workarea( void ){
|
||||
int i;
|
||||
for( i=1; i<c_rows-1; i++ ){
|
||||
fillspace(0, i, c_cols, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void exit_proc( void )
|
||||
{
|
||||
appl_exit( appl_id );
|
||||
#ifndef WITHOUT_VDI
|
||||
vs_color( vdih, 0, old_bgcolor );
|
||||
vs_color( vdih, 1, old_fgcolor );
|
||||
if ( old_rez == 0 && medres == 1 ) {
|
||||
Setscreen( -1, -1, 0 );
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_gui( void )
|
||||
{
|
||||
|
||||
short i = 0;
|
||||
|
||||
|
||||
#ifdef WITHOUT_VDI
|
||||
vdih = 0;
|
||||
vdiph = 0;
|
||||
vdivh = 0;
|
||||
#ifdef __COLDFIRE__
|
||||
linea_init_cf();
|
||||
#else
|
||||
linea_init();
|
||||
if( Getrez() == 0 ){
|
||||
Setscreen( -1, -1, 1 );
|
||||
if( Getrez() == 1 ) {
|
||||
medres = 1;
|
||||
old_rez = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
cell_h = linea_word( LINEA_CELL_H );
|
||||
res_w = linea_word( LINEA_RES_W );
|
||||
res_h = linea_word( LINEA_RES_H );
|
||||
c_rows = res_h / cell_h;
|
||||
c_cols = res_w / cell_w;
|
||||
screen_bpp = linea_word( LINEA_PLANES );
|
||||
#else
|
||||
|
||||
short bgcolor[3] = { 0, 0, 0};
|
||||
short fgcolor[3] = { 0, 0, 1000 };
|
||||
medres = 0;
|
||||
/* looks like we need LineA to inquire screen char cells: */
|
||||
linea_init();
|
||||
if( Getrez() == 0 ){
|
||||
Setscreen( -1, -1, 1 );
|
||||
if( Getrez() == 1 ) {
|
||||
medres = 1;
|
||||
old_rez = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for( i=1; i< 10; i++)
|
||||
workin[i]=1;
|
||||
workin[0] = 1;
|
||||
workin[10] = 2;
|
||||
appl_id = appl_init();
|
||||
if( appl_id == -1 ) {
|
||||
v_opnwk( workin, (short*)&vdiph, workout );
|
||||
if( vdiph == 0 ) {
|
||||
printf("Error opening Physical VDI Workstation");
|
||||
}
|
||||
vdih = vdiph;
|
||||
} else {
|
||||
v_opnvwk( workin, (short*)&vdivh, workout );
|
||||
if( vdivh == 0 ) {
|
||||
die("Error opening Virtual VDI Workstation");
|
||||
}
|
||||
vdih = vdivh;
|
||||
atexit( exit_proc );
|
||||
}
|
||||
res_w = workout[0]+1;
|
||||
res_h = workout[1]+1;
|
||||
screen_ncolors = workout[13];
|
||||
if( 1 ) {
|
||||
cell_h = linea_word( LINEA_CELL_H );
|
||||
res_w = linea_word( LINEA_RES_W );
|
||||
res_h = linea_word( LINEA_RES_H );
|
||||
c_rows = res_h / cell_h;
|
||||
c_cols = res_w / cell_w;
|
||||
screen_bpp = linea_word( LINEA_PLANES );
|
||||
} else {
|
||||
/* looks like this doesn't work on plain ST: */
|
||||
vq_chcells( vdih, &c_rows, &c_cols );
|
||||
}
|
||||
vq_color( vdih, 0, 1, old_bgcolor );
|
||||
vq_color( vdih, 1, 1, old_fgcolor );
|
||||
vs_color( vdih, 0, bgcolor );
|
||||
vs_color( vdih, 1, fgcolor );
|
||||
#endif
|
||||
/*
|
||||
sprintf(spare, "c: %d, r: %d, x: %d, y: %d, stride: %d", c_cols, c_rows,
|
||||
res_w, res_h, linea_word( LINEA_BYTES_PER_ROW )
|
||||
);
|
||||
Cconws( spare );
|
||||
*/
|
||||
/*getch();*/
|
||||
/* Bildschirm loeschen und standard Werte setzen: */
|
||||
for( i=0; i<c_rows; i++ ){
|
||||
fillspace(0, i, c_cols, 0);
|
||||
}
|
||||
Cur_home();
|
||||
}
|
||||
|
||||
void exit_gui(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
short getkey( char * shift, short * keycode, char * ascii )
|
||||
{
|
||||
long in = Cnecin();
|
||||
*ascii = (in & 0xFF);
|
||||
*keycode = ((in & 0xFF0000L)>>8);
|
||||
*shift = ((in & 0xFF000000L)>>24);
|
||||
if( (in & 0xFF) == 0 ){
|
||||
in = ( (in & 0xFF0000L)>>8 );
|
||||
} else {
|
||||
in = (char)(in & 0xFF);
|
||||
}
|
||||
return( (short)in );
|
||||
}
|
||||
34
tools/sboot-03/src/gui.h
Normal file
34
tools/sboot-03/src/gui.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef GUI_H
|
||||
#define GUI_H
|
||||
|
||||
#define VERSION "0.2 - " __DATE__
|
||||
|
||||
extern short vdih;
|
||||
extern short vdiph;
|
||||
extern short vdivh;
|
||||
extern short workin[16];
|
||||
extern short workout[58];
|
||||
|
||||
/* textmode resolution: */
|
||||
extern short c_rows;
|
||||
extern short c_cols;
|
||||
|
||||
extern short cell_h;
|
||||
extern short cell_w;
|
||||
|
||||
extern short res_w;
|
||||
extern short res_h;
|
||||
|
||||
extern void * screen;
|
||||
extern short screen_bpp;
|
||||
|
||||
void init_gui( void );
|
||||
void textxy(short x, short y, short inv, char * str);
|
||||
void fillspace(short x, short y, short w, short black);
|
||||
void draw_title( char * txt );
|
||||
void draw_info( char * txt );
|
||||
void clear_workarea( void );
|
||||
short getkey( char * shift, short * keycode, char * ascii );
|
||||
|
||||
|
||||
#endif
|
||||
BIN
tools/sboot-03/src/image.rsc
Normal file
BIN
tools/sboot-03/src/image.rsc
Normal file
Binary file not shown.
4
tools/sboot-03/src/image.rsh
Normal file
4
tools/sboot-03/src/image.rsh
Normal file
@@ -0,0 +1,4 @@
|
||||
/* Resource C-Header-File v1.97 f<>r ResourceMaster ab v2.06 by ARDISOFT */
|
||||
|
||||
#define LOGO 0 /* form/dial */
|
||||
#define LOGO_TWOPLANES 1 /* IMAGE in tree LOGO */
|
||||
9
tools/sboot-03/src/image.rsm
Normal file
9
tools/sboot-03/src/image.rsm
Normal file
@@ -0,0 +1,9 @@
|
||||
ResourceMaster v3.65
|
||||
#C 1@0@0@0@
|
||||
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
|
||||
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
|
||||
#R 0@0@1@1@1@1@
|
||||
#M 20010100@17741@7728@505@
|
||||
#T 0@2@LOGO@@2@@
|
||||
#O 1@23@TWOPLANES@@
|
||||
#c 27400@
|
||||
23
tools/sboot-03/src/keys.h
Normal file
23
tools/sboot-03/src/keys.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef KEYS_H
|
||||
#define KEYS_H
|
||||
|
||||
/* scancodes: */
|
||||
#define F11_BASE (84<<8)
|
||||
#define F1_BASE (59<<8)
|
||||
#define F1 (59<<8)
|
||||
#define F2 (60<<8)
|
||||
#define F3 (61<<8)
|
||||
#define CURS_UP (72<<8)
|
||||
#define CURS_DOWN (80<<8)
|
||||
#define CURS_RIGHT (77<<8)
|
||||
#define CURS_LEFT (75<<8)
|
||||
#define BACKSPACE 0x0E00
|
||||
#define CURS_S_UP 0x4838
|
||||
#define CURS_S_DOWN 0x5032
|
||||
#define CTRL_S 0x1F00
|
||||
#define HELP 0x6200
|
||||
#define ESC 0x100
|
||||
#define ENTER (13<<8)
|
||||
#define RETURN (13<<8)
|
||||
|
||||
#endif
|
||||
16
tools/sboot-03/src/linea.h
Normal file
16
tools/sboot-03/src/linea.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef LINEA_H
|
||||
#define LINEA_H
|
||||
|
||||
|
||||
#define LINEA_BYTES_PER_ROW -2
|
||||
#define LINEA_RES_W -0x0C
|
||||
#define LINEA_RES_H -0x04
|
||||
#define LINEA_PLANES 0
|
||||
#define LINEA_CELL_H -0x02E
|
||||
|
||||
extern long lineavar;
|
||||
|
||||
void cdecl linea_init(void);
|
||||
void cdecl linea_init_cf(void);
|
||||
|
||||
#endif
|
||||
38
tools/sboot-03/src/linea.s
Normal file
38
tools/sboot-03/src/linea.s
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
GLOBL linea_init
|
||||
GLOBL linea_init_cf
|
||||
GLOBL lineavar
|
||||
|
||||
.text
|
||||
|
||||
;linea_initXY:
|
||||
; movem.l d0-d2/a0-a2,-(A7)
|
||||
; dc.w $A000
|
||||
; move.l a0,lineavar
|
||||
; movem.l (sp)+,d0-d2,a0-a2
|
||||
; rts
|
||||
|
||||
|
||||
linea_init:
|
||||
lea -24(sp),sp
|
||||
movem.l d0-d2/a0-a2,(sp)
|
||||
dc.w $A000
|
||||
move.l a0,lineavar
|
||||
movem.l (sp),d0-d2/a0-a2
|
||||
lea 24(sp),sp
|
||||
rts
|
||||
|
||||
linea_init_cf:
|
||||
lea -24(sp),sp
|
||||
movem.l d0-d2/a0-a2,(sp)
|
||||
dc.w $A920
|
||||
move.l a0,lineavar
|
||||
movem.l (sp),d0-d2/a0-a2
|
||||
lea 24(sp),sp
|
||||
rts
|
||||
|
||||
|
||||
.data
|
||||
|
||||
lineavar:
|
||||
ds.l 1
|
||||
1187
tools/sboot-03/src/main.c
Normal file
1187
tools/sboot-03/src/main.c
Normal file
File diff suppressed because it is too large
Load Diff
1
tools/sboot-03/src/main.h
Normal file
1
tools/sboot-03/src/main.h
Normal file
@@ -0,0 +1 @@
|
||||
void draw_list_header( void );
|
||||
1
tools/sboot-03/src/pc.prj
Normal file
1
tools/sboot-03/src/pc.prj
Normal file
@@ -0,0 +1 @@
|
||||
;************************************************************
|
||||
367
tools/sboot-03/src/script.c
Normal file
367
tools/sboot-03/src/script.c
Normal file
@@ -0,0 +1,367 @@
|
||||
#include <tos.h>
|
||||
#include <vdi.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "script.h"
|
||||
|
||||
static short echo_off = 1;
|
||||
|
||||
static void scripterror( char * msg )
|
||||
{
|
||||
printf( "Error: %s\n", msg );
|
||||
printf("Press any key to continue\n");
|
||||
getch();
|
||||
}
|
||||
|
||||
static int isspace( unsigned char x ) {
|
||||
|
||||
int ret = 0;
|
||||
|
||||
if( (x > 0 && x <= 0x20) || x == 255 ){
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
return( ret );
|
||||
}
|
||||
|
||||
static char * strstrip( char * s )
|
||||
{
|
||||
long size;
|
||||
char * end;
|
||||
|
||||
size = strlen( s );
|
||||
if(!size){
|
||||
return( s );
|
||||
}
|
||||
|
||||
end = s + size;
|
||||
while( end >= s && isspace(*end) )
|
||||
end--;
|
||||
if( end <= (s + size) )
|
||||
*end = '\0';
|
||||
|
||||
while( *s && isspace(*s) )
|
||||
s++;
|
||||
return( s );
|
||||
}
|
||||
|
||||
static char * getline( char ** curpos )
|
||||
{
|
||||
char * start;
|
||||
char * end;
|
||||
static char line[SCRIPT_MAX_LEN+1];
|
||||
start = *curpos;
|
||||
|
||||
if( *start == 0 ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
end = strpbrk( start, "\r\n" );
|
||||
if( end == NULL ) {
|
||||
end = (start + strlen(start));
|
||||
if( end == start ) {
|
||||
return( NULL );
|
||||
}
|
||||
}
|
||||
if( end < start ) {
|
||||
printf("getline: end < start!?\n");
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if( (end-start) > 0 ){
|
||||
memcpy( line, start, end-start );
|
||||
}
|
||||
|
||||
line[end-start]=0;
|
||||
*curpos += (end-start)+1;
|
||||
return( strstrip( line ) );
|
||||
|
||||
}
|
||||
|
||||
static long copy_file( char * src, char * dst)
|
||||
{
|
||||
long count;
|
||||
int srcf,dstf;
|
||||
static buf[8192];
|
||||
|
||||
srcf = Fopen( src, 0 );
|
||||
dstf = Fcreate( dst, 0 );
|
||||
|
||||
if( srcf < 0 || dstf < 0 ){
|
||||
if( srcf > 0)
|
||||
Fclose( srcf );
|
||||
if( dstf > 0 )
|
||||
Fclose( srcf );
|
||||
return( -2 );
|
||||
}
|
||||
|
||||
count = Fread( srcf, 8192, &buf );
|
||||
if( count > 0 ){
|
||||
do{
|
||||
Fwrite(dstf, count, &buf );
|
||||
count = Fread( srcf, 8192, &buf);
|
||||
}while( count > 0 );
|
||||
}
|
||||
|
||||
Fclose(dstf);
|
||||
Fclose(srcf);
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static long exec_rewrite_cmd(char * line)
|
||||
{
|
||||
long len_needle = -1;
|
||||
long len_repl = -1;
|
||||
FILE * fh;
|
||||
FILE * tmpfh;
|
||||
char * linebuf;
|
||||
char * linebuf2;
|
||||
char * needle;
|
||||
char * curchar;
|
||||
char * curchar2;
|
||||
char found = 0;
|
||||
|
||||
char *arg1;
|
||||
char *arg2;
|
||||
char *arg3;
|
||||
|
||||
arg1 = strstrip(line); /* filename */
|
||||
if(arg1 == NULL) {
|
||||
scripterror("Invalid Arguments!\n");
|
||||
return(-1000);
|
||||
}
|
||||
|
||||
arg2 = strchr(arg1, ' '); /* needle */
|
||||
if(arg2 == NULL) {
|
||||
scripterror("Invalid Arguments!\n");
|
||||
return(-1000);
|
||||
}
|
||||
|
||||
arg3 = strchr(arg2+1, ' '); /* replacement */
|
||||
if(arg3 == NULL) {
|
||||
scripterror("Invalid Arguments!\n");
|
||||
return(-1000);
|
||||
}
|
||||
|
||||
*arg2 = 0;
|
||||
arg2++;
|
||||
arg2 = strstrip( arg2 );
|
||||
|
||||
*arg3 = 0;
|
||||
arg3++;
|
||||
|
||||
arg3 = strstrip( arg3 );
|
||||
/*
|
||||
printf("Replacing line containing %s with %s in %s\n",
|
||||
arg2, arg3, arg1
|
||||
);
|
||||
*/
|
||||
len_needle = strlen(arg2);
|
||||
len_repl = strlen(arg3);
|
||||
|
||||
/* keep the original string: */
|
||||
needle = malloc(len_needle+1);
|
||||
|
||||
strcpy(needle, arg2);
|
||||
strlwr(needle);
|
||||
|
||||
if( len_needle < 3 || len_repl < 3 ){
|
||||
scripterror("Invalid Argument lenght, each string must be at least 3 chracters long!\n");
|
||||
return(-1001);
|
||||
}
|
||||
|
||||
/* read file, line by line */
|
||||
/* foreach line */
|
||||
/* when line contains needle */
|
||||
/* write replacement */
|
||||
/* else */
|
||||
/* write orignal data */
|
||||
|
||||
fh = fopen(arg1, "rb");
|
||||
if(!fh){
|
||||
scripterror("Could not open input file!\n");
|
||||
return(-1002);
|
||||
}
|
||||
tmpfh = fopen("rewrite.tmp", "wb");
|
||||
if(!tmpfh){
|
||||
scripterror("Could not open output temp. file!\n");
|
||||
return(-1003);
|
||||
}
|
||||
|
||||
linebuf = malloc(2048);
|
||||
linebuf2 = malloc(2048);
|
||||
while (feof(fh) == 0){
|
||||
fgets(linebuf, 2048, fh);
|
||||
strcpy(linebuf2, linebuf);
|
||||
strlwr(linebuf);
|
||||
if(strstr(linebuf, needle) != NULL){
|
||||
curchar = linebuf;
|
||||
curchar2 = linebuf2;
|
||||
while(*curchar != 0){
|
||||
if(strstr(curchar, needle) == curchar) {
|
||||
fwrite(arg3, len_repl, 1, tmpfh);
|
||||
curchar += len_needle;
|
||||
curchar2 += len_needle;
|
||||
} else {
|
||||
fputc(*curchar2, tmpfh);
|
||||
curchar++;
|
||||
curchar2++;
|
||||
}
|
||||
}
|
||||
found = 1;
|
||||
} else {
|
||||
fwrite(linebuf2, strlen(linebuf), 1, tmpfh);
|
||||
}
|
||||
}
|
||||
fclose(fh);
|
||||
fclose(tmpfh);
|
||||
|
||||
if(found == 1) {
|
||||
unlink(arg1);
|
||||
copy_file("rewrite.tmp", arg1);
|
||||
}
|
||||
unlink("rewrite.tmp");
|
||||
|
||||
free(needle);
|
||||
free(linebuf);
|
||||
free(linebuf2);
|
||||
#undef MAX_LINE_LEN
|
||||
return(0);
|
||||
}
|
||||
|
||||
static long exec_copy_cmd( char * line )
|
||||
{
|
||||
|
||||
char * arg1 = strstrip(line);
|
||||
char * arg2 = strchr( arg1, ' ' );
|
||||
|
||||
if( arg2 == NULL ){
|
||||
scripterror("Missing second parameter!\n");
|
||||
return(-1000);
|
||||
}
|
||||
*arg2 = 0;
|
||||
arg2++;
|
||||
|
||||
arg2 = strstrip( arg2 );
|
||||
|
||||
if( strlen(arg1) > 2 && strlen(arg2) > 2 ){
|
||||
copy_file( arg1, arg2 );
|
||||
} else {
|
||||
scripterror("Parameters to copy must be at least 3 chartacters long!\n");
|
||||
return( -1001 );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static long exec_set_cmd( char * line ){
|
||||
|
||||
char * arg1 = strstrip(line);
|
||||
char * arg2 = strchr( arg1, ' ' );
|
||||
|
||||
if( strlen(line) <= 1 || arg1 == NULL ) {
|
||||
scripterror("Missing first parameter!");
|
||||
return(-1000);
|
||||
}
|
||||
|
||||
if( arg2 == NULL ){
|
||||
scripterror("Missing second parameter!");
|
||||
return(-1000);
|
||||
}
|
||||
*arg2 = 0;
|
||||
arg2++;
|
||||
|
||||
arg2 = strstrip( arg2 );
|
||||
|
||||
if( strlen(arg1) >= 2 && strlen(arg2) >= 2 ){
|
||||
if( strncmp(arg1, "echo", 4) == 0 ) {
|
||||
if( strncmp(arg2, "on", 2) == 0 ){
|
||||
echo_off = 0;
|
||||
}
|
||||
if( strncmp(arg2, "off", 3) == 0){
|
||||
echo_off = 1;
|
||||
}
|
||||
printf("echo is now %s\n", ( echo_off==1) ? "off" : "on" );
|
||||
}
|
||||
} else {
|
||||
scripterror("Invalid parameters passed to set!\n");
|
||||
return( -1001 );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static long exec_pause_cmd( char * line ){
|
||||
|
||||
char * arg1 = strstrip(line);
|
||||
if( strlen(arg1)<=1 ){
|
||||
printf("Press any key to continue...\n");
|
||||
} else {
|
||||
printf( "%s\n", arg1 );
|
||||
}
|
||||
getch();
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static long exec_echo_cmd( char * line ){
|
||||
|
||||
char * arg1 = strstrip(line);
|
||||
printf( "%s\n", arg1 );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static void parse_line( char * line ){
|
||||
|
||||
long len;
|
||||
|
||||
len = strlen( line ) ;
|
||||
|
||||
if( len < 1 ) {
|
||||
return;
|
||||
}
|
||||
if( strchr(line, '#') == line ){
|
||||
return;
|
||||
}
|
||||
|
||||
if( echo_off == 0 )
|
||||
printf("%s\n", line );
|
||||
|
||||
if( strncmp( line, "copy", 4) == 0 ) {
|
||||
exec_copy_cmd( line+4 );
|
||||
}
|
||||
else if( strncmp( line, "pause", 5) == 0 ) {
|
||||
exec_pause_cmd( line+5 );
|
||||
}
|
||||
else if( strncmp( line, "echo", 4) == 0 ) {
|
||||
exec_echo_cmd( line+4 );
|
||||
}
|
||||
else if( strncmp( line, "set", 3) == 0 ) {
|
||||
exec_set_cmd( line+3 );
|
||||
}
|
||||
else if( strncmp( line, "rewrite", 7) == 0 ) {
|
||||
exec_rewrite_cmd( line+7 );
|
||||
}
|
||||
}
|
||||
|
||||
static char script_copy[SCRIPT_MAX_LEN+1];
|
||||
long execute_script( char * script_in )
|
||||
{
|
||||
char ** curline;
|
||||
char * line;
|
||||
|
||||
*curline=&script_copy[0];
|
||||
|
||||
strncpy( script_copy, script_in, SCRIPT_MAX_LEN );
|
||||
script_copy[SCRIPT_MAX_LEN]=0;
|
||||
|
||||
while( strlen(*curline) > 0 && (line=getline(curline)) != NULL ) {
|
||||
if( strlen(line) > 0 ) {
|
||||
parse_line( line );
|
||||
}
|
||||
}
|
||||
return( 0 );
|
||||
}
|
||||
9
tools/sboot-03/src/script.h
Normal file
9
tools/sboot-03/src/script.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef SCRIPT_H
|
||||
#define SCRIPT_H
|
||||
|
||||
#define SCRIPT_MAX_LEN 4095
|
||||
|
||||
|
||||
long execute_script( char * script_in );
|
||||
|
||||
#endif
|
||||
30
tools/sboot-03/src/sets.c
Normal file
30
tools/sboot-03/src/sets.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <tos.h>
|
||||
#include <vdi.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sets.h"
|
||||
#include "ezxml/ezxml.h"
|
||||
|
||||
extern ezxml_t ezxmlh;
|
||||
|
||||
ezxml_t get_set_by_pos( short pos )
|
||||
{
|
||||
ezxml_t lset, res;
|
||||
char * tpos;
|
||||
|
||||
res = NULL;
|
||||
|
||||
for( lset = ezxml_child(ezxmlh, "set"); lset; lset = lset->next){
|
||||
tpos = (char*)ezxml_attr(lset, "pos");
|
||||
if( tpos != NULL ) {
|
||||
if( ((short)atoi(tpos)) == pos ) {
|
||||
res = lset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return( res );
|
||||
}
|
||||
11
tools/sboot-03/src/sets.h
Normal file
11
tools/sboot-03/src/sets.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <tos.h>
|
||||
#include <vdi.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ezxml/ezxml.h"
|
||||
|
||||
ezxml_t load_set( short idx );
|
||||
ezxml_t get_set_by_pos( short pos );
|
||||
3
tools/sboot-03/src/strings.h
Normal file
3
tools/sboot-03/src/strings.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#ifndef STRINGS_H
|
||||
|
||||
#endif
|
||||
BIN
tools/sboot-03/v4e/sboot.prg
Normal file
BIN
tools/sboot-03/v4e/sboot.prg
Normal file
Binary file not shown.
Reference in New Issue
Block a user