gdi3 part 1

This commit is contained in:
Ulf Gebhardt 2011-10-18 10:28:57 +02:00
parent 872d69dbfc
commit a4698ce5dc
1223 changed files with 357950 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,44 @@
.data
a = 15
b = 3
start:
push 0x0FFFFF #stackmarker
movl $a, %eax # eax = a
movl $b, %ebx # ebx = b
mul_agy:
if(%ebx == 0) #anker
jmp sum_stack #sum and print
movl %ebx, %ecx # copy current b
and 0x000001 %ecx # %ecx = 0(gerade) / 1(ungerade)
if(%ecx == 1) # falls ungerade (use flags)
push %eax # stack a
shll $1, %eax # a << 1
shrl $1, %ebx # b >> 1
jmp agy
sum_stack:
pop %eax
xor %edx, %edx # 0
movl %eax, %ebx
and 0x0FFFFF, %ebx
if(%ebx != 0x0FFFFF)
add %eax, %edx
jmp sum_stack
movl %edx, %eax #write back
#Anmerkung: Es geht auch in einer Funktion via Rekursion, allerdings hab ich das noch nicht überlegt. Dann ist kein stack marker mehr notwendig

23
ws2010/gdi3/p1/A3.txt Normal file
View File

@ -0,0 +1,23 @@
1.
Langsam
2.
Variable1 = Variable1 Xor Variable2
Variable2 = Variable1 Xor Variable2
Variable1 = Variable1 Xor Variable2
movl $a, %eax
movl $b, %ebx
xor %ebx, %eax
xor %eax, %ebx
xor %ebx, %eax
3.
v1 := v1 + v2
v2 := v1 - v2
v1 := v1 - v2

49
ws2010/gdi3/p1/A4.txt Normal file
View File

@ -0,0 +1,49 @@
1.
c-a*b+d/((e%f)-g)/h
(c - (a*b)) + ( (d/((e%f) - g)) / h)
[+]
[-] [/]
[c] [*] [/] [h]
[a][b] [d][-]
[%] [g]
[e][f]
2.
< push
> pop
lr: c a b * - d e f % g - / h / +
rl: h g f e % - d / / b a * c - +
lr: c< a b * >-< d< e f % g - >/ h / >+ : 3x<, 3x>
rl: h< g< f e % >- d / >/< b a * c - >+ : 3x<, 3x>
//lr: c a b * - d e f % / h / +
//rl: h f e % d / / b a * c - +
//lr: c< a b * >-< d< e f % >/ h / >+ : 3x<, 3x>
//rl: h< f e % d / >/< b a * c - >+ : 2x<, 2x>
//lr: c a b * - d e f % g - h / / +
//rl: h g f e % - / d / b a * c - +
//lr: c< a b * >-< d< e f % g - h / >/ >+ : 3x< 3x>
//rl: h< g< f e % >- >/ d /< b a * c - >+ : 3x< 3x>
3. Die RL-Order benötigt nur 4 Stackzugriffe(2x push, 2x pop), während die LR-Order
6 Stackzugriffe benötigt(3x push, 3x pop).
4.
5. interrupt?

72
ws2010/gdi3/p1/MUL.java Normal file
View File

@ -0,0 +1,72 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package praktikum1;
/**
* Klasse um zwei Zahlen auf agyptische Art zu multiplizieren
*/
public class MUL {
/**
* a und b; haben den Standartwert 0
*/
private int a = 0;
private int b = 0;
/**
* Konstruktoren
*/
MUL(){};
MUL(int a, int b){
this.a = a;
this.b = b;
}
/**
* Multipliziert a und b, welche bei Initialisierung des Objekts
* übergeben wurden auf agyptische Art.
*
* @return Ergebniss der Multiplikation
*/
public int mul_agy(){
return mul_agy(a,b);
}
/**
* Multipliziert zwei Zahlen auf
* agyptische Art
*
* @param a Multiplikant a
* @param b Multiplikant b
* @return Ergebniss der Multiplikation
*/
public int mul_agy(int a, int b)
{
if(b == 0){ //Rekursionsanker
return 0;
}
if((b & 0x000001) == 0x000001){ //überprüfe ob die Zahl ungerade ist
return a + mul_agy(a<<1,b>>>1); //in ia32 muss a auf den stack geschoben werden
}
return mul_agy(a<<1,b>>>1); // verwerfe a, da kein divisionsrest
}
/**
* Programm-Einstiegspunkt
*
* @param args the command line arguments
*/
public static void main(String[] args) {
MUL inst = new MUL(2,5); //neues MUL Objekt
System.out.println(inst.mul_agy()); //berechne und gebe Ergebniss aus
}
}

66
ws2010/gdi3/p1/a2.asm Normal file
View File

@ -0,0 +1,66 @@
########################################################################
.data
########################################################################
a: .long -10
b: .long 5
intout: .string "%d"
########################################################################
.text
########################################################################
.global _main # global entry point
.global _mainCRTStartup # debugging 4 msvs/windows
_mainCRTStartup: # do nothing
jmp _main # jump to _main
########################################################################
_main:
movl a, %eax # %eax = a
movl b, %ebx # %ebx = b
call mul_agy # rufe mul_agy auf
jmp _exit # jump to program-end
mul_agy:
cmp $0, %ebx # ist b = 0?
jz mul_agy_ancor # falls 0 springe zu mul_agy_ancor
movl %ebx, %ecx # kopiere b -> c
and $0b000001, %ecx # c = 0(gerade) / 1(ungerade)
cmp $0, %ecx # c = 0 ?
jz mul_agy_even # falls 0 springe zu mul_agy_even
mul_agy_uneven: # merke a, da b ungerade
pushl %eax # a auf den stack
sall $1, %eax # a<<1
shrl $1, %ebx # b>>>1
call mul_agy # rufe mul_agy auf
popl %ecx # hole a von stack und schreibe nach c
add %ecx, %eax # a = a + c
ret # springe in letzte rekursionsstufe
mul_agy_even: # ignoriere a, da b gerade
sall $1, %eax # a<<1
shrl $1, %ebx # b>>>1
call mul_agy # rufe mul_agy auf (oben wurde shcon geshiftet)
ret # springe in letzte rekursionsstufe
mul_agy_ancor:
xor %eax, %eax # %eax = 0;
ret # springe zurück
########################################################################
_exit: # global exit point
pushl %eax # nochmal eine ausgabe von eax
pushl $intout
call _printf
popl %ebx # clear stack
popl %eax # schreibe a in eax
ret

77
ws2010/gdi3/p1/a4.asm Normal file
View File

@ -0,0 +1,77 @@
########################################################################
.data
########################################################################
a: .long 3
b: .long 11
c: .long 67
d: .long 16
e: .long 15
f: .long 2
g: .long 5
h: .long 0
intout: .string "%d"
########################################################################
.text
########################################################################
.global _main # global entry point
.global _mainCRTStartup # debugging 4 msvs/windows
_mainCRTStartup: # do nothing
jmp _main # jump to _main
########################################################################
_main:
pushl c # c to stack # c<
movl a, %eax # load a
movl b, %ebx # load b
imull %ebx, %eax # a*b # a b *
popl %ebx # c from stack # >
subl %eax, %ebx # c - a*b # -
pushl %ebx # c - a*b to stack # <
pushl d # d to stack # d<
cdq # edx = 0 für divison
movl e, %eax # load e
movl f, %ebx # load f
idivl %ebx # e % f # e f %
movl %edx, %eax # rest in %edx
movl g, %ebx # load g
subl %ebx, %eax # e%f - g # g -
popl %ebx # d from stack # >
xchg %ebx, %eax
cdq # edx = 0 für divison
idivl %ebx # d / (e%f - g) # /
movl h, %ebx # load h
cdq # edx = 0 für divison
idivl %ebx # (d/e%f)/h # /
popl %ebx # c - a*b from stack # >
add %ebx, %eax # (c - a*b) + (d/e%f)/h # +
#lr: c< a b * >-< d< e f % g - >/ h / >+ : 3x<, 3x>
jmp _exit # jump to program-end
########################################################################
_exit: # global exit point
pushl %eax # nochmal eine ausgabe von eax
pushl $intout
call _printf
popl %ebx # clear stack
popl %eax # schreibe a in eax
ret

View File

@ -0,0 +1,66 @@
# Ulf Gebhardt, Michael Scholz
.data
# Programm ist mit allen angegebenen Werten getestet. #
a: .long 0
b: .long 56
intout:
.string "Wert %d\n"
.text
.globl main
main:
movl a, %eax # %eax = a
movl b, %ebx # %ebx = b
call mul_agy # rufe mul_agy auf
jmp _exit # jump to program-end
mul_agy:
cmp $0, %ebx # ist b = 0?
jz mul_agy_ancor # falls 0 springe zu mul_agy_ancor
movl %ebx, %ecx # kopiere b -> c
and $0b000001, %ecx # c = 0(gerade) / 1(ungerade)
cmp $0, %ecx # c = 0 ?
jz mul_agy_even # falls 0 springe zu mul_agy_even
mul_agy_uneven: # merke a, da b ungerade
pushl %eax # a auf den stack
sall $1, %eax # a<<1
shrl $1, %ebx # b>>>1
call mul_agy # rufe mul_agy auf
popl %ecx # hole a von stack und schreibe nach c
add %ecx, %eax # a = a + c
ret # springe in letzte rekursionsstufe
mul_agy_even: # ignoriere a, da b gerade
sall $1, %eax # a<<1
shrl $1, %ebx # b>>>1
call mul_agy # rufe mul_agy auf (oben wurde shcon geshiftet)
ret # springe in letzte rekursionsstufe
mul_agy_ancor:
xor %eax, %eax # %eax = 0;
ret # springe zurück
_exit:
# Wert im %eax ausgeben
pushl %eax
pushl $intout
call printf
movl $1, %eax
int $0x80

View File

@ -0,0 +1,78 @@
.data
## Variablen ##
a: .long 3
b: .long 11
c: .long 67
d: .long 16
e: .long 15
f: .long 2
g: .long 5
h: .long -2
intout:
.string "Wert %d\n"
.text
.globl main
main:
pushl c # c to stack
movl a, %eax # load a
movl b, %ebx # load b
imull %ebx, %eax # a*b # a b *
popl %ebx # c from stack # >
subl %eax, %ebx # c - a*b # -
pushl %ebx # c - a*b to stack # <
pushl d # d to stack # d<
cdq # edx = 0 für divison
movl e, %eax # load e
movl f, %ebx # load f
idivl %ebx # e % f # e f %
movl %edx, %eax # rest in %edx
movl g, %ebx # load g
subl %ebx, %eax # e%f - g # g -
popl %ebx # d from stack # >
xchg %ebx, %eax
cdq # edx = 0 für divison
idivl %ebx # d / (e%f - g) # /
movl h, %ebx # load h
cdq # edx = 0 für divison
idivl %ebx # (d/e%f)/h # /
popl %ebx # c - a*b from stack # >
add %ebx, %eax # (c - a*b) + (d/e%f)/h # +
# Wert im %eax ausgeben
pushl %eax
pushl $intout
call printf
##clear stack
popl %ebx
popl %ebx
# Exit
movl $1, %edx
int $0x80

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,72 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package praktikum1;
/**
* Klasse um zwei Zahlen auf agyptische Art zu multiplizieren
*/
public class MUL {
/**
* a und b; haben den Standartwert 0
*/
private int a = 0;
private int b = 0;
/**
* Konstruktoren
*/
MUL(){};
MUL(int a, int b){
this.a = a;
this.b = b;
}
/**
* Multipliziert a und b, welche bei Initialisierung des Objekts
* übergeben wurden auf agyptische Art.
*
* @return Ergebniss der Multiplikation
*/
public int mul_agy(){
return mul_agy(a,b);
}
/**
* Multipliziert zwei Zahlen auf
* agyptische Art
*
* @param a Multiplikant a
* @param b Multiplikant b
* @return Ergebniss der Multiplikation
*/
public int mul_agy(int a, int b)
{
if(b == 0){ //Rekursionsanker
return 0;
}
if((b & 0x000001) == 0x000001){ //überprüfe ob die Zahl ungerade ist
return a + mul_agy(a<<1,b>>>1); //in ia32 muss a auf den stack geschoben werden
}
return mul_agy(a<<1,b>>>1); // verwerfe a, da kein divisionsrest
}
/**
* Programm-Einstiegspunkt
*
* @param args the command line arguments
*/
public static void main(String[] args) {
MUL inst = new MUL(2,5); //neues MUL Objekt
System.out.println(inst.mul_agy()); //berechne und gebe Ergebniss aus
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

82
ws2010/gdi3/p2/1_a.asm Normal file
View File

@ -0,0 +1,82 @@
.data
## !!! GEHT IM MOMENT NUR BIS 2^30. Reicht das??
# Eingaben:
x: .long 2
n: .long 8
# Zu berechnen: x^n
intout:
.string "Wert: %d\n"
.text
.globl main
main:
movl x, %eax # Lade x in %eax
movl x, %ebx
movl n, %ecx # Lade n in %ecx
cmp $0, %ecx # n = 0 ?
je .n_0
jmp .loop_n
.n_0:
movl $1, %eax
jmp .end
.loop_n:
decl %ecx # n - 1
cmp $0, %ecx # n = 0 ? -> Dann fertig
je .end
call .iteration # Unterprogrammaufruf
jmp .loop_n
jmp .end
#Unterprogramm
## ICH ÜBERGEB HIER IMMER NUR %eax ICH WEISS NICHT OB DIE MEHR SEHN WOLLEN; ABER WAS SOLL MAN NOCH ÜBERGEBEN?
## WENN ICH DIE AUSKOMMENTIERTEN TEILE WIEDER REINMACHE GEHT IRGENDWIE NIX MEHR BEI MIR
.iteration:
pushl %ebp # alten Basepointer sichern
#movl %esp, %ebx # neuen Basepointer erzeugen
mull %ebx
popl %ebp # alten Basepointer wiederherstellen
#movl %ebp, %esp # Stackpointer zurücksetzen (alternativ mit "leave")
ret # return
.end:
# Wert im %eax ausgeben
pushl %eax
pushl $intout
call printf
# Exit
movl $1, %eax
int $0x80

128
ws2010/gdi3/p2/1_b.asm Normal file
View File

@ -0,0 +1,128 @@
.data
# Eingaben:
x: .long 2
n: .long 5
# Zu berechnen: x^n
intout:
.string "Ergebnis: %d\n"
.text
.globl main
main:
movl n, %ecx # Lade n in %ecx
cmp $0, %ecx # n = 0 ?
je .n_gleich_0
jmp .n_ungleich_0
# 1. Fall: n = 0 (Trivialfall):
##############################
.n_gleich_0:
############
movl $1, %eax # 1 in Ausgaberegister
jmp .end # zum ende springen
.n_ungleich_0:
and $0x00000001, %ecx # %ecx maskieren
cmp $1, %ecx # n ungerade?
je .n_ungerade # Jump -> n_ungerade
jmp .n_gerade # Jump -> n_gerade
# 2. Fall: n ist ungerade:
#########################
.n_ungerade:
###########
call .unterprogramm # Liefert Ergebnis von x^(n/2)^2 in %eax
movl x, %ebx
call .iteration # * x
jmp .end
# 3. Fall: n ist gerade:
########################
.n_gerade:
#########
call .unterprogramm # Liefert Ergebnis von x^(n/2)^2 in %eax
jmp .end
## Unterprogramm zur Berechnung von: x^(n/2)^2 ##
#################################################
.unterprogramm:
pushl %ebp # alten Basepointer sichern
movl n, %eax # n in %eax laden
shrl $1, %eax # %eax / 2
movl %eax, %ecx # %eax in %ecx verschieben
movl x, %eax # x in %eax laden
movl x, %ebx # x in %ebx laden
dec %ecx # n - 1
.loop_n:
cmp $0, %ecx # n = 0 ?
je .loop_n_end
call .iteration # Aufruf der Iteration
dec %ecx # n - 1
jmp .loop_n
.loop_n_end:
movl %eax, %ebx # %eax in %ebx zum Quadrieren
call .iteration # (x)^2
popl %ebp # alten Basepointer wiederherstellen
ret # zurück zum Aufrufer (n_gerade oder n_ungerade)
##############################################################################
#Unterprogramm Iteration
## ICH ÜBERGEB HIER IMMER NUR %eax ICH WEISS NICHT OB DIE MEHR SEHN WOLLEN; ABER WAS SOLL MAN NOCH ÜBERGEBEN?
## WENN ICH DIE AUSKOMMENTIERTEN TEILE WIEDER REINMACHE GEHT IRGENDWIE NIX MEHR BEI MIR
.iteration:
pushl %ebp # alten Basepointer sichern
#movl %esp, %ebx # neuen Basepointer erzeugen
mull %ebx
popl %ebp # alten Basepointer wiederherstellen
#movl %ebp, %esp # Stackpointer zurücksetzen (alternativ mit "leave")
ret # return
##########
# AUSGABE:
.end:
# Wert im %eax ausgeben
pushl %eax
pushl $intout
call printf
# Exit
movl $1, %eax
int $0x80

Binary file not shown.

61
ws2010/gdi3/p2/a1a.asm Normal file
View File

@ -0,0 +1,61 @@
.data
##ACHTUNG: Programm kann maximal 2^31 berechnen.
##Die Ausgabe kann fehlerhaft sein, nur unter Windows getestet
##Das Ergebniss (%eax) muss als unsigned long betrachtet werden!
# Eingaben:
x: .long 2
n: .long 31
# Zu berechnen: x^n
intout: .string "Wert: %ul\n"
.text
######################################################################
.globl _main
.global _mainCRTStartup # debugging 4 msvs/windows
######################################################################
_mainCRTStartup: # do nothing
jmp _main # jump to _main
######################################################################
_main:
movl $1, %eax # Lade 1 in %eax
movl x, %ebx # Lade x in %ebx
movl n, %ecx # Lade n in %ecx
call .x_hoch_n_iterativ # call subrutine x_hoch_n_iterativ
jmp .end # finish
######################################################################
# %eax = current result
# %ebx = x
# %ecx = n
.x_hoch_n_iterativ:
cmp $0, %ecx # n = 0 ?
je .x_hoch_n_iterativ_ancor
decl %ecx # n -= 1
mull %ebx # result *= x
#Hier wird unsigned multipliziert um für n einen Wert bis zu 31 zu ermöglichen.
call .x_hoch_n_iterativ # call x_hoch_n_iterativ to calculate the rest
ret # finish
.x_hoch_n_iterativ_ancor: # ancor-marker (%eax * 1)
ret # jump out
######################################################################
.end:
# Wert im %eax ausgeben
pushl %eax
pushl $intout
call _printf
# Exit
movl $1, %eax
#int $0x80

82
ws2010/gdi3/p2/a1b.asm Normal file
View File

@ -0,0 +1,82 @@
.data
# Eingaben:
x: .long 2
n: .long 7
# Zu berechnen: x^n
intout: .string "Ergebnis: %d\n"
.text
######################################################################
.globl _main
.global _mainCRTStartup # debugging 4 msvs/windows
######################################################################
_mainCRTStartup: # do nothing
jmp _main # jump to _main
######################################################################
_main:
movl $1, %eax # Lade 1 in %eax
movl x, %ebx # Lade x in %ebx
movl n, %ecx # Lade n in %ecx
call .x_hoch_n_recursiv # call subrutine x_hoch_n_recursiv
jmp .end # finish
######################################################################
;# %eax = current result
;# %ebx = x
;# %ecx = n
.x_hoch_n_recursiv:
cmp $0, %ecx # n = 0 ?
je .x_hoch_n_recursiv_ancor
movl $0b000001, %edx # %edx = 1b
and %ecx, %edx # %edx = 1b if n = even else 0b if n = uneven
cmp $0, %edx # n even?
je .x_hoch_n_recursiv_even # jump to even
jmp .x_hoch_n_recursiv_uneven # else jump to uneven
.x_hoch_n_recursiv_even:
push %ebx # save x; nur temporär
xchg %eax, %ecx # exchange a(result) & c(n)
movl $2, %ebx # %edx = 2
cdq # clear %edx
idivl %ebx # n /= 2
xchg %eax, %ecx # exchange a & c back
pop %ebx # restore x
call .x_hoch_n_recursiv # calculate x ^ (n/2)
cdq # clear %edx
imull %eax, %eax # calculate (x ^ (n/2)) ^ (2)
ret # outa here
.x_hoch_n_recursiv_uneven: #ACHTUNG: BENUTZT x_hoch_n_recursiv_even -> AUFGABENSTELLUNG?!
decl %ecx # n -= 1
call .x_hoch_n_recursiv # calculate the rest (x^((n-1)/2)) ^(2)
imull %ebx, %eax # ((x^((n-1)/2)) ^(2)) * x
ret # outa here
.x_hoch_n_recursiv_ancor: # ancor-marker
movl $1, %eax # result = 1
ret # jump out
######################################################################
.end:
# Wert im %eax ausgeben
pushl %eax
pushl $intout
call _printf
# Exit
movl $1, %eax
#int $0x80

83
ws2010/gdi3/p2/a2.asm Normal file
View File

@ -0,0 +1,83 @@
.data
# Eingaben:
m: .long 3
n: .long 5
# Zu berechnen: x^n
intout: .string "Ergebnis: %d\n"
.text
######################################################################
.globl _main
.global _mainCRTStartup # debugging 4 msvs/windows
######################################################################
_mainCRTStartup: # do nothing
jmp _main # jump to _main
######################################################################
_main:
movl $0, %eax # Lade 0 in %eax
movl m, %ebx # Lade m in %ebx
movl n, %ecx # Lade n in %ecx
call .ackermann # call subrutine ackermann
jmp .end # finish
######################################################################
# %eax = current result
# %ebx = m
# %ecx = n
.ackermann:
cmp $0, %ebx # m = 0 ?
je .ackermann_ancor # jump to ancor
# m > 0
cmp $0, %ecx # n = 0 ?
je .ackermann_n_null_m_not_null # jump to n=0, m>0
# n > 0
jmp .ackermann_n_not_null_m_not_null # jump to n>0, m>0
.ackermann_n_null_m_not_null:
incl %ecx # n += 1 (n=1)
decl %ebx # m -= 1
call .ackermann # and call ackermann to calculate the rest
ret # outa here
.ackermann_n_not_null_m_not_null:
pushl %ebx # save m to stack
# A(m, n-1)
decl %ecx # n -= 1
call .ackermann # call ackermann to calculate A(m, n-1)
popl %ebx # get m back from stack
# A(m-1, A(m, n-1))
decl %ebx # m -= 1
movl %eax, %ecx # n = A(m, n-1)
call .ackermann # call ackermann to calculate the rest
ret # outa here
.ackermann_ancor: # ancor-marker
movl %ecx, %eax # result = n
incl %eax # result += 1
ret # jump out
######################################################################
.end:
# Wert im %eax ausgeben
pushl %eax
pushl $intout
call _printf
# Exit
movl $1, %eax
#int $0x80

201
ws2010/gdi3/p2/a3.asm Normal file
View File

@ -0,0 +1,201 @@
.data
# Eingaben:
#Array_: .long 12,18,19,21, 25,27,31,40, 42,45,56,57, 59,60,61,63, 63,65,70,79, 81,81,85,86, 92,93,94
#Array: .long 86,19,59,63, 79,65,45,27, 61,31,94,85, 42,92,21,81, 63,18,56,25, 12,70,57,81, 40,60,93
#n: .long 27
Array: .long 4,3,2,1
n: .long 4
textout: .string "Ergebnis: "
intout: .string "%d "
endout: .string "\n"
.text
######################################################################
.globl _main
.global _mainCRTStartup # debugging 4 msvs/windows
######################################################################
_mainCRTStartup: # do nothing
jmp _main # jump to _main
######################################################################
_main:
leal Array, %eax # Lade ArrayAdresse in %ebx
movl n, %ebx # Lade n nach %ecx
decl %ebx # n-1
call .quicksort # call subrutine quicksort
jmp .end # finish
######################################################################
;# %eax = Array-Start-Adresse = A
;# %ebx = ArrayLänge = n
.quicksort:
cmp $1, %ebx # n = 1?
jle .quicksort_ancor # get outa here
pushl %ebx # save array-length
pushl %eax # save array-adress
pushl %eax # save array-adress (save twice)
# %eax = array-adress (saved
# %ebx = arry-length (saved)
call .partition # call .partition
# %eax = p
popl %ecx # %ecx = array-adress
pushl %eax # save p
movl %eax, %ebx # %ebx = p (new array length)
subl $1, %ebx # p -1
movl %ecx, %eax # %eax = Array-Address
# %eax = Array-Adress
# %ebx = p-1
call .quicksort # with A and p-1
popl %ecx # restore p
popl %eax # restore Array-Adress
popl %ebx # restore n
subl %ecx, %ebx # Correct Array-Length n - p
imull $4, %ecx # p * 4
addl %ecx, %eax # Move Array-Adress (p*4)
# Array-Adress + (p*4)
# Array-Length n-p
call .quicksort
ret
.quicksort_ancor:
ret # get outa here
######################################################################
;# %eax = Array-Start-Adresse = A
;# %ebx = ArrayLänge = n
.partition:
push %eax #Save Array-Address
push %ebx #Save Array-Length
imull $4, %ebx # %ebx * 4
addl %ebx, %eax # Adresse auf letzten Eintrag verschieben
movl (%eax), %eax # %eax = x = A[n]
pushl %eax # save x
movl $0, %ebx # %ebx = i = 0
movl $0, %ecx # %ecx = j = 0
.partition_for:
cmp %ecx, 4(%esp) # j < n
jle .partition_for_anchor
movl 8(%esp), %edx # %edx = Array-Adress
movl %ecx, %eax # %eax = j
imull $4, %eax # %eax = j*4
addl %eax, %edx # %edx = A[j]-Adresse
movl (%esp), %eax # %eax = x
cmp (%edx), %eax # compare A[j] with x
jl .partition_for_if_achnor
#if
pushl %eax
pushl %ebx
pushl %ecx
movl 20(%esp), %eax # %eax = Array-Adress
# %ebx = i
# %ecx = j
call .array_exchange
popl %ecx
popl %ebx
popl %eax
incl %ebx # i++
#endif (else)
.partition_for_if_achnor:
#nothing to do here, we are done with if
incl %ecx # j ++
jmp .partition_for # jump back to for-loop
#endfor
.partition_for_anchor:
#nothing to do here, we are done with for-loop
movl 8(%esp), %eax # %eax = Array-Adress
# %ebx = i
movl 4(%esp), %ecx # %ecx = n
pushl %ebx
call .array_exchange # call array_exchange
popl %eax # %eax = i
addl $12, %esp # clean stack (array-addr, n, x)
ret
######################################################################
;# %eax = Array-Start-Adresse = A
;# %ebx = pos A
;# %ecx = pos B
.array_exchange:
movl %eax, %edx # %edx = Array-Adress
imull $4, %ebx
imull $4, %ecx
addl %ebx, %eax # %eax = A[PosA]
addl %ecx, %edx # %edx = A[PosB]
movl (%eax), %ebx # %ebx = A[PosA]-Value
movl (%edx), %ecx # %ecx = A[PosB]-Value
movl %ecx, (%eax) #xchange
movl %ebx, (%edx)
ret
######################################################################
.end:
# Wert im %eax ausgeben
pushl $textout
call _printf
leal Array, %eax
mov n, %ebx;
imull $4, %ebx
addl %ebx, %eax
subl $4, %eax
output_loop:
cmp $0, %ebx
je output_ancor
pushl (%eax)
pushl $intout
call _printf
subl $4, %ebx
subl $4, %eax
jmp output_loop
output_ancor:
pushl $endout
call _printf
# Exit
movl $1, %eax
#int $0x80

View File

@ -0,0 +1,73 @@
.data
# Eingaben:
x: .long 2
n: .long 4
intout:
.string "Wert %d\n"
.text
.globl main
main:
###Anzahl der Ticks########
#rdtsc
#pushl %eax
###########################
movl $1, %eax # Lade 1 in %eax
movl x, %ebx # Lade x in %ebx
movl n, %ecx # Lade n in %ecx
call .x_hoch_n_iterativ # call subrutine x_hoch_n_iterativ
jmp .end # finish
######################################################################
# %eax = current result
# %ebx = x
# %ecx = n
.x_hoch_n_iterativ:
cmp $0, %ecx # n = 0 ?
je .x_hoch_n_iterativ_ancor
decl %ecx # n -= 1
mull %ebx # result *= x
#Hier wird unsigned multipliziert um für n einen Wert bis zu 31 zu ermöglichen.
call .x_hoch_n_iterativ # call x_hoch_n_iterativ to calculate the rest
ret # finish
.x_hoch_n_iterativ_ancor: # ancor-marker (%eax * 1)
ret # jump out
######################################################################
.end:
# Wert im %eax ausgeben
###Anzahl der Ticks########
#rdtsc
#popl %ebx
#subl %ebx, %eax
###########################
pushl %eax
pushl $intout
call printf
# Exit
movl $1, %eax
int $0x80

View File

@ -0,0 +1,93 @@
.data
# Eingaben:
x: .long 2
n: .long 4
intout:
.string "Wert %d\n"
.text
.globl main
main:
###Anzahl der Ticks########
#rdtsc
#pushl %eax
###########################
movl $1, %eax # Lade 1 in %eax
movl x, %ebx # Lade x in %ebx
movl n, %ecx # Lade n in %ecx
call .x_hoch_n_recursiv # call subrutine x_hoch_n_recursiv
jmp .end # finish
######################################################################
# %eax = current result
# %ebx = x
# %ecx = n
.x_hoch_n_recursiv:
cmp $0, %ecx # n = 0 ?
je .x_hoch_n_recursiv_ancor
movl $0b000001, %edx # %edx = 1b
and %ecx, %edx # %edx = 1b if n = even else 0b if n = uneven
cmp $0, %edx # n even?
je .x_hoch_n_recursiv_even # jump to even
jmp .x_hoch_n_recursiv_uneven # else jump to uneven
.x_hoch_n_recursiv_even:
push %ebx # save x; nur temporär
xchg %eax, %ecx # exchange a(result) & c(n)
movl $2, %ebx # %edx = 2
cdq # clear %edx
idivl %ebx # n /= 2
xchg %eax, %ecx # exchange a & c back
pop %ebx # restore x
call .x_hoch_n_recursiv # calculate x ^ (n/2)
cdq # clear %edx
imull %eax, %eax # calculate (x ^ (n/2)) ^ (2)
ret # outa here
.x_hoch_n_recursiv_uneven:
decl %ecx # n -= 1
call .x_hoch_n_recursiv # calculate the rest (x^((n-1)/2)) ^(2)
imull %ebx, %eax # ((x^((n-1)/2)) ^(2)) * x
ret # outa here
.x_hoch_n_recursiv_ancor: # ancor-marker
movl $1, %eax # result = 1
ret # jump out
######################################################################
.end:
# Wert im %eax ausgeben
###Anzahl der Ticks########
#rdtsc
#popl %ebx
#subl %ebx, %eax
###########################
pushl %eax
pushl $intout
call printf
# Exit
movl $1, %eax
int $0x80

View File

@ -0,0 +1,83 @@
.data
# Eingaben:
m: .long 3
n: .long 5
intout:
.string "Wert %d\n"
.text
.globl main
main:
movl $0, %eax # Lade 0 in %eax
movl m, %ebx # Lade m in %ebx
movl n, %ecx # Lade n in %ecx
call .ackermann # call subrutine ackermann
jmp .end # finish
######################################################################
# %eax = current result
# %ebx = m
# %ecx = n
.ackermann:
cmp $0, %ebx # m = 0 ?
je .ackermann_ancor # jump to ancor
# m > 0
cmp $0, %ecx # n = 0 ?
je .ackermann_n_null_m_not_null # jump to n=0, m>0
# n > 0
jmp .ackermann_n_not_null_m_not_null # jump to n>0, m>0
.ackermann_n_null_m_not_null:
incl %ecx # n += 1 (n=1)
decl %ebx # m -= 1
call .ackermann # and call ackermann to calculate the rest
ret # outa here
.ackermann_n_not_null_m_not_null:
pushl %ebx # save m to stack
# A(m, n-1)
decl %ecx # n -= 1
call .ackermann # call ackermann to calculate A(m, n-1)
popl %ebx # get m back from stack
# A(m-1, A(m, n-1))
decl %ebx # m -= 1
movl %eax, %ecx # n = A(m, n-1)
call .ackermann # call ackermann to calculate the rest
ret # outa here
.ackermann_ancor: # ancor-marker
movl %ecx, %eax # result = n
incl %eax # result += 1
ret # jump out
######################################################################
.end:
# Wert im %eax ausgeben
pushl %eax
pushl $intout
call printf
# Exit
movl $1, %eax
int $0x80

View File

@ -0,0 +1,197 @@
.data
# Eingaben:
#Array: .long 12,18,19,21, 25,27,31,40, 42,45,56,57, 59,60,61,63, 63,65,70,79, 81,81,85,86, 92,93,94
Array: .long 86,19,59,63, 79,65,45,27, 61,31,94,85, 42,92,21,81, 63,18,56,25, 12,70,57,81, 40,60,93
n: .long 27
#Array: .long 4,3,2,1
#n: .long 4
textout: .string "Ergebnis: \n"
intout: .string "%d "
endout: .string "\n"
.text
.globl main
main:
leal Array, %eax # Lade ArrayAdresse in %ebx
movl n, %ebx # Lade n nach %ecx
decl %ebx # n-1
call .quicksort # call subrutine quicksort
jmp .end # finish
######################################################################
;# %eax = Array-Start-Adresse = A
;# %ebx = ArrayLänge = n
.quicksort:
cmp $1, %ebx # n = 1?
jle .quicksort_ancor # get outa here
pushl %ebx # save array-length
pushl %eax # save array-adress
pushl %eax # save array-adress (save twice)
# %eax = array-adress (saved
# %ebx = arry-length (saved)
call .partition # call .partition
# %eax = p
popl %ecx # %ecx = array-adress
pushl %eax # save p
movl %eax, %ebx # %ebx = p (new array length)
subl $1, %ebx # p -1
movl %ecx, %eax # %eax = Array-Address
# %eax = Array-Adress
# %ebx = p-1
call .quicksort # with A and p-1
popl %ecx # restore p
popl %eax # restore Array-Adress
popl %ebx # restore n
subl %ecx, %ebx # Correct Array-Length n - p
imull $4, %ecx # p * 4
addl %ecx, %eax # Move Array-Adress (p*4)
# Array-Adress + (p*4)
# Array-Length n-p
call .quicksort
ret
.quicksort_ancor:
ret # get outa here
######################################################################
;# %eax = Array-Start-Adresse = A
;# %ebx = ArrayLänge = n
.partition:
push %eax #Save Array-Address
push %ebx #Save Array-Length
imull $4, %ebx # %ebx * 4
addl %ebx, %eax # Adresse auf letzten Eintrag verschieben
movl (%eax), %eax # %eax = x = A[n]
pushl %eax # save x
movl $0, %ebx # %ebx = i = 0
movl $0, %ecx # %ecx = j = 0
.partition_for:
cmp %ecx, 4(%esp) # j < n
jle .partition_for_anchor
movl 8(%esp), %edx # %edx = Array-Adress
movl %ecx, %eax # %eax = j
imull $4, %eax # %eax = j*4
addl %eax, %edx # %edx = A[j]-Adresse
movl (%esp), %eax # %eax = x
cmp (%edx), %eax # compare A[j] with x
jl .partition_for_if_achnor
#if
pushl %eax
pushl %ebx
pushl %ecx
movl 20(%esp), %eax # %eax = Array-Adress
# %ebx = i
# %ecx = j
call .array_exchange
popl %ecx
popl %ebx
popl %eax
incl %ebx # i++
#endif (else)
.partition_for_if_achnor:
#nothing to do here, we are done with if
incl %ecx # j ++
jmp .partition_for # jump back to for-loop
#endfor
.partition_for_anchor:
#nothing to do here, we are done with for-loop
movl 8(%esp), %eax # %eax = Array-Adress
# %ebx = i
movl 4(%esp), %ecx # %ecx = n
pushl %ebx
call .array_exchange # call array_exchange
popl %eax # %eax = i
addl $12, %esp # clean stack (array-addr, n, x)
ret
######################################################################
;# %eax = Array-Start-Adresse = A
;# %ebx = pos A
;# %ecx = pos B
.array_exchange:
movl %eax, %edx # %edx = Array-Adress
imull $4, %ebx
imull $4, %ecx
addl %ebx, %eax # %eax = A[PosA]
addl %ecx, %edx # %edx = A[PosB]
movl (%eax), %ebx # %ebx = A[PosA]-Value
movl (%edx), %ecx # %ecx = A[PosB]-Value
movl %ecx, (%eax) #xchange
movl %ebx, (%edx)
ret
######################################################################
.end:
# Wert im %eax ausgeben
pushl $textout
call printf
movl $0, %esi
movl n, %ebx
output_loop:
cmp %ebx, %esi
je output_ancor
pushl Array(, %esi, 4)
pushl $intout
call printf
incl %esi
jmp output_loop
output_ancor:
pushl $endout
call printf
.exit:
# Exit
movl $1, %eax
int $0x80

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,60 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
int doublemode = 0; // 0 = Int, 1 = Float
char usage[] = "usage: matrixgenerator size [-mode double]\n";
int i,j, k;
int matricewidth = 0;
int main (int argc, const char * argv[])
{
// check Number of arguments
if (argc != 2 && argc != 4)
{
printf("%s", usage);
return 0;
}
// Check arguments for double mode
if (argc == 4)
{
if (strcmp(argv[2],"-mode") != 0 || strcmp(argv[3],"double") != 0)
{
printf("%s", usage);
return 0;
}
doublemode = 1;
}
matricewidth = atoi(argv[1]);
srand ( time(NULL) );
double number;
// Float
printf("%d\n", matricewidth);
for (k = 0; k < 2; k++)
{
for (i = 0; i < matricewidth; i++)
{
for (j = 0; j < matricewidth; j++)
{
if (doublemode)
{
number = (double) rand() / RAND_MAX;
number = 200 * number - 100;
printf("%g\n", number);
}
else
printf("%d\n", ( rand() % 200 - 100));
}
}
}
return 0;
}

View File

@ -0,0 +1,218 @@
.data
# Input Data
matsize: .long 3
matA: .long 1, 2, 3, 4, 5, 6, 7, 8, 9
matB: .long -1, 9, -2, 3, -11, 5, 7, 4, -2
matResult: .long 0, 0, 0, 0, 0, 0, 0, 0, 0 # Initialisiere Datenfeld
#should be 26, -1, 2, 53, 5, 5, 80, 11, 8 -> Test okay!
# 10 x 10
#matsize: .long 10
#matA: .long 5, 4, 8, 10, 20, -5, -11, -14, 9, 100, 3, 8, 57, -1, -2, 41, 11, 1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -13, -14, -15, -16, -17, -18, -19, -20, 1, 2, 5, 8, 9, -7, -9, 1, -7, -4, 5, 4, 8, 10, 20, -5, -11, -14, 9, 100, 3, 8, 57, -1, -2, 41, 11, 1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -13, -14, -15, -16, -17, -18, -19, -20, 1, 2, 5, 8, 9, -7, -9, 1, -7, -4
#matB: .long 5, 4, 8, 10, 20, -5, -11, -14, 9, 100, 3, 8, 57, -1, -2, 41, 11, 1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -13, -14, -15, -16, -17, -18, -19, -20, 1, 2, 5, 8, 9, -7, -9, 1, -7, -4, 5, 4, 8, 10, 20, -5, -11, -14, 9, 100, 3, 8, 57, -1, -2, 41, 11, 1, 2, 3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, -13, -14, -15, -16, -17, -18, -19, -20, 1, 2, 5, 8, 9, -7, -9, 1, -7, -4
#matResult: .long 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
intout: .string "Ergebnismatrix: \n"
out_newline: .string "\n"
out_int: .string "%d\t"
.text
.globl main
main:
movl $0, %edi # %edi Index von matResult
movl $1, %eax # %eax = i = 1
movl $1, %ebx # %ebx = j = 1
movl matsize, %edx # %edx = matsize
incl %edx # %edx = matsize + 1
##########################################################################################
.loop_line: # loop über i
cmp %edx, %eax # i = matsize + 1 ?
je .loop_line_end
#########################################################################
.loop_column: # loop über j
movl matsize, %edx # %edx = matsize
incl %edx # %edx = matsize + 1
cmp %edx, %ebx # j = matsize + 1 ? -> zeile fertig
je .loop_column_end
pushl %eax # Sichere %eax, da get_cij es ändert
pushl %ebx # Sichere %eax, da get_cij es ändert
call .get_cij # gibt wert c(ij) in %eax zurück
movl %eax, matResult(,%edi,4) # Speichere Wert im Datenfeld
popl %ebx # Stelle ursprüngliche Werte (j, i) wieder her
popl %eax
incl %edi # %edi += 1
incl %ebx # j++
jmp .loop_column
.loop_column_end:
#########################################################################
incl %eax # i++
movl $1, %ebx # j = 1
jmp .loop_line
.loop_line_end:
##########################################################################################
jmp .end
####################################################################################################
/*
get_cij konsumiert Indizes i und j und gibt Summe von k=1 bis m=matsize von (a(ik) * b(kj)) zurück
Eingabe: %eax = i
%ebx = j
Ausgabe: %eax = Ergebnis der Summation
*/
.get_cij:
pushl %eax # i liegt bei 12(%ebp)
pushl %ebx # j liegt bei 8(%ebp)
pushl $0 # Zwischenergebnis liegt bei 4(%ebp) -> initialisiert mit 0
pushl %ebp
movl %esp, %ebp
movl $1, %ecx # %ecx = k
.loop_sum:
movl matsize, %eax
incl %eax # matsize + 1
cmp %eax, %ecx # matsize + 1 = k
je .end_loop_sum
# Hole Wert von Matrix A
movl matsize, %ebx # %ebx = matsize
movl 12(%ebp), %eax # i in %eax
mull %ebx # i * matsize (Adressberechnung)
subl %ebx, %eax # %eax = %eax - matsize
addl %ecx, %eax # %eax = %eax + k
decl %eax # %eax = %eax - 1, denn Index von Array beginnt bei 0
movl matA(,%eax,4), %eax # passender Wert der Matrix A in %eax
pushl %eax # Sichere Wert von Matrix A
#Hole Wert von Matrix B
movl matsize, %eax # %eax = matsize
mull %ecx # k * matsize (Adressberechnung)
movl %eax, %ebx # %eax nach %ebx verschieben
movl matsize, %eax # matsize wiederherstellen
subl %eax, %ebx # %ebx = %ebx - matsize
movl 8(%ebp), %eax # j in %eax
addl %eax, %ebx # %ebx = %ebx + j
decl %ebx # %eax = %eax - 1, denn Index von Array beginnt bei 0
movl matB(,%ebx,4), %ebx # passender Wert der Matrix B in %ebx
popl %eax # Wert der Matrix A wiederherstellen
#Führe nun eigentliche Berechnung durch
imull %ebx, %eax # %eax = a(ij) * b(kj) !!Vorzeichenbehaftet!!
addl %eax, 4(%ebp) # Zwischenergebnis + aktuelle Multiplikation
incl %ecx # k += 1
jmp .loop_sum
.end_loop_sum:
movl 4(%ebp), %eax # Ergebnis der Summe in %eax ausgeben
leave
addl $12, %esp # Stack abbauen
ret
####################################################################################################
## Ausgabe:
.end:
#Stack
pushl $0 //loop a counter
pushl $0 //loop b-counter
# print "Ergebnismatrix"
pushl $intout
call printf
#print Datafield
#Loop Rows
.end_loop_row:
movl 4(%esp), %eax
cmp matsize, %eax
je .end_loop_row_end
movl $0, (%esp)
#Loop Columns
.end_loop_column:
movl (%esp), %eax
cmp matsize, %eax
je .end_loop_column_end
movl matsize, %edi
imull 4(%esp), %edi
addl (%esp), %edi
pushl matResult(,%edi,4)
pushl $out_int
call printf
addl $8, %esp
incl (%esp)
jmp .end_loop_column
.end_loop_column_end:
pushl $out_newline
call printf
addl $4, %esp
incl 4(%esp)
jmp .end_loop_row
.end_loop_row_end:
# Exit
movl $1, %eax
int $0x80

Binary file not shown.

369
ws2010/gdi3/p3/prak3.c Normal file
View File

@ -0,0 +1,369 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <omp.h>
int *matA = 0;
int *matB = 0;
int *matResult = 0;
int matricesize;
double *matAdouble = 0;
double *matBdouble = 0;
double *matResultDouble = 0;
/*
* validate commandline arguments, set global variables as required or inform user of usage and quit the program
*/
void validateArguments(int argc, const char * argv[])
{
if (argc != 3)
{
printf("two parameters expected: filename mode\n");
exit(1);
}
if (strcmp(argv[2],"assembler") != 0 && strcmp(argv[2],"c_row") != 0 && strcmp(argv[2],"c_double") != 0 && strcmp(argv[2],"c_column") != 0) {
printf("Second parameter is invalid.\n");
exit(1);
}
}
/*
* Schöne, übersichtliche Matrixausgabe
*/
void printMatrixNice(){
int size = matricesize * matricesize;
int i;
int j = 0;
printf("Matrixgröße: %d\n", matricesize); //erste Zeile = Matrixgröße
for(i = 0; i < size; i++){
printf("%d\t", matResult[i]); //print Element
j++;
if(j % matricesize == 0) // j vielfaches von matricesize?
printf("\n"); // next line
}
}
/*
* Schöne, übersichtliche Matrixausgabe von matResultDouble
*/
void printMatrixDoubleNice(){
int size = matricesize * matricesize;
int i;
int j = 0;
printf("Matrixgröße: %d\n", matricesize); //erste Zeile = Matrixgröße
for(i = 0; i < size; i++){
printf("%.5f\t", matResultDouble[i]); //print Element
j++;
if(j % matricesize == 0) // j vielfaches von matricesize?
printf("\n"); // next line
}
}
/*
* Gibt Ergebnismatrix aus
*/
void printMatrix(){
int size = matricesize * matricesize; //size = größe des arrays
int i;
printf("%d\n", matricesize); // erste Zeile = Matrixgröße
for(i = 0; i < size; i++){ // Zeilenumsprung nach jedem Element
printf("%d\n", matResult[i]);
}
}
/*
* Gibt Ergebnismatrix von matResultDouble aus
*/
void printMatrixDouble(){
int size = matricesize * matricesize; //size = größe des arrays
int i;
printf("%d\n", matricesize); // erste Zeile = Matrixgröße
for(i = 0; i < size; i++){ // Zeilenumsprung nach jedem Element
printf("%0.5f\n", matResultDouble[i]);
}
}
/*
* Berechnet Double-Matrizen-Multiplikation und adressiert hierbei spaltenweise
*
*/
void multiplyCDouble(){
//initialisiere lokale Variablen
int i, j;
int matResult_index;
#pragma omp parallel for
//Schleifen über Elemente der Ergebismatrix
for(i = 1; i <= matricesize; i++){
matResult_index = i - 1;
for(j = 1; j <= matricesize; j++){
double result = 0; //initialisiere lokale variablen
double mul;
int k, matA_index, matB_index;
for(k = 1; k <= matricesize; k++){ //Schleife über k (-> Summe)
matA_index = (j * matricesize) - matricesize + k; //Berechne Index von Matrix A
matB_index = (k * matricesize) - matricesize + i; //Berechne Index von Matrix B
mul = matAdouble[matA_index - 1] * matBdouble[matB_index - 1]; //Multipliziere passende Matrixeinträge
result += mul; // Summe!
}
matResultDouble[matResult_index] = result; //c(ij) an passendem Platz im Array abspeichern
matResult_index += matricesize; // matResult_index anpassen (spaltenweise Adressierung)
}
}
}
/*
* Spaltenweise Adressierung
*
* Schreibe Werte in matResult in folgender Reihenfolge:
*
* 1 4 7
* 2 5 8
* 3 6 9
*/
void multiplyCbyColumn(){
//initialisiere lokale variablen
int i, j;
int matResult_index;
#pragma omp parallel for
for(i = 1; i <= matricesize; i++){
matResult_index = i - 1; //Array-Index beginnt bei 0
for(j = 1; j <= matricesize; j++){
matResult[matResult_index] = get_cij(j, i); //Aufruf von get_cij
matResult_index += matricesize; //matResult_index + matricesizem, da spaltenweise Adressierung
}
}
}
/*
* Zeilenweise Adressierung
*
* Schreibe Werte in matResult in folgender Reihenfolge:
*
* 1 2 3
* 4 5 6
* 7 8 9
*/
void multiplyCbyRow(){
int i, j;
int matResult_index = 0; //Array-Index beginnt bei 0
#pragma omp parallel for
//Schleifen über Elemente der Ergebnismatrix
for(i = 1; i <= matricesize; i++){
for(j = 1; j <= matricesize; j++){
matResult[matResult_index] = get_cij(i, j); //Aufruf von get_cij
matResult_index++; //Array-Index um 1 erhöreh -> zeilenweise Adressierung
}
}
}
/*
* return int
* konsumiert Indizes i und j und gibt Summe von k=1 bis m=matricesize von (a(ik) * b(kj)) zurück
*/
int get_cij(int i, int j){
int result = 0, k, matA_index, matB_index, mul; //initialisiere lokale variablen
for(k = 1; k <= matricesize; k++){ //Schleife über k (-> Summe)
matA_index = (i * matricesize) - matricesize + k; //Berechne Index von Matrix A
matB_index = (k * matricesize) - matricesize + j; //Berechne Index von Matrix B
mul = matA[matA_index - 1] * matB[matB_index - 1]; //Multipliziere passende Matrixeinträge
result += mul; // Summe!
}
return result;
}
/*
* read a matrice file into memory
*/
void readMatricefile(const char *file, char bDouble)
{
// open file
FILE * pFile;
char line[16];
pFile = fopen(file, "r");
if (pFile == NULL)
{
printf("Accessing input file failed\n");
exit(1);
}
// Determine matrice size
fgets(line, 16, pFile);
matricesize = atoi(line);
// Allocate memory
int size = matricesize*matricesize;
if (bDouble)
{
// Double required
matAdouble = (double*) malloc(size * sizeof(double));
matBdouble = (double*) malloc(size * sizeof(double));
matResultDouble = (double*) malloc(size * sizeof(double));
if (matAdouble == NULL || matBdouble == NULL || matResultDouble == NULL)
{
printf("Error allocating memory.\n");
exit(1);
}
// continue reading
int i = 0;
while (fgets(line, 16, pFile) != NULL && i < 2*size)
{
if (i < size)
matAdouble[i] = strtod(line, NULL);
else
matBdouble[i - size] = strtod(line, NULL);
i++;
}
}
else
{
// Integers required
matA = (int*) malloc(size * sizeof(int));
matB = (int*) malloc(size * sizeof(int));
matResult = (int*) malloc(size * sizeof(int));
if (matA == NULL || matB == NULL || matResult == NULL)
{
printf("Error allocating memory.\n");
exit(1);
}
// continue reading
int i = 0;
while (fgets(line, 16, pFile) != NULL && i < 2*size)
{
if (i < size)
matA[i] = atoi(line);
else
matB[i - size] = atoi(line);
i++;
}
}
// done
fclose(pFile);
}
int main (int argc, const char * argv[])
{
// check we got valid arguments, else quit
validateArguments(argc, argv);
// read input matrice file
readMatricefile(argv[1], (strcmp(argv[2],"c_double") == 0) );
// ---- insert your code here ----
if(!strcmp(argv[2],"c_row")){ //parameter c_row
multiplyCbyRow();
printMatrixNice();
//printMatrix();
}
else if(!strcmp(argv[2],"c_column")){ //parameter c_column
multiplyCbyColumn();
printMatrixNice();
//printMatrix();
}
else if(!strcmp(argv[2],"c_double")){ //parameter c_double
multiplyCDouble();
printMatrixDoubleNice();
//printMatrixDouble();
}
// clear memory
if ((strcmp(argv[2],"c_double") != 0))
{
free(matA);
free(matB);
free(matResult);
}
else
{
free(matAdouble);
free(matBdouble);
free(matResultDouble);
}
return 0;
}

BIN
ws2010/gdi3/p3/solution.odt Normal file

Binary file not shown.

BIN
ws2010/gdi3/p3/solution.pdf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,6 @@
>++++++++++
[>+++++++>++++++++++>+++++++++++>+++++++++++>+++++++++++
+>+++>+++++++++++>++++++++++>++++++++++++>+++>+++++++++>
++++++++++>++++++++++>+++++++++++>+++><<<<<<<<<<<<<<<<-]
>++>--->++>++>+>++>>+>->++>->+>--->++++>+++>
<<<<<<<<<<<<<<<<>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.

483
ws2010/gdi3/p4/bf-asm.c Normal file
View File

@ -0,0 +1,483 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char outfilename[255] = "bf-default.asm"; //name of the outputfile
char infilename[255]; //name of the inputfile
int parsepos = 0; //current position in file
int arraysize = 0; //arraysize of bfCode (variable)
int* bfCode = NULL; //array of bfCode
int whilecount = 0; //counts the while-loops
int lastchar = 0; //for optimization
int charcount = 0; //for optimization
/*
* validate commandline arguments, set global variables as required or inform user of usage and quit the program
*/
int validateArguments(int argc, char *argv[])
{
switch(argc){
//fall ohne angabe des outfile
case 2: {
strcpy(infilename, argv[1]);
return 1;
}
//fall mit angabe des outfile
case 4: {
if(!strcmp(argv[1], "-o")){
strcpy(outfilename, argv[2]);
strcpy(infilename, argv[3]);
return 1;
}
}
default: {
printf("invalid arguments!\n");
return 0;
}
}
}
int checkChar(int command){
switch(command){
case 43: // +
case 45: // -
case 62: // >
case 60: // <
case 46: // .
case 44: // ,
case 91: // [
case 93: // ]
return 1;
break;
default:
return 0;
}
}
int checkSimpleCommand(int command){
switch(command){
case 43: // +
case 45: // -
case 62: // >
case 60: // <
case 46: // .
case 44: // ,
return 1;
break;
default:
return 0;
}
}
int parseSimpleCommand(){
if(checkSimpleCommand(bfCode[parsepos])){
return 1;
}
printf("Error: Not a simple command!\n");
return 0;
}
int parseWhileCommand(){
if( bfCode[parsepos] != '['){
printf("Error: While not started!\n");
return 0;
}
parsepos++; //skip [
while( bfCode[parsepos] != ']')
{
if(parseCommand() != 1){
return 0;
}
if(parsepos++ >= arraysize){
printf("Error: While not ended!\n");
return 0;
}
}
return 1;
}
int parseCommand(){
if(bfCode[parsepos] == 0){
printf("Compiling File %s succesfull!\n", infilename);
arraysize = parsepos;
return 1;
}
if( bfCode[parsepos] == '['){
return parseWhileCommand();
}
return parseSimpleCommand();
}
int parseProgram(){
while( parsepos < arraysize )
{
if(parseCommand() == 0){
return 0;
}
parsepos++;
}
}
//Some functions for assemblercode
void generateHead(FILE * pFile){
//Head
fputs( ".data\n" , pFile);
fputs( "\t curStackPos: .long 0\n" , pFile);
fputs( "\t datafield: .long 0\n" , pFile);
fputs( "\t\t\t .align 65536\n" , pFile);
fputs( "\t maxStack:\t.long 65536\n" , pFile);
fputs( "\t intout:\t.string \"%c\"\n" , pFile);
fputs( "\t endofline:\t.string \"\\n\"\n" , pFile);
fputs( "\n" , pFile);
fputs( ".text\n" , pFile);
fputs( ".globl main\n" , pFile);
fputs( "\n" , pFile);
//Main
fputs( "main:\n" , pFile);
fputs( "\t call bfCode\n" , pFile);
fputs( "\t jmp end\n" , pFile);
fputs( "\n" , pFile);
//End
fputs( "end:\n" , pFile);
fputs( "\t pushl $endofline\n" , pFile);
fputs( "\t call printf\n" , pFile);
fputs( "\t movl $1, %eax\n" , pFile);
fputs( "\t int $0x80\n" , pFile);
fputs( "\n" , pFile);
//Check Stack, ends Programm if > MaxStack
fputs( "checkStack:\n" , pFile);
fputs( "\t movl curStackPos, %ebx\n" , pFile);
fputs( "\t movl maxStack, %ecx\n" , pFile);
fputs( "\t cmp %ecx, %ebx\n" , pFile);
fputs( "\t jge end\n" , pFile);
fputs( "\t ret\n" , pFile);
fputs( "\n" , pFile);
//Get Stack @ curStackPos; result = %eax
fputs( "getStack:\n" , pFile);
fputs( "\t call checkStack\n" , pFile);
fputs( "\t movl curStackPos, %ecx\n" , pFile);
fputs( "\t movl datafield(, %ecx, 4), %eax\n" , pFile);
fputs( "\t ret\n" , pFile);
fputs( "\n" , pFile);
//Set Stack @ curStackPos; input = %eax
fputs( "setStack:\n" , pFile);
fputs( "\t call checkStack\n" , pFile);
fputs( "\t movl curStackPos, %ecx\n" , pFile);
fputs( "\t movl %eax, datafield(, %ecx, 4)\n" , pFile);
fputs( "\t ret\n" , pFile);
fputs( "\n" , pFile);
//ReadInput, reads from terminal
fputs( "readInput:\n" , pFile);
fputs( "\t xor %ecx, %ecx\n" , pFile); //Register nullen
fputs( "\t xor %edi, %edi\n" , pFile); //sys_READ :
fputs( "\t movl $0, %ebx\n" , pFile); // was soll gemacht werden? (0 -> STDIN)
fputs( "\t pushl $0\n" , pFile);
fputs( "\t leal (%esp), %ecx\n" , pFile); // %ecx beinhaltet Adresse von Speicherziel (Speicherziel: datafield( (%edi = 0), 4)
fputs( "\t movl $3, %eax\n" , pFile); // syscalltyp (3 -> sys_read)
fputs( "\t movl $1, %edx\n" , pFile); // Länge der Eingabe (hier 8 = 1byte)
fputs( "\t int $0x80\n" , pFile); // eigentlicher syscall
fputs( "\t popl %eax\n" , pFile);
fputs( "\t pushl $0\n" , pFile);
fputs( "\t addl $4, %esp\n" , pFile);
fputs( "\t ret\n" , pFile);
fputs( "\n" , pFile);
//WriteOutput, writes to terminal
fputs( "writeOutput:\n" , pFile);
fputs( "\t pushl %eax\n" , pFile);
fputs( "\t pushl $intout\n" , pFile);
fputs( "\t call printf\n" , pFile);
fputs( "\t popl %eax\n" , pFile);
fputs( "\t popl %eax\n" , pFile);
fputs( "\t pushl $0\n" , pFile);
fputs( "\t pushl $0\n" , pFile);
fputs( "\t addl $8, %esp\n" , pFile);
fputs( "\t ret\n" , pFile);
fputs( "\n" , pFile);
//Bf-Code
fputs( "\n" , pFile);
fputs( "bfCode:\n" , pFile);
fputs( "\n" , pFile);
}
void generatePlus(FILE * pFile, int count){
fprintf(pFile, "# Plus (%d mal):\n" , count);
fputs( "\t call getStack\n" , pFile);
fprintf(pFile, "\t movl $%d, %%ebx\n" , count);
fputs( "\t addl %ebx, %eax\n" , pFile);
fputs( "\t call setStack\n" , pFile);
fputs( "\n", pFile);
}
void generateMinus(FILE * pFile, int count){
fprintf(pFile, "# Minus (%d mal):\n" , count);
fputs( "\t call getStack\n" , pFile);
fprintf(pFile, "\t movl $%d, %%ebx\n" , count * -1);
fputs( "\t addl %ebx, %eax\n" , pFile);
fputs( "\t call setStack\n" , pFile);
fputs( "\n" , pFile);
}
void generateGroesser(FILE * pFile, int count){
fprintf(pFile, "# Groesser (%d mal):\n" , count);
fputs( "\t movl curStackPos, %eax\n" , pFile);
fprintf(pFile, "\t addl $%d, %%eax\n" , count);;
fputs( "\t movl %eax, curStackPos\n" , pFile);
fputs( "\n" , pFile);
}
void generateKleiner(FILE * pFile, int count){
fprintf(pFile, "# Kleiner (%d mal):\n" , count);
fputs( "\t movl curStackPos, %eax\n" , pFile);
fprintf(pFile, "\t subl $%d, %%eax\n" , count);;
fputs( "\t movl %eax, curStackPos\n" , pFile);
fputs( "\n" , pFile);
}
void generatePunkt(FILE * pFile, int count){
fputs( "# Punkt:\n" , pFile);
while(count > 0){
fputs( "\t call getStack\n" , pFile);
fputs( "\t call writeOutput\n" , pFile);
count--;
}
}
void generateKomma(FILE * pFile, int count){
fputs( "# Komma:\n", pFile);
while(count > 0){
fputs( "\t call readInput\n" , pFile);
fputs( "\t call setStack\n" , pFile);
count--;
}
}
void generateWhileStart(FILE * pFile, int whileNo){
fprintf(pFile, "# WhileBegin%d:\n" , whileNo);
fprintf(pFile, "WhileBegin%d:\n" , whileNo);
fputs( "\tcall getStack\n" , pFile);
fputs( "\tcmp $0, %eax\n" , pFile);
fprintf(pFile, "je WhileEnd%d\n" , whileNo);
fputs("\n", pFile);
}
void generateWhileEnd(FILE * pFile, int whileNo){
fprintf(pFile, "# WhileEnd%d:\n" , whileNo);
fprintf(pFile, "jmp WhileBegin%d\n" , whileNo);
fprintf(pFile, "WhileEnd%d:\n" , whileNo);
}
int generateSimpleCommandCode(FILE * pFile){
if(lastchar != 0){
switch(lastchar){
case 43: // +
generatePlus(pFile,charcount);
break;
case 45: // -
generateMinus(pFile,charcount);
break;
case 62: // >
generateGroesser(pFile,charcount);
break;
case 60: // <
generateKleiner(pFile,charcount);
break;
case 46: // .
generatePunkt(pFile,charcount);
break;
case 44: // ,
generateKomma(pFile,charcount);
break;
default:
printf("ERROR: Not a Simple Command\n");
return 0;
}
}
lastchar = 0;
charcount = 0;
return 1;
}
int generateSimpleCommand(FILE * pFile){
if(bfCode[parsepos] == lastchar){
charcount++;
} else {
generateSimpleCommandCode(pFile);
lastchar = bfCode[parsepos];
charcount = 1;
}
return 1;
}
int generateWhileCommand(FILE * pFile){
if( bfCode[parsepos] != '['){
printf("Error: While not Started\n");
return 0;
}
parsepos++; //skip [
int myWhileCount = whilecount++;
generateWhileStart(pFile, myWhileCount);
while( bfCode[parsepos] != ']')
{
if(generateCommand(pFile) != 1){
return 0;
}
if(parsepos++ >= arraysize){
printf("Error: While not Ended\n");
return 0;
}
}
generateSimpleCommandCode(pFile);
generateWhileEnd(pFile, myWhileCount);
return 1;
}
int generateCommand(FILE * pFile){
if( bfCode[parsepos] == '['){
generateSimpleCommandCode(pFile);
return generateWhileCommand(pFile);
}
return generateSimpleCommand(pFile);
}
int generateCode(){
FILE * pFile;
pFile = fopen(outfilename, "w");
parsepos = 0;
generateHead(pFile);
while( parsepos < arraysize )
{
if(generateCommand(pFile) == 0){
return 0;
}
parsepos++;
}
if(charcount != 0){
generateSimpleCommandCode(pFile);
}
fputs("\t ret", pFile);
return 1;
}
int scanner(const char *file){
FILE * pFile;
// open file
pFile = fopen(file, "r");
//file opend?
if (pFile == NULL){
printf("Error: Could not open Inputfile\n");
return 0;
}
//int fürs aktuelle Zeichen
int lc;
//how many chars did we read?
int i = 0;
//Sind wir im linecomment?
int linecomment = 0;
while((lc = fgetc(pFile)) != EOF){
if(lc == ';'){
linecomment = 1;
continue;
}
if(lc == '\n'){
linecomment = 0;
continue;
}
if( !linecomment &&
checkChar(lc) != 0){
if(arraysize <= i+1){
//Resize Array if needed
arraysize = (arraysize*2 + 1); //+ 1 for arraysize = 0
bfCode = (int*) realloc(bfCode,arraysize * sizeof(int));
}
bfCode[i] = lc;
i++;
}
}
//DEBUG
//int j;
//for(j = 0; j <= 8; j++){
//printf("%d\n", bfCode[j]);}
//done
fclose(pFile);
return 1;
}
int main (int argc, char *argv[])
{
//checks arguments and sets in- / outfilename
if(validateArguments(argc, argv)){
//Scanns in the file, strips all non-bf-chars
if(scanner(infilename)){
//Check Syntax
if(parseProgram()){
//Generate asm Code
if(generateCode()){
return 1; //SUCCESS
} else {return 0;} //Generate Error
} else {return 0;} //Syntax Error
} else {return 0;} //Scanner Error
} else {return 0;} //Arguments Error
}

14
ws2010/gdi3/p4/reverse.bf Normal file
View File

@ -0,0 +1,14 @@
>
,
----------
[
>
,
----------
]
<
[
++++++++++
.
<
]

View File

@ -0,0 +1,103 @@
#pragma once
#include "Mandelbrot.interface.h"
#include <complex>
#include <emmintrin.h>
void IMandelbrot::Init(int x_width, int y_height, int iterations, unsigned int threads, bool sse){
int** outarray = (int **) calloc(x_width, sizeof(int *));
for(unsigned int i = 0; i < x_width; i++)
outarray[i] = (int *) calloc(y_height, sizeof(int));
double minRe = -2.0;
double maxRe = 1.0;
double step = (abs(maxRe) + abs(minRe)) / x_width; //Schrittweite der zu überprüfenden komplexen Zahlen
double minIm = -1.2;
double maxIm = (y_height * step) - abs(minIm); //maximaler Imaginärwert
m_Params = new CParams(outarray,minRe,maxRe,minIm,maxIm,step,x_width,y_height,iterations,threads,sse);
}
void IMandelbrot::Exit(){
delete m_Params->m_outarray;
delete m_Params;
}
void IMandelbrot::calculateMandelbrot(){
calc(*m_Params);
}
int** IMandelbrot::getOutArray(){
return m_Params->m_outarray;
}
void IMandelbrot::checkNumber(CParams& params, double real, double imag, int rePos, int imPos){
complex<double> Zn(real, imag); //komplexe zahl, die sich in der schleife ändert
complex<double> actual(real, imag); //Speichere Ausgangszahl
if(params.m_use_sse){
for(int i = 0; i < params.m_iterations; i += 2){
Zn = Zn * Zn; //Zn = Zn^2
Zn = Zn + actual; //Zn = Zn^2 + c
complex<double> Zn2 = Zn * Zn;
Zn2 = Zn2 + actual;
__m128d a;
a = _mm_loadl_pd(a,&Zn.real());
a = _mm_loadh_pd(a,&Zn2.real());
__m128d b;
b = _mm_loadl_pd(b,&Zn.imag());
b = _mm_loadh_pd(b,&Zn2.imag());
a = _mm_mul_pd(a,a);
b = _mm_mul_pd(b,b);
a = _mm_add_pd(a,b);
double _a1;
double _a2;
_mm_storeh_pd(&_a1,a);
_mm_storeh_pd(&_a2,a);
double abs_1 = sqrt(_a1);
double abs_2 = sqrt(_a2);
if(abs_1 > 2 && abs_2 > 2){
params.m_outarray[rePos][imPos] = 0; //nicht in Mandelbrotmenge -> schreibe 0 in ASCII-MAP
return; //Schleifenabbruch
}
}
params.m_outarray[rePos][imPos] = 1; //in Mandelbrotmenge -> schreibe 1 in ASCII-MAP
return;
} else {
for(int i = 0; i < params.m_iterations; i++){
Zn = Zn * Zn; //Zn = Zn^2
Zn = Zn + actual; //Zn = Zn^2 + c
//Betrag Zn berechnen:
double a = Zn.real();
double b = Zn.imag();
a = a * a;
b = b * b;
a = a + b;
double abs = sqrt(a);
if(abs > 2){
params.m_outarray[rePos][imPos] = 0; //nicht in Mandelbrotmenge -> schreibe 0 in ASCII-MAP
return; //Schleifenabbruch
}
}
params.m_outarray[rePos][imPos] = 1; //in Mandelbrotmenge -> schreibe 1 in ASCII-MAP
return;
}
}

View File

@ -0,0 +1,51 @@
#pragma once
class IMandelbrot {
//------------------------------------------------------------------------------
public:
struct CParams {
int** m_outarray;
double m_minRe, m_maxRe;
double m_minIm, m_maxIm;
double m_step;
int m_x_width;
int m_y_height;
int m_iterations;
unsigned int m_threads;
int m_posix_begin;
int m_posix_end;
bool m_use_sse;
CParams( int** outarray, double minRe, double maxRe, double minIm, double maxIm, double step, int x_width, int y_height, int iterations, unsigned int threads, bool use_sse):
m_outarray(outarray), m_minRe(minRe), m_maxRe(maxRe), m_minIm(minIm), m_maxIm(maxIm), m_step(step),m_x_width(x_width),m_y_height(y_height),m_iterations(iterations),m_threads(threads),m_use_sse(use_sse){};
CParams* copy(){
return new CParams(m_outarray,m_minRe,m_maxRe,m_minIm,m_maxIm,m_step,m_x_width,m_y_height,m_iterations,m_threads,m_use_sse);
}
};
private:
//------------------------------------------------------------------------------
CParams* m_Params;
virtual void calc(CParams& params) = 0;
protected:
static void checkNumber(CParams& params, double real, double imag, int rePos, int imPos);
public:
void Init( int x_width,
int y_height,
int iterations,
unsigned int threads,
bool sse);
void Exit();
void calculateMandelbrot();
int** getOutArray();
};

View File

@ -0,0 +1,48 @@
#pragma once
#include <omp.h>
#include "Mandelbrot.interface.h"
class CMandelbrotOMP: public IMandelbrot {
void calc(CParams& params){
double startR = params.m_minRe;
int x_pos;
int y_pos;
double startI;
omp_set_num_threads(params.m_threads);
#pragma omp parallel for private(y_pos) schedule(dynamic, params.m_x_width)
for(x_pos = 0; x_pos < params.m_x_width; x_pos++){
startI = params.m_minIm;
for(y_pos = params.m_y_height -1; y_pos >= 0; y_pos--){
checkNumber(params, startR, startI, x_pos, y_pos);
startI += params.m_step;
}
startR += params.m_step;
}
}
public:
CMandelbrotOMP(int x_width, int y_height, int iterations, unsigned int threads, bool sse){
Init(x_width,y_height,iterations,threads,sse);
}
~CMandelbrotOMP(){
Exit();
}
};

View File

@ -0,0 +1,77 @@
#pragma once
#include "Mandelbrot.interface.h"
class CMandelbrotPOSIX: public IMandelbrot {
pthread_t* m_posixthreads;
static void* calcPOSIX(void* _params){
CParams* params = (CParams*) _params;
double startR = params->m_minRe + params->m_posix_begin*params->m_step;
for(int x_pos = params->m_posix_begin; x_pos < params->m_posix_end; x_pos++){
double startI = params->m_minIm;
for(int y_pos = params->m_y_height -1; y_pos >= 0; y_pos--){
checkNumber(*params, startR, startI, x_pos, y_pos);
startI += params->m_step;
}
startR += params->m_step;
}
}
void calc(CParams& params){
if(params.m_threads > params.m_x_width){
params.m_threads = params.m_x_width;
}
m_posixthreads = (pthread_t*)malloc(params.m_threads*sizeof(pthread_t)); // reserve memory for the threads
int array_step = params.m_x_width / params.m_threads;
for (unsigned i=0;i<params.m_threads-1;i++){
//calc array-part here
CParams* p = params.copy();
p->m_posix_begin = array_step*i;
p->m_posix_end = array_step*(i+1);
pthread_create(&m_posixthreads[i],NULL,calcPOSIX, (void *)p); // create thread
}
//last Thread
//calc array-part here
CParams* p = params.copy();
p->m_posix_begin = array_step*(params.m_threads-1);
p->m_posix_end = params.m_x_width;
pthread_create(&m_posixthreads[params.m_threads-1],NULL,calcPOSIX, (void *)p); // create thread
// wait for termination of all threads
for(unsigned i=0;i<params.m_threads;i++){
pthread_join(m_posixthreads[i],NULL);
}
// free memory
free(m_posixthreads);
return;
}
public:
CMandelbrotPOSIX(int x_width, int y_height, int iterations, unsigned int threads, bool sse){
Init(x_width,y_height,iterations,threads,sse);
}
~CMandelbrotPOSIX(){
Exit();
}
};

View File

@ -0,0 +1,36 @@
#pragma once
#include "Mandelbrot.interface.cpp"
class CMandelbrotSimple: public IMandelbrot {
void calc(CParams& params){
int x_pos = 0; //Realteil
int y_pos; //Imaginärteil
for(double startR = params.m_minRe; startR < params.m_maxRe; startR += params.m_step){ //minRe + step + step + ...
y_pos = params.m_y_height -1;
for(double startI = params.m_minIm; startI < params.m_maxIm; startI += params.m_step){ //minIm + step + step + ...
checkNumber(params, startR, startI, x_pos, y_pos); //Iteriert über aktuel zu untersuchende komplexe Zahl und schreibt in ASCII-MAP
y_pos--;
}
x_pos++;
}
}
public:
CMandelbrotSimple(int x_width, int y_height, int iterations, unsigned int threads, bool sse){
Init(x_width,y_height,iterations,threads,sse);
}
~CMandelbrotSimple(){
Exit();
}
};

View File

@ -0,0 +1,118 @@
#include "Painter.class.h"
void CPainter::print(int outtype, int** outarray, int x_width, int y_height){
switch(outtype){
case 1:
CPainter::printASCIIMandelbrot(outarray, x_width, y_height);
break;
case 2:
CPainter::printPIXELMandelbrot(outarray, x_width, y_height);
break;
default:
printf("Keine Ausgabe!\n");
}
}
void CPainter::printASCIIMandelbrot(int** outarray, int x_width, int y_height){
for(int i=0;i<y_height;i++){
for(int j=0;j<x_width;j++){
if(outarray[j][i]==0){
printf(" ");
} else {
printf("X");
}
}
printf("\n");
}
}
void CPainter::printPIXELMandelbrot(int** outarray, int x_width, int y_height){
SDL_Delay(16);
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface* screen = SDL_SetVideoMode(x_width, y_height, 0, SDL_HWPALETTE);
SDL_WM_SetCaption("my Mandelbrot", "my Mandelbrot");
SDL_Event _event;
for(int i=0;i<y_height;i++){
for(int j=0;j<x_width;j++){
if(outarray[j][i]==0){
CPainter::DrawPixel(screen,j,i,0,0,0);
} else {
CPainter::DrawPixel(screen,j,i,255,255,255);
}
}
}
SDL_UpdateRect(screen, x_width, y_height, 1, 1);
bool done=false;
while(!done) {
while(SDL_PollEvent(&_event)) {
if (_event.type == SDL_QUIT) {
done=true;
}
}
}
SDL_FreeSurface;
SDL_Quit();
}
void CPainter::DrawPixel(SDL_Surface *screen, int x, int y, Uint8 R, Uint8 G, Uint8 B){
Uint32 color = SDL_MapRGB(screen->format, R, G, B);
if ( SDL_MUSTLOCK(screen) ) {
if ( SDL_LockSurface(screen) < 0 ) {
return;
}
}
switch (screen->format->BytesPerPixel) {
case 1: { /* vermutlich 8 Bit */
Uint8 *bufp;
bufp = (Uint8 *)screen->pixels + y*screen->pitch + x;
*bufp = color;
}
break;
case 2: { /* vermutlich 15 Bit oder 16 Bit */
Uint16 *bufp;
bufp = (Uint16 *)screen->pixels + y*screen->pitch/2 + x;
*bufp = color;
}
break;
case 3: { /* langsamer 24-Bit-Modus, selten verwendet */
Uint8 *bufp;
bufp = (Uint8 *)screen->pixels + y*screen->pitch + x * 3;
if(SDL_BYTEORDER == SDL_LIL_ENDIAN) {
bufp[0] = color;
bufp[1] = color >> 8;
bufp[2] = color >> 16;
} else {
bufp[2] = color;
bufp[1] = color >> 8;
bufp[0] = color >> 16;
}
}
break;
case 4: { /* vermutlich 32 Bit */
Uint32 *bufp;
bufp = (Uint32 *)screen->pixels + y*screen->pitch/4 + x;
*bufp = color;
}
break;
}
if ( SDL_MUSTLOCK(screen) ) {
SDL_UnlockSurface(screen);
}
}

View File

@ -0,0 +1,19 @@
#pragma once
#include "SDL/include/SDL.h"
class CPainter
{
void static DrawPixel(SDL_Surface *screen, int x, int y, Uint8 R, Uint8 G, Uint8 B);
/*
* returns the Mandelbrot-set as ASCII-art on the command line
*/
void static printASCIIMandelbrot(int** outarray, int x_width, int y_height);
void static printPIXELMandelbrot(int** outarray, int x_width, int y_height);
public:
void static print(int outtype, int** outarray, int x_width, int y_height);
};

Binary file not shown.

18
ws2010/gdi3/p5/SDL/BUGS Normal file
View File

@ -0,0 +1,18 @@
Bugs are now managed in the SDL bug tracker, here:
http://bugzilla.libsdl.org/
You may report bugs there, and search to see if a given issue has already
been reported, discussed, and maybe even fixed.
You may also find help at the SDL mailing list. Subscription information:
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
bugs discussed on the mailing list may be forgotten or missed.

View File

@ -0,0 +1,139 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Building SDL with Borland's C++ compilers</title>
<meta name="author"
content="David Snopek and updated by Dominique Louis.">
</head>
<body>
<xevol @newtonave.net=""> </xevol>
<h1>Building SDL with Borland's C++ compilers. </h1>
<b> by <a href="mailto:xevol@users.sourceforge.net"> David Snopek</a></b>
and updated by <b><a href="mailto:Dominique@SavageSoftware.com.au">Dominique
Louis</a></b> ( Last updated : 30th June 2003 ).<br>
<br>
These instructions cover how to compile SDL and its included test
programs using either Borland <a href="#bcbwin">C++ Builder 5, 6 for Windows</a>,
<a href="#k3">C++ Builder for Linux ( AKA Kylix 3 )</a> or the free <a
href="#bccc">Borland C++ command-line compiler</a>. <br>
<h3> <b> Extract the files </b> </h3>
<p> Unzip the Borland.zip archive into <b>this</b> directory. Do not unzip
it into any other directory because the makefiles ( *.mak ) and project
files ( *.bpr ) use relative paths to refer to the SDL sources. This should
create a directory named "Borland" inside of the top level SDL source directory.
</p>
<h3> <b><a name="bcbwin"></a> Using Borland C++ Builder 5, 6 for Windows </b>
</h3>
<p> Inside of the "Borland" directory there is a "bcb6" directory that contains
a number of Builder project files. Double-click on the "libSDL.bpg" file
icon. Once Builder has started click on the "<u>P</u>rojects" menu on
the menu-bar and go down to "B<u>u</u>ild All Projects" option. <br>
This will proceed to build SDL ( with Borland's calling convention ),
SDLmain, and all the <a href="#tests">test programs</a>. Currently, all
the <a href="#tests">test programs</a> are dynamically linked to Sam Lantinga's
SDL.dll.</p>
<p><b>NOTE :</b> Borland's "lib" format and Microsoft's "lib" format are incompatible.
&nbsp;<br>
If you wish to dynamically link to the SDL library supplied by Sam Lantinga
in each release, I have created the correct *.libs for SDL 1.2.4 and they
exist in the "/lib" directory.<br>
If you would like to create the *.lib files yourself, you will need to
make use of Borland's "implib.exe" utility.<br>
</p>
<p><tt>IMPLIB</tt> works like this: </p>
<pre> IMPLIB (destination lib name) (source dll)<br></pre>
<p> For example,</p>
<pre> IMPLIB SDL.lib SDL.dll<br></pre>
<p>This assumes that SDL.dll was compiled with Visual C++ or similar.<br>
</p>
<p>To learn more about the difference between Borland's and Microsoft's *.lib
format please read the article <a
href="http://www.bcbdev.com/articles/vcdll.htm">here</a>.<br>
</p>
<p> <b><br>
NOTE :</b> The C++ Builder for Windows project format, is not compatible
with the Kylix 3 project format, hence the reason why they are in separate
directories.</p>
<h3> <b><a name="bccc"></a> Using the free Borland C++ command-line compiler
</b> </h3>
<p> The free Borland compiler can be downloaded at no charge from <a
href="http://www.borland.com/bcppbuilder/freecompiler/"> the Borland website
</a>. Make sure that it is installed and properly configured. </p>
<p> Open an MS-DOS Prompt. Change to the "Borland\freebcc" directory under
the SDL source directory. Type "make -f SDL.mak" to build SDL and "make
-f SDLmain.mak". There are also makefiles for all of the <a
href="#tests">test programs</a>, if you wish to build them. All .exes and
DLLs are created in the "test" SDL directory. Ify ou would like to create
the DLL and all the test applications, I have thrown together a basic batchfile
called "makeall.bat" which should create everything in the right order. </p>
<h3> <b> Output files </b> </h3>
No matter which compiler you used, three important files should have
been produced:
<ul>
<li> SDL.dll ( Borland format ) </li>
<li> SDL.lib&nbsp;( Borland format ) </li>
<li> SDLmain.lib&nbsp;( Borland format ) </li>
</ul>
Both of the *.lib files will need to be added to all the projects
that use SDL and SDL.dll must be placed some where the Windows dynamic
linker can find it (either in your project directory or on the system
path, C:\WINDOWS\SYSTEM).
<h3> <b><a name="k3"></a> Using Borland C++ Builder for Linux ( AKA Kylix
3 ) </b> </h3>
<p> Inside of the "Borland" directory there is a "k3" directory that contains
a number of Builder project files. Double-click on the "libSDL.bpg" file
icon. Once Builder has started click on the "<u>P</u>rojects" menu on
the menu-bar and go down to "B<u>u</u>ild All Projects" option. This will
proceed to build all the <a href="#tests">test programs</a>.&nbsp;<br>
Linux users do not need *.lib files as the Shared Object is linked right
into the project ( very neat actually, Windows should do this sort of thing
as it is a lot easier for the developer ). <br>
<b>NOTE :</b>&nbsp;The C++ Builder for Windows project format, is not
compatible with the Kylix 3 project format, hence the reason why they are
in separate directories.</p>
<p> On Mandrake 8.1 the shared objects for SDL are located in the /usr/lib
directory as libSDL_*.so and the Mesa OpenGL shared objects are located
in /usr/X11R6/lib as libGL*.so<br>
<br>
So if your setup is different you may need to change the project file
so that they re-link to the ones on your system.<br>
<br>
On Mandrake 8.1 the headers files are located at /usr/include/SDL/.
So if you you have not installed the development RPMs ( usually named libSDL-devel*
) for SDL ( not included ) you may have to change the include directory
within some of the projects.<br>
</p>
<h3> Known Problems</h3>
The only known problem is that I ( Dominique Louis ), was unable to
create the projects that rebuilt the SDL shared objects under Linux, due
to time constraints and my lack of intimate knowledge of Linux.
<h3><a name="tests"><b> Test programs </b> </a></h3>
Some of the test programs require included media files ( *.wav; *.bmp
etc ). All the test programs are now created in the "test" directory, where
the media files are ( usually ) so they should be ready to go. <br>
<br>
<br>
<br>
</body>
</html>

Binary file not shown.

458
ws2010/gdi3/p5/SDL/COPYING Normal file
View File

@ -0,0 +1,458 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS

View File

@ -0,0 +1,94 @@
Simple DirectMedia Layer CREDITS
Thanks to everyone who made this possible, including:
* Cliff Matthews, for giving me a reason to start this project. :)
-- Executor rocks! *grin*
* Scott Call, for making a home for SDL on the 'Net... Thanks! :)
* The Linux Fund, C Magazine, Educational Technology Resources Inc.,
Gareth Noyce, Jesse Pavel, Keith Kitchin, Jeremy Horvath, Thomas Nicholson,
Hans-Peter Gygax, the Eternal Lands Development Team, Lars Brubaker,
and Phoenix Kokido for financial contributions
* Gaëtan de Menten for writing the PHP and SQL behind the SDL website
* Tim Jones for the new look of the SDL website
* Marco Kraus for setting up SDL merchandise
* Martin Donlon for his work on the SDL Documentation Project
* Ryan Gordon for helping everybody out and keeping the dream alive. :)
* IBM R&D Lab for their PS3 SPE video acceleration code
* Mattias Engdegård, for help with the Solaris port and lots of other help
* Max Watson, Matt Slot, and Kyle for help with the MacOS Classic port
* Stan Shebs, for the initial Mac OS X port
* Eric Wing, Max Horn, and Darrell Walisser for unflagging work on the Mac OS X port
* Patrick Trainor, Jim Boucher, and Mike Gorchak for the QNX Neutrino port
* Carsten Griwodz for the AIX port
* Gabriele Greco, for the Amiga port
* Patrice Mandin, for the Atari port
* Hannu Viitala for the EPOC port
* Marcus Mertama for the S60 port.
* Peter Valchev for nagging me about the OpenBSD port until I got it right. :)
* Kent B Mein, for a place to do the IRIX port
* Ash, for a place to do the OSF/1 Alpha port
* David Sowsy, for help with the BeOS port
* Eugenia Loli, for endless work on porting SDL games to BeOS
* Jon Taylor for the GGI front-end
* Paulus Esterhazy, for the Visual C++ testing and libraries
* Brenda Tantzen, for Metrowerks CodeWarrior on MacOS
* Chris Nentwich, for the Hermes assembly blitters
* Michael Vance and Jim Kutter for the X11 OpenGL support
* Stephane Peter, for the AAlib front-end and multi-threaded timer idea.
* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation
* Peter Wiklund, for the 1998 winning SDL logo,
and Arto Hamara, Steven Wong, and Kent Mein for other logo entries.
* Arne Claus, for the 2004 winning SDL logo,
and Shandy Brown, Jac, Alex Lyman, Mikkel Gjoel, #Guy, Jonas Hartmann,
Daniel Liljeberg, Ronald Sowa, DocD, Pekka Jaervinen, Patrick Avella,
Erkki Kontilla, Levon Gavalian, Hal Emerich, David Wiktorsson,
S. Schury and F. Hufsky, Ciska de Ruyver, Shredweat, Tyler Montbriand,
Martin Andersson, Merlyn Wysard, Fernando Ibanez, David Miller,
Andre Bommele, lovesby.com, Francisco Camenforte Torres, and David Igreja
for other logo entries.
* Bob Pendleton and David Olofson for being long time contributors to
the SDL mailing list.
* Everybody at Loki Software, Inc. for their great contributions!
And a big hand to everyone else who gave me appreciation, advice,
and suggestions, especially the good folks on the SDL mailing list.
THANKS! :)
-- Sam Lantinga <slouken@libsdl.org>

Binary file not shown.

View File

@ -0,0 +1,23 @@
To compile and install SDL:
1. Run './configure; make; make install'
If you are compiling for Windows using gcc, read the FAQ at:
http://www.libsdl.org/faq.php?action=listentries&category=4#42
If you are compiling using Visual C++ on Win32, you should read
the file VisualC.html
2. Look at the example programs in ./test, and check out the HTML
documentation in ./docs to see how to use the SDL library.
3. Join the SDL developer mailing list by sending E-mail to
sdl-request@libsdl.org
and put "subscribe" in the subject of the message.
Or alternatively you can use the web interface:
http://www.libsdl.org/mailing-list.php
That's it!
Sam Lantinga <slouken@libsdl.org>

Binary file not shown.

183
ws2010/gdi3/p5/SDL/Makefile Normal file
View File

@ -0,0 +1,183 @@
# Makefile to build and install the SDL library
top_builddir = .
srcdir = .
objects = build
depend = build-deps
prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include
datarootdir = ${prefix}/share
datadir = ${datarootdir}
mandir = ${datarootdir}/man
auxdir = build-scripts
distpath = $(srcdir)/..
distdir = SDL-1.2.14
distfile = $(distdir).tar.gz
SHELL = /bin/sh
CC = gcc
INCLUDE = -I./include
CFLAGS = -g -O2
EXTRA_CFLAGS = -I./include -D_GNU_SOURCE=1 -fvisibility=hidden -DXTHREADS -I/usr/include/directfb -D_REENTRANT -D_REENTRANT -DHAVE_LINUX_VERSION_H
LDFLAGS =
EXTRA_LDFLAGS = -lm -ldl -L/usr/lib -ldirectfb -lfusion -ldirect -lpthread -lpthread
LIBTOOL = $(SHELL) $(top_builddir)/libtool
INSTALL = /usr/bin/install -c
NASM = /usr/local/bin/yasm -f elf -I ./src/hermes/ -DHIDDEN_VISIBILITY
AR = ar
RANLIB = ranlib
WINDRES =
TARGET = libSDL.la
SOURCES = ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c ./src/joystick/*.c ./src/video/dummy/*.c ./src/audio/disk/*.c ./src/audio/dummy/*.c ./src/loadso/dlopen/*.c ./src/hermes/*.asm ./src/audio/dsp/*.c ./src/audio/dma/*.c ./src/audio/esd/*.c ./src/video/x11/*.c ./src/video/Xext/Xxf86dga/*.c ./src/video/dga/*.c ./src/video/Xext/Xxf86vm/*.c ./src/video/Xext/Xv/*.c ./src/video/Xext/Xinerama/*.c ./src/video/Xext/XME/*.c ./src/video/fbcon/*.c ./src/video/directfb/*.c ./src/thread/pthread/SDL_systhread.c ./src/thread/pthread/SDL_syssem.c ./src/thread/pthread/SDL_sysmutex.c ./src/thread/pthread/SDL_syscond.c ./src/joystick/linux/*.c ./src/cdrom/linux/*.c ./src/timer/unix/*.c
OBJECTS = $(objects)/SDL.lo $(objects)/SDL_error.lo $(objects)/SDL_fatal.lo $(objects)/SDL_audio.lo $(objects)/SDL_audiocvt.lo $(objects)/SDL_audiodev.lo $(objects)/SDL_mixer.lo $(objects)/SDL_mixer_MMX.lo $(objects)/SDL_mixer_MMX_VC.lo $(objects)/SDL_mixer_m68k.lo $(objects)/SDL_wave.lo $(objects)/SDL_cdrom.lo $(objects)/SDL_cpuinfo.lo $(objects)/SDL_active.lo $(objects)/SDL_events.lo $(objects)/SDL_expose.lo $(objects)/SDL_keyboard.lo $(objects)/SDL_mouse.lo $(objects)/SDL_quit.lo $(objects)/SDL_resize.lo $(objects)/SDL_rwops.lo $(objects)/SDL_getenv.lo $(objects)/SDL_iconv.lo $(objects)/SDL_malloc.lo $(objects)/SDL_qsort.lo $(objects)/SDL_stdlib.lo $(objects)/SDL_string.lo $(objects)/SDL_thread.lo $(objects)/SDL_timer.lo $(objects)/SDL_RLEaccel.lo $(objects)/SDL_blit.lo $(objects)/SDL_blit_0.lo $(objects)/SDL_blit_1.lo $(objects)/SDL_blit_A.lo $(objects)/SDL_blit_N.lo $(objects)/SDL_bmp.lo $(objects)/SDL_cursor.lo $(objects)/SDL_gamma.lo $(objects)/SDL_pixels.lo $(objects)/SDL_stretch.lo $(objects)/SDL_surface.lo $(objects)/SDL_video.lo $(objects)/SDL_yuv.lo $(objects)/SDL_yuv_mmx.lo $(objects)/SDL_yuv_sw.lo $(objects)/SDL_joystick.lo $(objects)/SDL_nullevents.lo $(objects)/SDL_nullmouse.lo $(objects)/SDL_nullvideo.lo $(objects)/SDL_diskaudio.lo $(objects)/SDL_dummyaudio.lo $(objects)/SDL_sysloadso.lo $(objects)/mmx_main.lo $(objects)/mmxp2_32.lo $(objects)/x86_main.lo $(objects)/x86p_16.lo $(objects)/x86p_32.lo $(objects)/SDL_dspaudio.lo $(objects)/SDL_dmaaudio.lo $(objects)/SDL_esdaudio.lo $(objects)/SDL_x11dga.lo $(objects)/SDL_x11dyn.lo $(objects)/SDL_x11events.lo $(objects)/SDL_x11gamma.lo $(objects)/SDL_x11gl.lo $(objects)/SDL_x11image.lo $(objects)/SDL_x11modes.lo $(objects)/SDL_x11mouse.lo $(objects)/SDL_x11video.lo $(objects)/SDL_x11wm.lo $(objects)/SDL_x11yuv.lo $(objects)/XF86DGA.lo $(objects)/XF86DGA2.lo $(objects)/SDL_dgaevents.lo $(objects)/SDL_dgamouse.lo $(objects)/SDL_dgavideo.lo $(objects)/XF86VMode.lo $(objects)/Xv.lo $(objects)/Xinerama.lo $(objects)/xme.lo $(objects)/SDL_fb3dfx.lo $(objects)/SDL_fbelo.lo $(objects)/SDL_fbevents.lo $(objects)/SDL_fbmatrox.lo $(objects)/SDL_fbmouse.lo $(objects)/SDL_fbriva.lo $(objects)/SDL_fbvideo.lo $(objects)/SDL_DirectFB_events.lo $(objects)/SDL_DirectFB_video.lo $(objects)/SDL_DirectFB_yuv.lo $(objects)/SDL_systhread.lo $(objects)/SDL_syssem.lo $(objects)/SDL_sysmutex.lo $(objects)/SDL_syscond.lo $(objects)/SDL_sysjoystick.lo $(objects)/SDL_syscdrom.lo $(objects)/SDL_systimer.lo
SDLMAIN_TARGET = libSDLmain.a
SDLMAIN_SOURCES = ./src/main/dummy/*.c
SDLMAIN_OBJECTS = $(objects)/SDL_dummy_main.o
DIST = acinclude autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in MPWmake.sea.bin README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip symbian.zip WhatsNew Xcode.tar.gz
HDRS = SDL.h SDL_active.h SDL_audio.h SDL_byteorder.h SDL_cdrom.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_getenv.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_platform.h SDL_quit.h SDL_rwops.h SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
LT_AGE = 11
LT_CURRENT = 11
LT_RELEASE = 1.2
LT_REVISION = 3
LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(srcdir)/configure: $(srcdir)/configure.in
@echo "Warning, configure.in is out of date"
#(cd $(srcdir) && sh autogen.sh && sh configure)
@sleep 3
Makefile: $(srcdir)/Makefile.in
$(SHELL) config.status $@
$(objects):
$(SHELL) $(auxdir)/mkinstalldirs $@
.PHONY: all depend install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist
depend:
@SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \
$(SHELL) $(auxdir)/makedep.sh
@for src in $(SDLMAIN_SOURCES); do \
obj=`echo $$src | sed -e 's|.*/||' -e 's|\.[^\.]*$$|.o|'`; \
echo "\$$(objects)/$$obj: $$src" >>$(depend); \
echo " \$$(CC) \$$(CFLAGS) \$$(EXTRA_CFLAGS) -c $$src -o \$$@" >>$(depend); \
done
include $(depend)
$(objects)/$(TARGET): $(OBJECTS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
$(AR) cru $@ $(SDLMAIN_OBJECTS)
$(RANLIB) $@
install: all install-bin install-hdrs install-lib install-data install-man
install-bin:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
$(INSTALL) -m 755 sdl-config $(DESTDIR)$(bindir)/sdl-config
install-hdrs:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL
for file in $(HDRS); do \
$(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \
done
$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
$(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
$(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
install-data:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
$(INSTALL) -m 644 $(srcdir)/sdl.m4 $(DESTDIR)$(datadir)/aclocal/sdl.m4
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 644 sdl.pc $(DESTDIR)$(libdir)/pkgconfig
install-man:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(mandir)/man3
for src in $(srcdir)/docs/man3/*.3; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
$(INSTALL) -m 644 $$src $(DESTDIR)$(mandir)/man3/$$file; \
done
uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man
uninstall-bin:
rm -f $(DESTDIR)$(bindir)/sdl-config
uninstall-hdrs:
for file in $(HDRS); do \
rm -f $(DESTDIR)$(includedir)/SDL/$$file; \
done
rm -f $(DESTDIR)$(includedir)/SDL/SDL_config.h
-rmdir $(DESTDIR)$(includedir)/SDL
uninstall-lib:
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
uninstall-data:
rm -f $(DESTDIR)$(datadir)/aclocal/sdl.m4
rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl.pc
uninstall-man:
for src in $(srcdir)/docs/man3/*.3; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
rm -f $(DESTDIR)$(mandir)/man3/$$file; \
done
clean:
rm -rf $(objects)
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
distclean: clean
rm -f Makefile include/SDL_config.h sdl-config
rm -f SDL.qpg
rm -f config.status config.cache config.log libtool $(depend)
rm -rf $(srcdir)/autom4te*
rm -rf $(srcdir)/test/autom4te*
find $(srcdir) \( \
-name '*~' -o \
-name '*.bak' -o \
-name '*.old' -o \
-name '*.rej' -o \
-name '*.orig' -o \
-name '.#*' \) \
-exec rm -f {} \;
cp $(srcdir)/include/SDL_config.h.default $(srcdir)/include/SDL_config.h
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
dist $(distfile):
$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
tar cf - $(DIST) | (cd $(distdir); tar xf -)
cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h
rm -rf `find $(distdir) -name .svn`
rm -rf $(distdir)/test/autom4te*
find $(distdir) \( \
-name '*~' -o \
-name '*.bak' -o \
-name '*.old' -o \
-name '*.rej' -o \
-name '*.orig' -o \
-name '.#*' \) \
-exec rm -f {} \;
if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
tar cvf - $(distdir) | gzip --best >$(distfile)
rm -rf $(distdir)
rpm: $(distfile)
rpmbuild -ta $?
# Create a SVN snapshot that people can run update on
snapshot:
svn co http://svn.libsdl.org/branches/SDL-1.2
(cd SDL-1.2 && ./autogen.sh && rm -rf autom4te.cache)
cp SDL-1.2/include/SDL_config.h.default SDL-1.2/include/SDL_config.h
tar zcf $(HOME)/SDL-1.2.tar.gz SDL-1.2
rm -f $(HOME)/SDL-1.2.zip
zip -r $(HOME)/SDL-1.2.zip SDL-1.2
rm -rf SDL-1.2

View File

@ -0,0 +1,111 @@
#GL=1
CC = sh-elf-gcc
AR = sh-elf-ar
ifdef GL
DEFS += -DSDL_VIDEO_OPENGL=1
TARGET = libSDL_gl.a
else
TARGET = libSDL.a
endif
CFLAGS=$(KOS_CFLAGS) $(DEFS) -Iinclude
SRCS = \
src/audio/dc/SDL_dcaudio.c \
src/audio/dc/aica.c \
src/audio/dummy/SDL_dummyaudio.c \
src/audio/SDL_audio.c \
src/audio/SDL_audiocvt.c \
src/audio/SDL_audiodev.c \
src/audio/SDL_mixer.c \
src/audio/SDL_wave.c \
src/cdrom/dc/SDL_syscdrom.c \
src/cdrom/SDL_cdrom.c \
src/events/SDL_active.c \
src/events/SDL_events.c \
src/events/SDL_expose.c \
src/events/SDL_keyboard.c \
src/events/SDL_mouse.c \
src/events/SDL_quit.c \
src/events/SDL_resize.c \
src/file/SDL_rwops.c \
src/joystick/dc/SDL_sysjoystick.c \
src/joystick/SDL_joystick.c \
src/loadso/dummy/SDL_sysloadso.c \
src/SDL.c \
src/SDL_error.c \
src/SDL_fatal.c \
src/stdlib/SDL_getenv.c \
src/stdlib/SDL_iconv.c \
src/stdlib/SDL_malloc.c \
src/stdlib/SDL_qsort.c \
src/stdlib/SDL_stdlib.c \
src/stdlib/SDL_string.c \
src/thread/dc/SDL_syscond.c \
src/thread/dc/SDL_sysmutex.c \
src/thread/dc/SDL_syssem.c \
src/thread/dc/SDL_systhread.c \
src/thread/SDL_thread.c \
src/timer/dc/SDL_systimer.c \
src/timer/SDL_timer.c \
src/video/dc/SDL_dcevents.c \
src/video/dc/SDL_dcvideo.c \
src/video/dummy/SDL_nullevents.c \
src/video/dummy/SDL_nullmouse.c \
src/video/dummy/SDL_nullvideo.c \
src/video/SDL_blit.c \
src/video/SDL_blit_0.c \
src/video/SDL_blit_1.c \
src/video/SDL_blit_A.c \
src/video/SDL_blit_N.c \
src/video/SDL_bmp.c \
src/video/SDL_cursor.c \
src/video/SDL_gamma.c \
src/video/SDL_pixels.c \
src/video/SDL_RLEaccel.c \
src/video/SDL_stretch.c \
src/video/SDL_surface.c \
src/video/SDL_video.c \
src/video/SDL_yuv.c \
src/video/SDL_yuv_sw.c \
OBJS = $(SRCS:.c=.o)
TEST = \
test/checkkeys.c \
test/graywin.c \
test/loopwave.c \
test/testalpha.c \
test/testbitmap.c \
test/testcdrom.c \
test/testerror.c \
test/testgamma.c \
test/testgl.c \
test/testhread.c \
test/testjoystick.c \
test/testkeys.c \
test/testlock.c \
test/testoverlay.c \
test/testpalette.c \
test/testsem.c \
test/testsprite.c \
test/testtimer.c \
test/testtypes.c \
test/testver.c \
test/testvidinfo.c \
test/testwin.c \
test/testwm.c \
test/threadwin.c \
test/torturethread.c \
$(TARGET): copy_config \
$(OBJS)
$(AR) rcs $(TARGET) $(OBJS)
copy_config:
@cp include/SDL_config.h.default include/SDL_config.h
clean:
rm -f include/SDL_config.h $(OBJS)

View File

@ -0,0 +1,183 @@
# Makefile to build and install the SDL library
top_builddir = .
srcdir = @srcdir@
objects = build
depend = build-deps
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
datarootdir = @datarootdir@
datadir = @datadir@
mandir = @mandir@
auxdir = @ac_aux_dir@
distpath = $(srcdir)/..
distdir = SDL-@SDL_VERSION@
distfile = $(distdir).tar.gz
@SET_MAKE@
SHELL = @SHELL@
CC = @CC@
INCLUDE = @INCLUDE@
CFLAGS = @BUILD_CFLAGS@
EXTRA_CFLAGS = @EXTRA_CFLAGS@
LDFLAGS = @BUILD_LDFLAGS@
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
LIBTOOL = @LIBTOOL@
INSTALL = @INSTALL@
NASM = @NASM@ @NASMFLAGS@
AR = @AR@
RANLIB = @RANLIB@
WINDRES = @WINDRES@
TARGET = libSDL.la
SOURCES = @SOURCES@
OBJECTS = @OBJECTS@
SDLMAIN_TARGET = libSDLmain.a
SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
DIST = acinclude autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in MPWmake.sea.bin README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip symbian.zip WhatsNew Xcode.tar.gz
HDRS = SDL.h SDL_active.h SDL_audio.h SDL_byteorder.h SDL_cdrom.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_getenv.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_platform.h SDL_quit.h SDL_rwops.h SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(srcdir)/configure: $(srcdir)/configure.in
@echo "Warning, configure.in is out of date"
#(cd $(srcdir) && sh autogen.sh && sh configure)
@sleep 3
Makefile: $(srcdir)/Makefile.in
$(SHELL) config.status $@
$(objects):
$(SHELL) $(auxdir)/mkinstalldirs $@
.PHONY: all depend install install-bin install-hdrs install-lib install-data install-man uninstall uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man clean distclean dist
depend:
@SOURCES="$(SOURCES)" INCLUDE="$(INCLUDE)" output="$(depend)" \
$(SHELL) $(auxdir)/makedep.sh
@for src in $(SDLMAIN_SOURCES); do \
obj=`echo $$src | sed -e 's|.*/||' -e 's|\.[^\.]*$$|.o|'`; \
echo "\$$(objects)/$$obj: $$src" >>$(depend); \
echo " \$$(CC) \$$(CFLAGS) \$$(EXTRA_CFLAGS) -c $$src -o \$$@" >>$(depend); \
done
include $(depend)
$(objects)/$(TARGET): $(OBJECTS)
$(LIBTOOL) --mode=link $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS)
$(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
$(AR) cru $@ $(SDLMAIN_OBJECTS)
$(RANLIB) $@
install: all install-bin install-hdrs install-lib install-data install-man
install-bin:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
$(INSTALL) -m 755 sdl-config $(DESTDIR)$(bindir)/sdl-config
install-hdrs:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL
for file in $(HDRS); do \
$(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \
done
$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
$(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
$(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
install-data:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
$(INSTALL) -m 644 $(srcdir)/sdl.m4 $(DESTDIR)$(datadir)/aclocal/sdl.m4
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 644 sdl.pc $(DESTDIR)$(libdir)/pkgconfig
install-man:
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(mandir)/man3
for src in $(srcdir)/docs/man3/*.3; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
$(INSTALL) -m 644 $$src $(DESTDIR)$(mandir)/man3/$$file; \
done
uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man
uninstall-bin:
rm -f $(DESTDIR)$(bindir)/sdl-config
uninstall-hdrs:
for file in $(HDRS); do \
rm -f $(DESTDIR)$(includedir)/SDL/$$file; \
done
rm -f $(DESTDIR)$(includedir)/SDL/SDL_config.h
-rmdir $(DESTDIR)$(includedir)/SDL
uninstall-lib:
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
uninstall-data:
rm -f $(DESTDIR)$(datadir)/aclocal/sdl.m4
rm -f $(DESTDIR)$(libdir)/pkgconfig/sdl.pc
uninstall-man:
for src in $(srcdir)/docs/man3/*.3; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
rm -f $(DESTDIR)$(mandir)/man3/$$file; \
done
clean:
rm -rf $(objects)
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
distclean: clean
rm -f Makefile include/SDL_config.h sdl-config
rm -f SDL.qpg
rm -f config.status config.cache config.log libtool $(depend)
rm -rf $(srcdir)/autom4te*
rm -rf $(srcdir)/test/autom4te*
find $(srcdir) \( \
-name '*~' -o \
-name '*.bak' -o \
-name '*.old' -o \
-name '*.rej' -o \
-name '*.orig' -o \
-name '.#*' \) \
-exec rm -f {} \;
cp $(srcdir)/include/SDL_config.h.default $(srcdir)/include/SDL_config.h
if test -f test/Makefile; then (cd test; $(MAKE) $@); fi
dist $(distfile):
$(SHELL) $(auxdir)/mkinstalldirs $(distdir)
tar cf - $(DIST) | (cd $(distdir); tar xf -)
cp $(distdir)/include/SDL_config.h.default $(distdir)/include/SDL_config.h
rm -rf `find $(distdir) -name .svn`
rm -rf $(distdir)/test/autom4te*
find $(distdir) \( \
-name '*~' -o \
-name '*.bak' -o \
-name '*.old' -o \
-name '*.rej' -o \
-name '*.orig' -o \
-name '.#*' \) \
-exec rm -f {} \;
if test -f $(distdir)/test/Makefile; then (cd $(distdir)/test && make distclean); fi
tar cvf - $(distdir) | gzip --best >$(distfile)
rm -rf $(distdir)
rpm: $(distfile)
rpmbuild -ta $?
# Create a SVN snapshot that people can run update on
snapshot:
svn co http://svn.libsdl.org/branches/SDL-1.2
(cd SDL-1.2 && ./autogen.sh && rm -rf autom4te.cache)
cp SDL-1.2/include/SDL_config.h.default SDL-1.2/include/SDL_config.h
tar zcf $(HOME)/SDL-1.2.tar.gz SDL-1.2
rm -f $(HOME)/SDL-1.2.zip
zip -r $(HOME)/SDL-1.2.zip SDL-1.2
rm -rf SDL-1.2

View File

@ -0,0 +1,42 @@
# Makefile to build the SDL library
INCLUDE = -I./include
CFLAGS = -g -O2 $(INCLUDE)
AR = ar
RANLIB = ranlib
CONFIG_H = include/SDL_config.h
TARGET = libSDL.a
SOURCES = \
src/*.c \
src/audio/*.c \
src/cdrom/*.c \
src/cpuinfo/*.c \
src/events/*.c \
src/file/*.c \
src/joystick/*.c \
src/stdlib/*.c \
src/thread/*.c \
src/timer/*.c \
src/video/*.c \
src/audio/dummy/*.c \
src/video/dummy/*.c \
src/joystick/dummy/*.c \
src/cdrom/dummy/*.c \
src/thread/generic/*.c \
src/timer/dummy/*.c \
src/loadso/dummy/*.c \
OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
all: $(TARGET)
$(TARGET): $(CONFIG_H) $(OBJECTS)
$(AR) crv $@ $^
$(RANLIB) $@
$(CONFIG_H):
cp $(CONFIG_H).default $(CONFIG_H)
clean:
rm -f $(TARGET) $(OBJECTS)

49
ws2010/gdi3/p5/SDL/README Normal file
View File

@ -0,0 +1,49 @@
Simple DirectMedia Layer
(SDL)
Version 1.2
---
http://www.libsdl.org/
This is the Simple DirectMedia Layer, a general API that provides low
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
and 2D framebuffer across multiple platforms.
The current version supports Linux, Windows CE/95/98/ME/XP/Vista, BeOS,
MacOS Classic, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX,
and QNX. The code contains support for Dreamcast, Atari, AIX, OSF/Tru64,
RISC OS, SymbianOS, Nintendo DS, and OS/2, but these are not officially
supported.
SDL is written in C, but works with C++ natively, and has bindings to
several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,
Guile, Haskell, Java, Lisp, Lua, ML, Objective C, Pascal, Perl, PHP,
Pike, Pliant, Python, Ruby, and Smalltalk.
This library is distributed under GNU LGPL version 2, which can be
found in the file "COPYING". This license allows you to use SDL
freely in commercial programs as long as you link with the dynamic
library.
The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date.
More documentation is available in HTML format in "docs/index.html", and
a documentation wiki is available online at:
http://www.libsdl.org/cgi/docwiki.cgi
The test programs in the "test" subdirectory are in the public domain.
Frequently asked questions are answered online:
http://www.libsdl.org/faq.php
If you need help with the library, or just want to discuss SDL related
issues, you can join the developers mailing list:
http://www.libsdl.org/mailing-list.php
Enjoy!
Sam Lantinga (slouken@libsdl.org)

View File

@ -0,0 +1,13 @@
Please distribute this file with the SDL runtime environment:
The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library
designed to make it easy to write multi-media software, such as games and
emulators.
The Simple DirectMedia Layer library source code is available from:
http://www.libsdl.org/
This library is distributed under the terms of the GNU LGPL license:
http://www.gnu.org/copyleft/lesser.html

View File

@ -0,0 +1,12 @@
The AmigaOS code has been removed from SDL, since it had been broken for a
long time and had a few bits of fairly invasive code #ifdef'd into the
SDL core.
However, there is an OS4 version of SDL here:
http://www.rcdrummond.net/amiga/index.html
And a MorphOS version here:
http://www.lehtoranta.net/powersdl/
--ryan.

View File

@ -0,0 +1,13 @@
SDL on BeOS R5
==============
You can build SDL on BeOS like any other GNU style package.
e.g. ./configure && make && make install
By default it is installed in /boot/develop/tools/gnupro/{bin,lib,etc.}
Once you install SDL, you need to copy libSDL.so to /boot/home/config/lib,
so it can be found by the dynamic linker.
Enjoy!
Sam Lantinga (slouken@libsdl.org)

View File

@ -0,0 +1,4 @@
SDL is no longer hosted in a CVS repository. Please see README.SVN for
information on accessing our Subversion repository.

View File

@ -0,0 +1,32 @@
SDL for Dreamcast (beta2)
BERO
berobero@users.sourceforge.net
http://www.geocities.co.jp/Playtown/2004/
this work with kos-newlib
http://sourceforge.net/projects/dcquake/
compile
- source environ.sh (from the KOS distribution)
- make -f Makefile.dc
compile with gl support
- install latest libgl from http://sourceforge.net/projects/dcquake/
- uncomment GL=1 in Makefile.dc
- make -f Makefile.dc clean
- make -f Makefile.dc
install
- copy include/*.h and libSDL.a or libSDL_gl.a for your enviroment
changelog:
beta2
- OpenGL support
- Hardware page flip support
beta
- thread, timer don't tested so much.
- not support OpenGL

View File

@ -0,0 +1,63 @@
==============================================================================
Using the Simple DirectMedia Layer with MacOS 7,8,9 on PPC
==============================================================================
These instructions are for people using the Apple MPW environment:
http://developer.apple.com/tools/mpw-tools/
CodeWarrior projects are available in the CWprojects directory.
==============================================================================
I. Building the Simple DirectMedia Layer libraries:
(This step isn't necessary if you have the SDL binary distribution)
First, unpack the MPWmake.sea.hqx archive and move SDL.make into the
SDL directory.
Start MPW
Set the current directory within MPW to the SDL toplevel directory.
Build "SDL" (Type Command-B and enter "SDL" in the dialog)
If everything compiles successfully, you now have the PPC libraries
"SDL" and "SDLmain.o" in the 'lib' subdirectory.
==============================================================================
II. Building the Simple DirectMedia Layer test programs:
First, unpack the MPWmake.sea.hqx archive, move the new rsrc directory to
the main SDL directory, and move the makefiles in the new test subdirectory
to the SDL 'test' subdirectory.
Start MPW
Set the current directory within MPW to the SDL 'test' subdirectory.
Build the programs that have an associated MPW makefile (file ending
with .make), including "testwin", "testalpha", and "graywin".
Copy the SDL library file into the test directory, and run!
==============================================================================
III. Building the Simple DirectMedia Layer demo programs:
Copy one of the test program Makefiles to the demo directory
and modify it to match the sources in the demo.
==============================================================================
IV. Enjoy! :)
If you have a project you'd like me to know about, or want to ask questions,
go ahead and join the SDL developer's mailing list by sending e-mail to:
sdl-request@libsdl.org
and put "subscribe" into the subject of the message. Or alternatively you
can use the web interface:
http://www.libsdl.org/mailman/listinfo/sdl
==============================================================================

View File

@ -0,0 +1,186 @@
==============================================================================
Using the Simple DirectMedia Layer with Mac OS X
==============================================================================
These instructions are for people using Apple's Mac OS X (pronounced
"ten").
From the developer's point of view, OS X is a sort of hybrid Mac and
Unix system, and you have the option of using either traditional
command line tools or Apple's IDE Xcode.
To build SDL using the command line, use the standard configure and make
process:
./configure
make
sudo make install
You can also build SDL as a Universal library (a single binary for both
PowerPC and Intel architectures), on Mac OS X 10.4 and newer, by using
the fatbuild.sh script in build-scripts:
sh build-scripts/fatbuild.sh
sudo build-scripts/fatbuild.sh install
This script builds SDL with 10.2 ABI compatibility on PowerPC and 10.4
ABI compatibility on Intel architectures. For best compatibility you
should compile your application the same way. A script which wraps
gcc to make this easy is provided in test/gcc-fat.sh
To use the library once it's built, you essential have two possibilities:
use the traditional autoconf/automake/make method, or use Xcode.
==============================================================================
Using the Simple DirectMedia Layer with a traditional Makefile
==============================================================================
An existing autoconf/automake build system for your SDL app has good chances
to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary
that you can distribute to users, you need to put the generated binary into a
so called "bundle", which basically is a fancy folder with a name like
"MyCoolGame.app".
To get this build automatically, add something like the following rule to
your Makefile.am:
bundle_contents = APP_NAME.app/Contents
APP_NAME_bundle: EXE_NAME
mkdir -p $(bundle_contents)/MacOS
mkdir -p $(bundle_contents)/Resources
echo "APPL????" > $(bundle_contents)/PkgInfo
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
You should replace EXE_NAME with the name of the executable. APP_NAME is what
will be visible to the user in the Finder. Usually it will be the same
as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME
usually is "TestGame". You might also want to use @PACKAGE@ to use the package
name as specified in your configure.in file.
If your project builds more than one application, you will have to do a bit
more. For each of your target applications, you need a seperate rule.
If you want the created bundles to be installed, you may want to add this
rule to your Makefile.am:
install-exec-hook: APP_NAME_bundle
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
mkdir -p $(DESTDIR)$(prefix)/Applications/
cp -r $< /$(DESTDIR)$(prefix)Applications/
This rule takes the Bundle created by the rule from step 3 and installs them
into $(DESTDIR)$(prefix)/Applications/.
Again, if you want to install multiple applications, you will have to augment
the make rule accordingly.
But beware! That is only part of the story! With the above, you end up with
a bare bone .app bundle, which is double clickable from the Finder. But
there are some more things you should do before shipping yor product...
1) The bundle right now probably is dynamically linked against SDL. That
means that when you copy it to another computer, *it will not run*,
unless you also install SDL on that other computer. A good solution
for this dilemma is to static link against SDL. On OS X, you can
achieve that by linkinag against the libraries listed by
sdl-config --static-libs
instead of those listed by
sdl-config --libs
Depending on how exactly SDL is integrated into your build systems, the
way to achieve that varies, so I won't describe it here in detail
2) Add an 'Info.plist' to your application. That is a special XML file which
contains some meta-information about your application (like some copyright
information, the version of your app, the name of an optional icon file,
and other things). Part of that information is displayed by the Finder
when you click on the .app, or if you look at the "Get Info" window.
More information about Info.plist files can be found on Apple's homepage.
As a final remark, let me add that I use some of the techniques (and some
variations of them) in Exult and ScummVM; both are available in source on
the net, so feel free to take a peek at them for inspiration!
==============================================================================
Using the Simple DirectMedia Layer with Xcode
==============================================================================
These instructions are for using Apple's Xcode IDE to build SDL applications.
- First steps
The first thing to do is to unpack the Xcode.tar.gz archive in the
top level SDL directory (where the Xcode.tar.gz archive resides).
Because Stuffit Expander will unpack the archive into a subdirectory,
you should unpack the archive manually from the command line:
cd [path_to_SDL_source]
tar zxf Xcode.tar.gz
This will create a new folder called Xcode, which you can browse
normally from the Finder.
- Building the Framework
The SDL Library is packaged as a framework bundle, an organized
relocatable folder heirarchy of executible code, interface headers,
and additional resources. For practical purposes, you can think of a
framework as a more user and system-friendly shared library, whose library
file behaves more or less like a standard UNIX shared library.
To build the framework, simply open the framework project and build it.
By default, the framework bundle "SDL.framework" is installed in
/Library/Frameworks. Therefore, the testers and project stationary expect
it to be located there. However, it will function the same in any of the
following locations:
~/Library/Frameworks
/Local/Library/Frameworks
/System/Library/Frameworks
- Build Options
There are two "Build Styles" (See the "Targets" tab) for SDL.
"Deployment" should be used if you aren't tweaking the SDL library.
"Development" should be used to debug SDL apps or the library itself.
- Building the Testers
Open the SDLTest project and build away!
- Using the Project Stationary
Copy the stationary to the indicated folders to access it from
the "New Project" and "Add target" menus. What could be easier?
- Setting up a new project by hand
Some of you won't want to use the Stationary so I'll give some tips:
* Create a new "Cocoa Application"
* Add src/main/macosx/SDLMain.m , .h and .nib to your project
* Remove "main.c" from your project
* Remove "MainMenu.nib" from your project
* Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
* Add "$(HOME)/Library/Frameworks" to the frameworks search path
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
* Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
* Add your files
* Clean and build
- Building from command line
Use pbxbuild in the same directory as your .pbproj file
- Running your app
You can send command line args to your app by either invoking it from
the command line (in *.app/Contents/MacOS) or by entering them in the
"Executibles" panel of the target settings.
- Implementation Notes
Some things that may be of interest about how it all works...
* Working directory
As defined in the SDL_main.m file, the working directory of your SDL app
is by default set to its parent. You may wish to change this to better
suit your needs.
* You have a Cocoa App!
Your SDL app is essentially a Cocoa application. When your app
starts up and the libraries finish loading, a Cocoa procedure is called,
which sets up the working directory and calls your main() method.
You are free to modify your Cocoa app with generally no consequence
to SDL. You cannot, however, easily change the SDL window itself.
Functionality may be added in the future to help this.
Known bugs are listed in the file "BUGS"

View File

@ -0,0 +1,250 @@
==============================================================================
Using the Simple DirectMedia Layer on Atari
==============================================================================
If you want to build SDL from sources to create SDL programs on Atari:
see sections I - II.
If you want to create SDL programs on Atari using SDL binary build,
download it from my web site (URL at end of this file).
If you want to configure a program using SDL on Atari,
see sections IV - VI.
==============================================================================
I. Building the Simple DirectMedia Layer libraries:
(This step isn't necessary if you have the SDL binary distribution)
Do the classic configure, with --disable-shared --enable-static and:
Tos version (should run everywhere):
--disable-threads
Tos does not support threads.
MiNT version (maybe Magic, only for multitasking OS):
--disable-pthreads --enable-pth
Mint and Magic may supports threads, so audio can be used with current
devices, like Sun audio, or disk-writing support. Like Tos, interrupt
audio without threads is more suited for Atari machines.
Then you can make ; make install it.
==============================================================================
II. Building the Simple DirectMedia Layer test programs:
Do the classic configure, then make.
Run them !
==============================================================================
III. Enjoy! :)
If you have a project you'd like me to know about, or want to ask questions,
go ahead and join the SDL developer's mailing list by sending e-mail to:
sdl-request@libsdl.org
and put "subscribe" into the subject of the message. Or alternatively you
can use the web interface:
http://www.libsdl.org/mailman/listinfo/sdl
==============================================================================
IV. What is supported:
Keyboard (GEMDOS, BIOS, GEM, Ikbd)
Mouse (XBIOS, GEM, Ikbd, /dev/mouse (non working atm, disabled))
Video (XBIOS (Fullscreen), GEM (Windowed and Fullscreen))
Timer (VBL vector, GNU pth library)
Joysticks and joypads (Ikbd, Hardware)
Audio (Hardware, XBIOS, GSXB, MCSN, STFA, /dev/audio if threads enabled)
Threads (Multitasking OS only via GNU pth library)
Shared object loader (using LDG library from http://ldg.atari.org/)
Audio CD (MetaDOS)
OpenGL (using Mesa offscreen rendering driver)
- Dependent driver combinations:
Video Kbd Mouse Timer Joysticks
xbios ikbd ikbd vbl(2) ikbd
xbios gemdos xbios vbl(2) xbios
xbios bios xbios vbl(2) xbios
gem gem gem(1) vbl(2) xbios
Audio O/S Misc
dma8 All Uses MFP Timer A interrupt
xbios TOS Uses MFP Timer A interrupt
xbios MiNT Uses MFP Timer A interrupt
xbios Magic Uses MFP Timer A interrupt
stfa All Uses MFP interrupt
mcsn TOS Uses MFP Timer A interrupt
mcsn MiNT Uses MiNT thread
mcsn Magic Disabled
gsxb All Uses GSXB callback
Joypad driver always uses hardware access.
OpenGL driver always uses OSMesa.
(1) GEM does not report relative mouse motion, so xbios mouse driver is used
to report this type event.
A preliminary driver for /dev/mouse device driver is present, but is disabled
till it can be used with other applications simultaneously.
(2) If you build SDL with threads using the GNU pth library, timers are
supported via the pth library.
==============================================================================
V. Environment variables:
SDL_VIDEODRIVER:
Set to 'xbios' to force xbios video driver
Set to 'gem' to force gem video driver
SDL_VIDEO_GL_DRIVER:
Set to filename to load as OpenGL library, if you use SDL_GL_LoadLibrary()
SDL_AUDIODRIVER:
Set to 'mint_gsxb' to force Atari GSXB audio driver
Set to 'mint_mcsn' to force Atari MCSN audio driver
Set to 'mint_stfa' to force Atari STFA audio driver
Set to 'mint_xbios' to force Atari Xbios audio driver
Set to 'mint_dma8' to force Atari 8 bits DMA audio driver
Set to 'audio' to force Sun /dev/audio audio driver
Set to 'disk' to force disk-writing audio driver
SDL_ATARI_EVENTSDRIVER
Set to 'ikbd' to force IKBD 6301 keyboard driver
Set to 'gemdos' to force gemdos keyboard driver
Set to 'bios' to force bios keyboard driver
SDL_JOYSTICK_ATARI:
Use any of these strings in the environment variable to enable or
disable a joystick:
'ikbd-joy1-[on|off]' for IKBD joystick on port 1 (hardware access)
'xbios-joy1-[on|off]' for IKBD joystick on port 1 (xbios access)
'porta-pad-[on|off]' for joypad and/or teamtap on port A
'porta-joy0-[on|off]' for joystick 0 on port A
'porta-joy1-[on|off]' for joystick 1 on port A
'porta-lp-[on|off]' for lightpen on port A
'porta-anpad-[on|off]' for analog paddle on port A
'portb-pad-[on|off]' for joypad and/or teamtap on port B
'portb-joy0-[on|off]' for joystick 0 on port B
'portb-joy1-[on|off]' for joystick 1 on port B
'portb-anpad-[on|off]' for analog paddle on port B
Default configuration is:
'ikbd-joy1-on' (if IKBD events driver enabled)
'xbios-joy1-on' (if gemdos/bios/gem events driver enabled)
'porta-pad-on portb-pad-on' (if available on the machine)
port[a|b]-[pad|joy?|lp|anpad]-* strings are mutually exclusives.
On such a port, you can only use a joypad OR 1 or 2 joysticks OR
a lightpen OR an analog paddle. You must disable joypad before
setting another controller.
The second joystick port on IKBD is used by the mouse, so not usable.
Another problem with the IKBD: mouse buttons and joystick fire buttons
are wired together at the hardware level, it means:
port 0 port 0 port 1
mouse left button = joystick fire 0 = joystick fire 1
mouse right button = joystick fire 1 = joystick fire 0
Descriptions of joysticks/joypads:
- Joypads: 1 hat, 17 buttons (Atari Jaguar console-like).
- Joysticks: 1 hat, 1 button.
- Lightpen, analog paddles: 2 axis, 2 buttons. The 2 buttons are those
affected to 1 button joysticks on the same port.
==============================================================================
VI. More informations about drivers:
OpenGL:
The default is to use the Mesa offscreen driver (osmesa.ldg). If you want
to use an older OpenGL implementation, like mesa_gl.ldg or tiny_gl.ldg,
your program must use SDL_GL_LoadLibrary() to do so, and retrieve the
needed function pointers with SDL_LoadFunction(). In all cases, the OpenGL
context is taken care of by SDL itself, you just have to use gl* functions.
However, there is one OpenGL call that has a different prototype in the old
implementations: glOrtho(). In the old implementations, it has 6 float as
parameters, in the standard one, it has 6 double parameters. If you want
to compile testdyngl, or any other SDL program that loads its OpenGL
library, you must change the glOrtho() prototype used in this program. In
osmesa.ldg, you can retrieve a glOrtho() with double parameters, by
searching for the function "glOrtho6d".
Xbios video:
Video chip is detected using the _VDO cookie.
Screen enhancers are not supported, but could be if you know how to
use them.
ST, STE, Mega ST, Mega STE:
320x200x4 bits, shades of grey, available only for the purpose
of testing SDL.
TT:
320x480x8 and 320x240x8 (software double-lined mode).
Falcon:
All modes supported by the current monitor (RVB or VGA).
BlowUp and Centscreen extended modes, ScreenBlaster 3 current mode.
Milan:
Experimental support
Clones and any machine with monochrome monitor:
Not supported.
Gem video:
Automatically used if xbios not available.
All machines:
Only the current resolution, if 8 bits or higher depth.
IKBD keyboard, mouse and joystick driver:
Available if _MCH cookie is ST, Mega ST, STE, Mega STE, TT or Falcon.
Hades has an IKBD, but xbios is not available for video, so IKBD
driver is disabled.
Gemdos and bios keyboard driver:
Available on all machines.
Mouse and joystick xbios driver:
Available on all machines (I think).
Joypad driver:
Available if _MCH cookie is STE or Falcon. Supports teamtap.
PTH timer driver:
Available with multitasking OS.
VBL timer driver:
Available on all machines (I think).
Audio drivers:
Cookies _SND, MCSN, STFA and GSXB used to detect supported audio
capabilities.
STE, Mega STE, TT:
8 bits DMA (hardware access)
STFA, MCSN or GSXB driver if installed
Falcon:
8 bits DMA (hardware access)
Xbios functions
STFA, MCSN or GSXB driver if installed
Other machines:
STFA, MCSN or GSXB driver if installed
STFA driver:
http://removers.free.fr/softs/stfa.html
GSXB driver:
http://assemsoft.atari.org/gsxb/
MacSound driver:
http://jf.omnis.ch/software/tos/
MagicSound driver (MCSN,GSXB compatible):
http://perso.wanadoo.fr/didierm/
X-Sound driver (GSXB compatible):
http://www.uni-ulm.de/~s_thuth/atari/xsound_e.html
--
Patrice Mandin <patmandin@gmail.com>
http://pmandin.atari.org/

View File

@ -0,0 +1,22 @@
The SDL port to the Nintendo DS
This port uses the devKitPro toolchain, available from:
http://www.devkitpro.org
Precompiled tools for cross-compiling on Linux are available from:
http://www.libsdl.org/extras/nds/devkitPro-20070503-linux.tar.gz
todo:
add ds console specific features/optimizations
mouse/keyboard support
dual screen support
build with:
cp include/SDL_config_nds.h include/SDL_config.h
make -f Makefile.ds
included is an arm9/arm7 template to allow for sound streaming support.
Enjoy, fix the source and share :)
Troy Davis(GPF)
http://gpf.dcemu.co.uk/

View File

@ -0,0 +1,97 @@
=================================================================
Patch version 0.9 of SDL(Simple DirectMedia Layer) for Nano-X API
=================================================================
Authors: Hsieh-Fu Tsai, clare@setabox.com
Greg Haerr, greg@censoft.com
This patch is against SDL version 1.2.4.
It enhances previous patch 0.8 by providing direct framebuffer
access as well as dynamic hardware pixel type support, not
requiring a compile-time option setting for different framebuffer
modes.
Tested against Microwindows version 0.89pre9.
Older Microwindows versions
===========================
If running on a version older than Microwindows 0.89pre9,
the following items might need to be patched in Microwindows.
1. Patch src/nanox/client.c::GrClose()
It fixes the client side GrClose(). In the original version,
GrOpen() can only be called once. When the GrOpen() is called at
the second time, the program will terminate. In order to prevent
this situation, we need to insert "nxSocket = -1" after
"close(nxSocket)" in GrClose(). If you do not have this problem,
you may skip this step.
2. Patch src/nanox/clientfb.c to return absolute x,y coordinates
when using GrGetWindowFBInfo(). Copy the version 0.89pre9
of src/nanox/clientfb.c to your system, or configure
using --disable-nanox-direct-fb.
=============
Quick Install
=============
1. ./configure --disable-video-x11 --disable-video-fbcon \
--enable-video-nanox \
--with-nanox-pixel-type=[rgb/0888/888/565/555/332/pal]
2. make clean
3. make
4. make install (as root)
============
Nitty-gritty
============
--enable-nanox-direct-fb Use direct framebuffer access
--enable-nanox-debug Show debug messages
--enable-nanox-share-memory Use shared-memory to speed up
When running multi-threaded applications using SDL, such
as SMPEG, set THREADSAFE=Y in Microwindows' config file,
to enable GrXXX() system call critical section support.
=============================================
Some programs can be used to test this patch.
=============================================
1. http://www.cs.berkeley.edu/~weimer/atris (a tetris-like game)
2. http://www.libsdl.org/projects/newvox/
3. http://www.libsdl.org/projects/xflame/
4. http://www.libsdl.org/projects/optimum/
5. http://www.gnugeneration.com/software/loop/
6: http://www.lokigames.com/development/smpeg.php3 (SMPEG version 0.4.4)
=========
Todo List
=========
1. Create hardware surface
2. Create YUVOverlay on hardware
3. Use OpenGL
4. Gamma correction
5. Hide/Change mouse pointer
6. Better window movement control with direct fb access
7. Palette handling in 8bpp could be improved
=====================
Supporting Institutes
=====================
Many thanks to go to Setabox Co., Ltd. and CML (Communication and
Multimedia Laboratory, http://www.cmlab.csie.ntu.edu.tw/) in the
Department of Computer Science and Information Engineering of
National Taiwan University for supporting this porting project.
Century Embedded Technologies (http://embedded.censoft.com)
for this patch.
===================
Contact Information
===================
Welcome to give me any suggestion and to report bugs.
My e-mail address : clare@setabox.com or niky@cmlab.csie.ntu.edu.tw
or greg@censoft.com

View File

@ -0,0 +1,281 @@
===========
SDL on OS/2
===========
Last updated on May. 17, 2006.
1. How to compile?
------------------
To compile this, you'll need the followings installed:
- The OS/2 Developer's Toolkit
- The OpenWatcom compiler
(http://www.openwatcom.org)
First of all, you have to unzip the Watcom-OS2.zip file. This will result in a
file called "makefile" and a file called "setvars.cmd" in this folder (and some
more files...).
Please edit the second, fourth and fifth lines of setvars.cmd file
to set the folders where the toolkit, the OW compiler and the FSLib are.
You won't need NASM yet (The Netwide Assembler), you can leave that line.
Run setvars.cmd, and you should get a shell in which you can
compile SDL.
Check the "makefile" file. There is a line in there which determines if the
resulting SDL.DLL will be a 'debug' or a 'release' build. The 'debug' version
is full of printf()'s, so if something goes wrong, its output can help a lot
for debugging.
Then run "wmake".
This should create the SDL12.DLL and the corresponding SDL12.LIB file here.
To test applications, it's a good idea to use the 'debug' build of SDL, and
redirect the standard output and standard error output to files, to see what
happens internally in SDL.
(like: testsprite >stdout.txt 2>stderr.txt)
To rebuild SDL, use the following commands in this folder:
wmake clean
wmake
2. How to compile the testapps?
-------------------------------
Once you have SDL12.DLL compiled, navigate into the 'test' folder, copy in
there the newly built SDL12.DLL, and copy in there FSLib.DLL.
Then run "wmake" in there to compile some of the testapps.
3. What is missing?
-------------------
The following things are missing from this SDL implementation:
- MMX, SSE and 3DNOW! optimized video blitters?
- HW Video surfaces
- OpenGL support
4. Special Keys / Full-Screen support
-------------------------------------
There are two special hot-keys implemented:
- Alt+Home switches between fullscreen and windowed mode
- Alt+End simulates closing the window (can be used as a Panic key)
Only the LEFT Alt key will work.
5. Joysticks on SDL/2
---------------------
The Joystick detection only works for standard joysticks (2 buttons, 2 axes
and the like). Therefore, if you use a non-standard joystick, you should
specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
file or CONFIG.SYS, so SDL applications can provide full capability to your
device. The syntax is:
SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
the line should be:
SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
If you want to add spaces in your joystick name, just surround it with
quotes or double-quotes:
SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
or
SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
Notive However that Balls and Hats are not supported under OS/2, and the
value will be ignored... but it is wise to define these correctly because
in the future those can be supported.
Also the number of buttons is limited to 2 when using two joysticks,
4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
and 8 when using a joystick with 2 axes. Notice however these are limitations
of the Joystick Port hardware, not OS/2.
6. Proportional windows
-----------------------
For some SDL applications it can be handy to have proportional windows, so
the windows will keep their aspect ratio when resized.
This can be achieved in two ways:
- Before starting the given SDL application, set the
SDL_USE_PROPORTIONAL_WINDOW environment variable to something, e.g.:
SET SDL_USE_PROPORTIONAL_WINDOW=1
dosbox.exe
- If you have a HOME environment variable set, then SDL will look for a file
in there called ".sdl.proportionals". If that file contains the name of the
currently running SDL executable, then that process will have proportional
windows automatically.
Please note that this file is created automatically with default values
at the first run.
7. Audio in SDL applications
----------------------------
Audio effects are one of the most important features in games. Creating audio
effects in sync with the game and without hickups and pauses in the audio are
very important things.
However there are multithreaded SDL applications that have tight loops as their
main logic loop. This kills performance in OS/2, and takes too much CPU from
other threads in the same process, for example from the thread to create the
sound effects.
For this reason, the OS/2 port of SDL can be instructed to run the audio thread
in high priority, which makes sure that there will be enough time for the
processing of the audio data.
At default, SDL/2 runs the audio thread at ForegroundServer+0 priority. Well
written and well behaving SDL applications should work well in this mode.
For other applications, you can tell SDL/2 to run the audio thread at
TimeCritical priority by setting an env.variable before starting the SDL app:
SET SDL_USE_TIMECRITICAL_AUDIO=1
Please note that this is a bit risky, because if the SDL application runs a
tight infinite loop in this thread, this will make the whole system
unresponsive, so use it with care, and only for applications that need it!
8. Next steps...
----------------
Things to do:
- Implement missing stuffs (look for 'TODO' string in source code!)
- Finish video driver (the 'wincommon' can be a good example for missing
things like application icon and so on...)
- Enable MMX/SSE/SSE2 acceleration functions
- Rewrite CDROM support using DOS Ioctl for better support.
9. Contacts
-----------
You can contact the developers for bugs:
Area Developer email
General (Audio/Video/System) Doodle doodle@scenergy.dfmk.hu
CDROM and Joystick Caetano daniel@caetano.eng.br
Notice however that SDL/2 is 'in development' stage so ... if you want to help,
please, be our guest and contact us!
10. Changelog of the OS/2 port
------------------------------
Version 1.2.10 - 2006-05-17 - Doodle
- Small modifications for v1.2.10 release
- Changed DLL name to include version info (currently SDL12.dll)
Version 1.2 - 2006-05-01 - Doodle
- Modified makefile system to have only one makefile
- Included FSLib headers, DLL and LIB file
Version 1.2 - 2006-02-26 - Doodle
- Updated the official SDL version with the OS/2 specific changes.
- Added support for real unicode keycode conversion.
Version 1.2.7 - 2006-01-20 - Doodle
- Added support for selectively using timecritical priority for
audio threads by SDL_USE_TIMECRITICAL_AUDIO environment variable.
(e.g.:
SET SDL_USE_TIMECRITICAL_AUDIO=1
dosbox.exe
)
Version 1.2.7 - 2005-12-22 - Doodle
- Added support for proportional SDL windows.
There are two ways to have proportional (aspect-keeping) windows for
a given SDL application: Either set the SDL_USE_PROPORTIONAL_WINDOW
environment variable to something before starting the application
(e.g.:
SET SDL_USE_PROPORTIONAL_WINDOW=1
dosbox.exe
)
or, if you have the HOME environment variable set, then SDL12.DLL will
create a file in that directory called .sdl.proportionals, and you can
put there the name of executable files that will be automatically made
proportional.
Version 1.2.7 - 2005-10-14 - Doodle
- Enabled Exception handler code in FSLib to be able to restore original
desktop video mode in case the application crashes.
- Added the missing FSLib_Uninitialize() call into SDL.
(The lack of it did not cause problems, but it's cleaner this way.)
- Fixed a mouse problem in Fullscreen mode where any mouse click
re-centered the mouse.
Version 1.2.7 - 2005-10-09 - Doodle
- Implemented window icon support
Version 1.2.7 - 2005-10-03 - Doodle
- Reworked semaphore support again
- Tuned thread priorities
Version 1.2.7 - 2005-10-02 - Doodle
- Added support for custom mouse pointers
- Fixed WM_CLOSE processing: give a chance to SDL app to ask user...
- Added support for MMX-accelerated audio mixers
- Other small fixes
Version 1.2.7 - 2005-09-12 - Doodle
- Small fixes for DosBox incorporated into public release
- Fixed semaphore support (SDL_syssem.c)
- Fixed FSLib to have good clipping in scaled window mode,
and to prevent occasional desktop freezes.
Version 1.2.7 - 2004-09-08a - Caetano
- Improved joystick support (general verifications about hardware).
- Added support up to 8 buttons in 2 axes joysticks and 6 buttons in 3 axes joysticks.
- Added support to environment variable SDL_OS2_JOYSTICK to specify a joystick.
- Improved Joystick test to handle every type of joystick and display only relevant information.
- Merged with Doodle 2004-09-08
- Little tid up in README.OS2
- Added explanation about SDL_OS2_JOYSTICK environment variable on README.OS2
Version 1.2.7 - 2004-09-07 - Caetano
- Merged with changes in headers for GCC compiling.
- Added Joystick support using basic IBM GAME$ support, allowing it to work with all joystick drivers since OS/2 2.1.
- Improved joystick detection (hacked!). OS/2 do not allow real joystick detection, so...
- Modified makefile in test to compile "testjoystick". Anyway, it's useless, since it seems to cause a lot of trouble in OS/2 (because os video routines, not Joystick support).
- Created separated Joystick test program to test only joystick functions.
- Improved joystick auto-centering.
- Improved the coordinate correction routine to use two scale factors for each axis.
Version 1.2.7 - 2004-07-05 - Caetano
- Corrected the time returned by status in CDROM support (it was incorrect)
- Added the testcdrom.c and corrected the linking directive (it was causing an error)
Version 1.2.7 - 2004-07-02a - Caetano
- Corrected a little problem in a comment at SDL-1.2.7\test\torturethread.c, line 18 (missing */, nested comment)
- Added CDROM support to tree (SDL-1.2.7\src\cdrom\os2\SDL_syscdrom.c)
- Modified makefile (SDL-1.2.7\src\makefiles.wat and SDL-1.2.7\watcom.mif) to build with CDROM support
- Added the "extra" SDL_types.h forgotten in 2004-07-02 version.
<End-Of-File>

View File

@ -0,0 +1,29 @@
SDL on Sony Playstation3
------------------------
Installation:
First, you have to install the Cell SDK
- Download the Cell SDK installer RPM and ISO images to
a temporary directory such as /tmp/cellsdk.
- Mount the image: mount -o loop CellSDK-Devel-Fedora_3.1.0.0.0.iso /tmp/cellsdk
- Install the SDK installer: rpm -ivh cell-install-3.1.0-0.0.noarch.rpm
- Install the SDK: cd /opt/cell && ./cellsdk --iso /tmp/cellsdkiso install
You need to install the SPU-libs before installing SDL
- Go to SDL-1.2/src/video/ps3/spulibs/
- Run make && make install
Finally, install SDL
- Go to SDL-1.2/ and build SDL like any other GNU style package.
e.g.
- Build the configure-script with ./autogen.sh
- Configure SDL for your needs: ./configure --enable-video-ps3 ...
- Build and install it: make && make install
Todo:
- mouse/keyboard/controller support
Have fun!
Dirk Herrendoerfer <d.herrendoerfer [at] de [dot ibm [dot] com>

View File

@ -0,0 +1,50 @@
========================
Using SDL with PicoGUI
========================
- Originally contributed by Micah Dowty <micahjd@users.sourceforge.net>
PicoGUI is a scalable GUI system with a unique architecture, primarily focused
on scalability to various embedded systems. You can find more information
including a FAQ at http://picogui.org
To use the patch:
1. When compiling, add the "--enable-video-picogui" switch to ./configure
2. When running your program, ensure that the picogui driver for SDL
is in use by setting the SDL_VIDEODRIVER environment variable
to "picogui".
3. The program must also be linked to the C client library for PicoGUI
(libpgui.so). If the program is being compiled with a patched SDL
installed this should be done automatically. If you want to use an
existing binary with PicoGUI, you can set the LD_PRELOAD environment
variable to the path of your libpgui.so file.
Capabilities:
So far only basic functionality is provided on true color (linear16/24/32)
devices. Accessing a memory mapped bitmap, updating the display, and handling
mouse/keyboard input. This functionality has been tested with several
applications, including mplayer, Xine, sldroids, and Abuse.
TODO list:
- YUV overlays will be helpful for watching video on set top boxes or other
embedded devices that have some graphics acceleration hardware
- Account for rotated bitmap storage in pgserver
- Support for hiding or changing the cursor
- The display should be centered when the SDL application is smaller
than the PicoGUI panel
- Fullscreen or any other special modes
- Support for indexed and grayscale modes
- Probably much more...
--- The End ---

View File

@ -0,0 +1,56 @@
* Porting To A New Platform
The first thing you have to do when porting to a new platform, is look at
include/SDL_platform.h and create an entry there for your operating system.
The standard format is __PLATFORM__, where PLATFORM is the name of the OS.
Ideally SDL_platform.h will be able to auto-detect the system it's building
on based on C preprocessor symbols.
There are two basic ways of building SDL at the moment:
1. The "UNIX" way: ./configure; make; make install
If you have a GNUish system, then you might try this. Edit configure.in,
take a look at the large section labelled:
"Set up the configuration based on the target platform!"
Add a section for your platform, and then re-run autogen.sh and build!
2. Using an IDE:
If you're using an IDE or other non-configure build system, you'll probably
want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
add a section for your platform, and create a custom SDL_config_{platform}.h,
based on SDL_config.h.minimal and SDL_config.h.in
Add the top level include directory to the header search path, and then add
the following sources to the project:
src/*.c
src/audio/*.c
src/cdrom/*.c
src/cpuinfo/*.c
src/events/*.c
src/file/*.c
src/joystick/*.c
src/stdlib/*.c
src/thread/*.c
src/timer/*.c
src/video/*.c
src/audio/disk/*.c
src/video/dummy/*.c
src/joystick/dummy/*.c
src/cdrom/dummy/*.c
src/thread/generic/*.c
src/timer/dummy/*.c
src/loadso/dummy/*.c
Once you have a working library without any drivers, you can go back to each
of the major subsystems and start implementing drivers for your platform.
If you have any questions, don't hesitate to ask on the SDL mailing list:
http://www.libsdl.org/mailing-list.php
Enjoy!
Sam Lantinga (slouken@libsdl.org)

View File

@ -0,0 +1,155 @@
README.QNX by Mike Gorchak <mike@malva.ua>, <lestat@i.com.ua>
Last changed at 24 Apr 2004.
======================================================================
Table of Contents:
1. OpenGL.
2. Wheel and multi-button mouses.
3. CDROM handling issues.
4. Hardware video overlays.
5. Shared library building.
6. Some building issues.
7. Environment variables.
======================================================================
1. OpenGL:
OpenGL works well and is stable, but fullscreen mode has not been
heavily tested yet.
If you have QNX RtP version 6.1.0 or above you must download the
Photon3D runtime from http://developers.qnx.com or install it from the
public repository or from the public CD, available with QNX. OS versi-
ons below 6.1.0 are not supported.
When creating an OpenGL context, software renderer mode is artifi-
cially selected (QSSL made acceleration only for Voodoo boards in
fullscreen mode, sorry but I don't have this board to test OpenGL -
maybe it works or maybe not :)). If you want acceleration - you can
remove one line in the source code: find the file SDL_ph_image.c and
remove the following
OGLAttrib[OGLargc++]=PHOGL_ATTRIB_FORCE_SW;
line in the ph_SetupOpenGLContext() function or change the argument to
PHOGL_ATTRIB_FORCE_HW or PHOGL_ATTRIB_FAVOR_HW.
======================================================================
2. Wheel and multi-button mouses:
Photon emits keyboard events (key up and down) when the mouse
wheel is moved. The key_scan field appears valid, and it contains zero.
That is a basic method of detecting mouse wheel events under Photon.
It looks like a hack, but it works for me :) on various PC configura-
tions.
I've tested it on:
1. Genius Optical NetScroll/+ PS/2 (1 wheel)
2. A4Tech Optical GreatEye WheelMouse PS/2, model: WOP-35. (2 wheels
+ 2 additional buttons). The wheel for vertical scrolling works as
usual, but the second wheel for horizontal scrolling emits two se-
quential events up or down, so it can provide faster scrolling than
the first wheel. Additional buttons don't emit any events, but it
looks like they're handled by photon in an unusual way - like click
to front, but works not with any window, looks like a fun bug-o-fe-
ature :).
======================================================================
3. CDROM handling issues:
Access to CDROM can only be provided with 'root' privileges. I
can't do anything about that, /dev/cd0 has brw------- permissions and
root:root rights.
======================================================================
4. Hardware video overlays:
Overlays can flicker during window movement, resizing, etc. It
happens because the photon driver updates the real window contents be-
hind the overlay, then draws the temporary chroma key color over the
window contents. It can be done without using the chroma key but that
causes the overlay to always be on top. So flickering during window
movement is preferred instead.
Double buffering code is temporarily disabled in the photon driver
code, because on my GF2-MX it can accidentally cause a buffer switch,
which causes the old frame to show. S3 Savage4 has the same problem,
but ATI Rage 128 doesn't. I think it can be fixed later. Current code
works very well, so maybe double buffering is not needed right now.
Something strange happens when you try to move the window with the
overlay beyond the left border of the screen. The overlay tries to
stay at position x=0, but when attempting to move it a bit more it
jumps to position x=-60 (on GF2-MX, on ATI Rage128 this value a bit
smaller). It's really strange, looks like the overlay doesn't like
negative coordinates.
=======================================================================
5. Shared library building:
A shared library can be built, but before running the autogen.sh
script you must manually delete the libtool.m4 stuff from the acinclu-
de.m4 file (it comes after the ESD detection code up to the end of the
file), because the libtool stuff in the acinclude.m4 file was very old
in SDL distribution before the version 1.2.7 and doesn't knew anything
about QNX. SDL 1.2.7 distribution contains the new libtool.m4 script,
but anyway it is broken :), Just remove it, then run "libtoolize
--force --copy", delete the file aclocal.m4 if it is exists and after
that run the autogen.sh script. SDL 1.2.8 contains fixed libtool.m4,
ltmain.sh and config.sub files, so you can just run the autogen.sh
script.
======================================================================
6. Some building issues:
Feel free to not use the --disable-shared configure option if you'
ve read the above comment about 'Shared library building'. Otherwise
this option is strongly recommended, as without it the sdl-config
script will be broken.
Run the configure script without x11 support, e.g.:
a) for OpenGL support:
./configure --prefix=/usr \
--disable-video-x11 \
--disable-shared
b) without OpenGL support:
./configure --prefix=/usr \
--disable-video-x11 \
--disable-shared \
--disable-video-opengl
And of course dont forget to specify --disable-debug, which is on
by default, to disable debug and enable the expensive optimizations.
In the test directory also run the ./configure script without
x11 support, e.g.:
./configure --with-sdl-prefix=/usr \
--with-sdl-exec-prefix=/usr \
--prefix=/usr --without-x
======================================================================
7. Environment variables:
Please note that the photon driver is sensible to the following
environmental variables:
* SDL_PHOTON_FULLSCREEN_REFRESH - this environment variable controls
the refresh rate in all fullscreen modes. Be carefull !!! Photon
drivers usually do not checking the maximum refresh rate, which video
adapter or monitor supports.
* SDL_VIDEO_WINDOW_POS - can be set in the "X,Y" format. If X and Y
coordinates are bigger than the current desktop resolution, then win-
dow positioning across virtual consoles is activated. If X and Y are
smaller than the desktop resolution then window positioning in the
current console is activated. The word "center" can be used instead of
coordinates, it produces the same behavior as SDL_VIDEO_CENTERED
environmental variable.
* SDL_VIDEO_CENTERED - if this environmental variable exists then the
window centering is perfomed in the current virtual console.
Notes: The SDL_VIDEO_CENTERED enviromental variable has greater pri-
ority than the SDL_VIDEO_WINDOW_POS in case if both variables are sup-
plied to the application.

View File

@ -0,0 +1,84 @@
==============================================================================
Using the Simple DirectMedia Layer with Qtopia/OPIE
==============================================================================
==============================================================================
I. Setting up the Qtopia development environment.
This document will not explain how to setup the Qtopia development
environment. That is outside the scope of the document. You can read
more on this subject in this excellent howto:
http://www.zauruszone.com/howtos/linux_compiler_setup_howto.html
==============================================================================
II. Building the Simple DirectMedia Layer libraries using the arm
cross-compiler
This is somewhat tricky since the name of the compiler binaries
differ from the standard. Also you should disable features not
needed. The command below works for me. Note that it's all one
line. You can also set the NM, LD etc environment variables
separately.
NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ RANLIB=arm-linux-ranlib AR=arm-linux-ar ./configure --enable-video-qtopia --disable-video-dummy --disable-video-fbcon --disable-video-dga --disable-arts --disable-esd --disable-alsa --disable-cdrom --disable-video-x11 --disable-nasm --prefix=/opt/Qtopia/sharp/ arm-unknown-linux-gnu
One thing to note is that the above configure will include joystick
support, even though you can't have joysticks on the Zaurus. The
reason for this is to avoid link / compile / runtime errors with
applications that have joystick support.
==============================================================================
III. Building the Simple DirectMedia Layer test programs:
After installing, making sure the correct sdl-config is in your
path, run configure like this:
NM=arm-linux-nm LD=arm-linux-ld CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar ./configure arm-unknown-linux-gnu
==============================================================================
IV. Application porting notes
One thing I have noticed is that applications sometimes don't exit
correctly. Their icon remains in the taskbar and they tend to
relaunch themselves automatically. I believe this problem doesn't
occur if you exit your application using the exit() method. However,
if you end main() with 'return 0;' or so, this seems to happen.
Also note that when running in landscape mode - i.e requesting a
window that is HEIGHT pixels wide and WIDTH pixels high, where WIDTH
and HEIGHT normally is 240 and 320 - the image is blitted so that
the hardware buttons are on the left side of the display. This might
not always be desirable but such is the code today.
==============================================================================
V. Enjoy! :)
If you have a project you'd like me to know about, or want to ask questions,
go ahead and join the SDL developer's mailing list by sending e-mail to:
sdl-request@libsdl.org
and put "subscribe" into the subject of the message. Or alternatively you
can use the web interface:
http://www.libsdl.org/mailman/listinfo/sdl
==============================================================================
VI. What is supported:
Keyboard (Sharp Zaurus)
Hardware buttons
Stylus input (mouse)
Video. Allows fullscreen both in portrait mode (up to WIDTHxHEIGHT
size window) and in landscape mode (up to HEIGHTxWIDTH).
All other SDL functionality works like a normal Linux system (threads,
audio etc).
--
David Hedbor <david@hedbor.org>
http://david.hedbor.org/ http://eongames.com/

View File

@ -0,0 +1,130 @@
Readme for RISC OS port of SDL
==============================
This document last updated on 2nd Februrary 2006
This is a RISC OS port of the Simple Direct Media Layer (SDL) by Alan Buckley with contributions from Peter Naulls.
Details of the SDL can be found at http://www.libsdl.org.
The source code including the RISC OS version can be obtained from:
http://www.libsdl.org.
Pre built libraries and many games and applications compiled for RISC OS using this library can be downloaded from The Unix Porting Project at http://www.riscos.info/unix/.
This is released under the LGPL see the file COPYING for details.
Compiling applications under RISC OS
====================================
Add -ISDL: for the C compiler flags if you include the files in the SDL directory. e.g. #include "SDL/SDL.h"
Add -ISDL:SDL for the C compiler flags if you include the files directly. e.g. #include "SDL/SDL.h"
Add -LSDL: -lSDL to the link stage of compilation.
For example, to compile the testbitmap.c sample you could use:
gcc -ISDL:SDL -LSDL: -lSDL testbitmap.c -otestbitmap
RISC OS port of SDL runtime information
=======================================
Runtime requirements
--------------------
This library currently needs a minimum of RISC OS 3.6. The source code for the library (and a lot of the programs built with it) also need long file names.
To use the audio you also need 16 bit sound and to have installed the DigitalRender module by Andreas Dehmel version 0.51 available from his
web site: http://home.t-online.de/~zarquon
This is loaded when needed by UnixLib.
Note: As most programs ported from other OSes use high resolution graphics and a memory back buffer a machine with a StrongARM processor and 1 or 2MB of VRAM (or a better machine) is recomended.
RISC OS runtime parameters
--------------------------
Several environmental variables have been defined to make porting programs easier (i.e. By setting these variable you do not need to have source code differences between OSes).
They are all defined on an application basis.
The <appname> used below is found as follows:
1. Use the name of the program unless it is !RunImage
2. Check the folder specification for the folder !RunImage is run from. If it is a folder name use that name, otherwise if it is an environmental variable of the form <XXX$Dir> use the value of XXX.
The variables are:
SDL$<appname>$TaskName
The name of the task for RISC OS. If omitted then <appname> is used for the task name,
SDL$<appname>$BackBuffer
Set to 1 to use a system memory back buffer for the screen in full screen mode. Some programs on other systems assume their is always a back buffer even though the SDL specification specifies this is not the case. The current RISC OS implementation uses direct writes to the screen if a hardware fullscreen is requested.
Set to 2 to use an ARM code full word copy. This is faster than the standard back buffer, but uses aligned words only so it is possible (but unlikely) for it to corrupt the screen for 8bpp and 16bpp modes.
Set to 3 to use a RISC OS sprite as the back buffer. This is usually the slowest for most SDL applications, however it may be useful in the future as Sprite acceleration is added to various hardware that runs RISC OS.
SDL$<appname>$CloseAction - set the action for the close icon. Again as programs don't match the specification you can set this to 0 to remove the close icon from the main window for applications where this does not affect the program.
RISC OS SDL port API notes
==========================
Current level of implementation
-------------------------------
The following list is an overview of how much of the SDL is implemented. The areas match the main areas of the SDL.
video - Mostly done. Doesn't cover gamma, YUV-overlay or OpenGL.
Window Manager - Mostly done. SetIcon/IconifyWindow not implemented.
Events - Mostly done. Resize and some joystick events missing.
Joystick - Currently assumes a single joystick with 4 buttons.
Audio - Done
CDROM - Not implemented.
Threads - Done
Timers - Done
Thread support can be removed by defining DISABLE_THREADS and recompiling the library.
SDL API notes
-------------
This section contains additional notes on some specific commands.
SDL_SetVideoMode
On RISC OS a fullscreen mode directly accesses the screen. This can be modified by the environmental variable (SDL$<appname>$BackBuffer) or by using the SDL_SWSURFACE flag to write to an offscreen buffer that is updated using SDL_UpdateRects.
Open GL is not supported so SDL_OPENGL and SDL_OPENGLBLIT flags fail.
SDL_RESIZEABLE and SDL_NOFRAME flags are not supported.
SDL_SetColors
In a wimp mode the screen colours are not changed for a hardware palette instead the RISC OS sprite colour mapping is used to get the best matching colours.
SDL_CreateCursor
Inverted colour is not supported.
SDL_WM_ToggleFullScreen
Currently this won't work if the application starts up in Fullscreen mode.
Toggling to fullscreen will only work if the monitor is set up to support the exact screen size requested.
SDL_EnableUNICODE
Unicode translation used here is only really accurate for 7 bit characters.
SDL_NumJoysticks/JoystickName etc.
Hardcoded to expect only 1 joystick with 4 buttons if the Joystick module is loaded.
SDL_GetTicks
Timer used has only a centisecond accuracy. This applies to other time related functions.
SDL_Delay
Modified to poll keyboard/mouse during the delay on the event thread.
Notes on current implementation
-------------------------------
Keyboard and mouse are polled so if too long a time is spent between a call to SDL_PumpEvents, functions that use it, or SDL_Delay events can be missed.

View File

@ -0,0 +1,23 @@
The latest development version of SDL is available via Subversion.
Subversion allows you to get up-to-the-minute fixes and enhancements;
as a developer works on a source tree, you can use svn to mirror that
source tree instead of waiting for an official release. Please look
at the Subversion website ( http://subversion.tigris.org/ ) for more
information on using svn, where you can also download software for
MacOS, Windows, and Unix systems.
svn checkout http://svn.libsdl.org/branches/SDL-1.2
If you are building SDL with an IDE, you will need to copy the file
include/SDL_config.h.default to include/SDL_config.h before building.
If you are building SDL via configure, you will need to run autogen.sh
before running configure.
There is a web interface to the subversion repository at:
http://www.libsdl.org/cgi/viewvc.cgi
There is an RSS feed available at that URL, for those that want to
track commits in real time.

View File

@ -0,0 +1,23 @@
==============================================================================
Using the Simple DirectMedia Layer with S60 3.x / Symbian 9.x
==============================================================================
These instuctions are for people developing for S60 3.x. S60 3.x
uses Symbian OS so you need S60 SDK.
extract "symbian.zip" into this folder.
go to symbian folder
bldmake bldfiles
abld build
That produces WINSCW and ARMV5 versions of sdl.dll runtime library
and sdl.lib for development.
The sdlexe.dll/sdlexe.lib and sdlmain.lib are for easy SDL S60
integration, please see http://www.mbnet.fi/~mertama/sdl.html
for further info.

View File

@ -0,0 +1,133 @@
Using SDL under Windows with the OpenWatcom compiler
====================================================
Prerequisites
-------------
I have done the port under Windows XP Home with SP2 installed. Windows
2000 should also be working. I'm not so sure about ancient Windows NT,
since only DirectX 3 is available there. Building should be possible,
but running the compiled applications will probalbly fail with
SDL_VIDEODRIVER=directx. The windib driver should work, though.
To compile and use the SDL with Open Watcom you will need the following:
- Open Watcom compiler. I used version 1.5. The environment variables
PATH, WATCOM and INCLUDE need to be set appropriately - please consult
the OpenWatcom documentation and instructions given during the
installation of the compiler.
My setup looks like this in owvars.bat:
set WATCOM=C:\watcom
set INCLUDE=%WATCOM%\h;%WATCOM%\h\nt
set PATH=%PATH%;%WATCOM%\binnt;%WATCOM%\binw
- A fairly recent DirectX SDK. The original unmodified DX8 SDK works, as
well as the minimal DirectX 7 SDK from the Allegro download site
(<http://alleg.sourceforge.net/files/dx70_min.zip>).
- The SDL sources from Subversion
- The file Watcom-Win32.zip (now available in Subversion)
Building the Library
--------------------
1) In the SDL base directory extract the archive Watcom-Win32.zip. This
creates a subdirectory named 'watcom'.
2) The makefile expects the environment variable DXDIR to be set to the
base directory of a DirectX SDK. I have tried a stock DX8 SDK from
Microsoft as well as the minimal DirectX 7 SDK from the Allegro
download site.
You can also edit the makefile directly and hard code your path to
the SDK on your system.
I have this in my setup:
set DXDIR=D:\devel\DX8_SDK
3) Enter the watcom directory and run
wmake sdl
4) All tests from the test directory are working and can be built by
running
wmake tests
Notes:
The makefile offers some options to tweak the way the library is built.
You have at your disposal the option to build a static (default)
library, or a DLL (with tgt=dll). You can also choose whether to build
a Release (default) or a Debug version (with build=debug) of the tests
and library. Please consult the usage comment at the top of the
makefile for usage instructions.
If you specify a test target (i.e. 'wmake tests' for all tests, or
selected targets like 'wmake testgl testvidinfo testoverlay2'), the
tests are always freshly compiled and linked. This is done to
minimise hassle when switching between library versions (static vs.
DLL), because they require subtly different options.
Also, the test executables are put directly into the test directory,
so they can find their data files. The clean target of the makefile
removes the test executables and the SDL.dll file from the test
directory.
To use the library in your own projects with Open Watcom, you can use
the way the tests are built as base of your own build environment.
The library can also be built with the stack calling convention of the
compiler (-6s instead of -6r).
Test applications
-----------------
I've tried to make all tests work. The following table gives an overview
of the current status.
Testname Status
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
checkkeys +
graywin +
loopwave +
testalpha +
testbitmap +
testdyngl +
testerror +
testfile +
testgamma +
testgl +
testhread +
testiconv - (all failed)
testkeys +
testlock +
testoverlay + (needs 'set SDL_VIDEODRIVER=directx')
testoverlay2 + (needs 'set SDL_VIDEODRIVER=directx')
testpalette +
testplatform +
testsem +
testsprite +
testtimer +
testver +
testvidinfo +
testwin ? (fading doesn't seem right)
testwm +
torturethread +
testcdrom +
testjoystick not tested
threadwin +
testcursor +
TODO
----
There is room for further improvement:
- Test joystick functionality.
- Investigate fading issue in 'testwin' test.
- Fix the UTF-8 support.
- Adapt the makefile/object file list to support more target systems
- Use "#pragma aux" syntax for the CPU info functions.
Questions and Comments
----------------------
Please direct any questions or comments to me: <mailto:macpete@gmx.de>
Happy Coding!
Marc Peter

View File

@ -0,0 +1,55 @@
Project files for embedded Visual C++ 3.0, 4.0 and
Visual Studio 2005 can be found in VisualCE.zip
SDL supports GAPI and WinDib output for Windows CE.
GAPI driver supports:
- all possible WinCE devices (Pocket PC, Smartphones, HPC)
with different orientations of video memory and resolutions.
- 4, 8 and 16 bpp devices
- special handling of 8bpp on 8bpp devices
- VGA mode, you can even switch between VGA and GAPI in runtime
(between 240x320 and 480x640 for example). On VGA devices you can
use either GAPI or VGA.
- Landscape mode and automatic rotation of buttons and stylus coordinates.
To enable landscape mode make width of video screen bigger than height.
For example:
SDL_SetVideoMode(320,240,16,SDL_FULLSCREEN)
- WM2005
- SDL_ListModes
NOTE:
There are several SDL features not available in the WinCE port of SDL.
- DirectX is not yet available
- Semaphores are not available
- Joystick support is not available
- CD-ROM control is not available
In addition, there are several features that run in "degraded" mode:
Preprocessor Symbol Effect
=================== =================================
SDL_systimer.c:
USE_GETTICKCOUNT Less accurate values for SDL time functions
USE_SETTIMER Use only a single marginally accurate timer
SDL_syswm.c:
DISABLE_ICON_SUPPORT Can't set the runtime window icon
SDL_sysmouse.c:
USE_STATIC_CURSOR Only the arrow cursor is available
SDL_sysevents.c:
NO_GETKEYBOARDSTATE Can't get modifier state on keyboard focus
SDL_dibevents.c:
NO_GETKEYBOARDSTATE Very limited keycode translation
SDL_dibvideo.c:
NO_GETDIBITS Can't distinguish between 15 bpp and 16 bpp
NO_CHANGEDISPLAYSETTINGS No fullscreen support
NO_GAMMA_SUPPORT Gamma correction not available

View File

@ -0,0 +1,107 @@
==============================================================================
Using the Simple DirectMedia Layer with OpenBSD/wscons
==============================================================================
The wscons SDL driver can be used to run SDL programs on OpenBSD
without running X. So far, the driver only runs on the Sharp Zaurus,
but the driver is written to be easily extended for other machines.
The main missing pieces are blitting routines for anything but 16 bit
displays, and keycode maps for other keyboards. Also, there is no
support for hardware palettes.
There is currently no mouse support.
To compile SDL with support for wscons, use the
"--enable-video-wscons" option when running configure. I used the
following command line:
./configure --disable-oss --disable-ltdl --enable-pthread-sem \
--disable-esd --disable-arts --disable-video-aalib \
--enable-openbsdaudio --enable-video-wscons \
--prefix=/usr/local --sysconfdir=/etc
Setting the console device to use
=================================
When starting an SDL program on a wscons console, the driver uses the
current virtual terminal (usually /dev/ttyC0). To force the driver to
use a specific terminal device, set the environment variable
SDL_WSCONSDEV:
bash$ SDL_WSCONSDEV=/dev/ttyC1 ./some-sdl-program
This is especially useful when starting an SDL program from a remote
login prompt (which is great for development). If you do this, and
want to use keyboard input, you should avoid having some other program
reading from the used virtual console (i.e., do not have a getty
running).
Rotating the display
====================
The display can be rotated by the wscons SDL driver. This is useful
for the Sharp Zaurus, since the display hardware is wired so that it
is correctly rotated only when the display is folded into "PDA mode."
When using the Zaurus in "normal," or "keyboard" mode, the hardware
screen is rotated 90 degrees anti-clockwise.
To let the wscons SDL driver rotate the screen, set the environment
variable SDL_VIDEO_WSCONS_ROTATION to "CW", "CCW", or "UD", for
clockwise, counter clockwise, and upside-down rotation respectively.
"CW" makes the screen appear correct on a Sharp Zaurus SL-C3100.
When using rotation in the driver, a "shadow" frame buffer is used to
hold the intermediary display, before blitting it to the actual
hardware frame buffer. This slows down performance a bit.
For completeness, the rotation "NONE" can be specified to use a shadow
frame buffer without actually rotating. Unsetting
SDL_VIDEO_WSCONS_ROTATION, or setting it to '' turns off the shadow
frame buffer for maximum performance.
Running MAME
============
Since my main motivation for writing the driver was playing MAME on
the Zaurus, I'll give a few hints:
XMame compiles just fine under OpenBSD.
I'm not sure this is strictly necessary, but set
MY_CPU = arm
in makefile.unix, and
CFLAGS.arm = -DLSB_FIRST -DALIGN_INTS -DALIGN_SHORTS
in src/unix/unix.max
to be sure.
The latest XMame (0.101 at this writing) is a very large program.
Either tinker with the make files to compile a version without support
for all drivers, or, get an older version of XMame. My recommendation
would be 0.37b16.
When running MAME, DO NOT SET SDL_VIDEO_WSCONS_ROTATION! Performace
is MUCH better without this, and it is COMPLETELY UNNECESSARY, since
MAME can rotate the picture itself while drawing, and does so MUCH
FASTER.
Use the Xmame command line option "-ror" to rotate the picture to the
right.
Acknowledgments
===============
I studied the wsfb driver for XFree86/Xorg quite a bit before writing
this, so there ought to be some similarities.
--
Staffan Ulfberg <staffan@ulfberg.se>

140
ws2010/gdi3/p5/SDL/SDL.qpg Normal file
View File

@ -0,0 +1,140 @@
<QPG:Generation>
<QPG:Options>
<QPG:User unattended="yes" verbosity="0" listfiles="yes"/>
<QPG:Defaults type="qnx_package"/>
<QPG:Source></QPG:Source>
<QPG:Release date="today" number="+"/>
<QPG:Build></QPG:Build>
<QPG:FileSorting strip="yes"/>
<QPG:Package targets="standart"/>
<QPG:Repository generate="yes"/>
<QPG:FinalDir></QPG:FinalDir>
<QPG:Cleanup></QPG:Cleanup>
</QPG:Options>
<QPG:Responsible>
<QPG:Company>QNX.ORG.RU Community</QPG:Company>
<QPG:Department></QPG:Department>
<QPG:Group></QPG:Group>
<QPG:Team>QNX.ORG.RU Team</QPG:Team>
<QPG:Employee>Mike Gorchak</QPG:Employee>
<QPG:EmailAddress>mike@malva.ua</QPG:EmailAddress>
</QPG:Responsible>
<QPG:Values>
<QPG:Files>
<QPG:Add file="./COPYING" install="LicenseUrl/" handling="repdata"/>
<QPG:Add permissions="0755" file="./src/.libs/libSDL-1.2.so.11" install="/usr/lib/"/>
<QPG:Add filetype="symlink" file="libSDL.so" install="/usr/lib/" linkto="libSDL-1.2.so.11"/>
<QPG:Add permissions="0644" file="./src/.libs/libSDL.a" install="/usr/lib/"/>
<QPG:Add permissions="0644" file="./src/.libs/libSDL.lai" install="/usr/lib/libSDL.la"/>
<QPG:Add permissions="0644" file="./src/main/libSDLmain.a" install="/usr/lib/"/>
<QPG:Add permissions="0644" file="./include/*.h" install="/usr/include/SDL/"/>
<QPG:Add permissions="0755" file="./sdl-config" install="/usr/bin/"/>
<QPG:Add permissions="0644" file="./BUGS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./COPYING" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./CREDITS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./INSTALL" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README-SDL.txt" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README.CVS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README.QNX" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./TODO" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./WhatsNew" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./docs.html" install="/usr/share/doc/SDL12/Changes.html"/>
<QPG:Add permissions="0644" file="./docs/index.html" install="/usr/share/doc/SDL12/docs/"/>
<QPG:Add permissions="0644" file="./docs/html/*.html" install="/usr/share/doc/SDL12/docs/html/"/>
<QPG:Add permissions="0644" file="./docs/man3/*.3" install="/usr/share/man/man3/"/>
<QPG:Add permissions="0644" file="./sdl.m4" install="/usr/share/aclocal/"/>
</QPG:Files>
<QPG:PackageFilter>
<QPM:PackageManifest>
<QPM:PackageDescription>
<QPM:PackageType>Library</QPM:PackageType>
<QPM:PackageName>SDL</QPM:PackageName>
<QPM:PackageReleaseNumber>1</QPM:PackageReleaseNumber>
<QPM:PackageRepository>http://qnx.org.ru/repository</QPM:PackageRepository>
<QPM:FileVersion>2.6</QPM:FileVersion>
</QPM:PackageDescription>
<QPM:ProductDescription>
<QPM:ProductName>Simple DirectMedia Layer (SDL)</QPM:ProductName>
<QPM:ProductIdentifier>SDL</QPM:ProductIdentifier>
<QPM:ProductEmail>slouken@libsdl.org</QPM:ProductEmail>
<QPM:VendorName>Public</QPM:VendorName>
<QPM:VendorInstallName>public</QPM:VendorInstallName>
<QPM:VendorURL>http://www.libsdl.org</QPM:VendorURL>
<QPM:VendorEmbedURL/>
<QPM:VendorEmail>slouken@libsdl.org</QPM:VendorEmail>
<QPM:AuthorName>Sam Lantinga</QPM:AuthorName>
<QPM:AuthorURL>http://www.libsdl.org</QPM:AuthorURL>
<QPM:AuthorEmbedURL/>
<QPM:AuthorEmail>slouken@libsdl.org</QPM:AuthorEmail>
<QPM:ProductIconSmall/>
<QPM:ProductIconLarge/>
<QPM:ProductDescriptionShort>This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</QPM:ProductDescriptionShort>
<QPM:ProductDescriptionLong>This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. This is the libraries, include files and other resources you can use to develop and run SDL applications.</QPM:ProductDescriptionLong>
<QPM:ProductDescriptionURL>http://www.libsdl.org</QPM:ProductDescriptionURL>
<QPM:ProductDescriptionEmbedURL/>
</QPM:ProductDescription>
<QPM:ReleaseDescription>
<QPM:ReleaseVersion>@VERSION@</QPM:ReleaseVersion>
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
<QPM:ReleaseNoteMinor/>
<QPM:ReleaseNoteMajor/>
<QPM:ReleaseBuild>1</QPM:ReleaseBuild>
<QPM:CountryExclude/>
<QPM:ReleaseCopyright>GNU Lesser General Public License</QPM:ReleaseCopyright>
</QPM:ReleaseDescription>
<QPM:ContentDescription>
<QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
<QPM:ContentKeyword>SDL,audio,graphics,demos,games,emulators,direct,media,layer</QPM:ContentKeyword>
<QPM:TargetOS>qnx6</QPM:TargetOS>
<QPM:HostOS>none</QPM:HostOS>
<QPM:DisplayEnvironment xmlmultiple="true">Photon</QPM:DisplayEnvironment>
<QPM:DisplayEnvironment xmlmultiple="true">Console</QPM:DisplayEnvironment>
<QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience>
<QPM:TargetAudience xmlmultiple="true">User</QPM:TargetAudience>
</QPM:ContentDescription>
<QPM:LicenseUrl>repdata://LicenseUrl/COPYING</QPM:LicenseUrl>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="none" target="none">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="x86" target="none">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="none" target="x86">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="x86" target="x86">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
</QPG:Values>
</QPG:Generation>

View File

@ -0,0 +1,140 @@
<QPG:Generation>
<QPG:Options>
<QPG:User unattended="yes" verbosity="0" listfiles="yes"/>
<QPG:Defaults type="qnx_package"/>
<QPG:Source></QPG:Source>
<QPG:Release date="today" number="+"/>
<QPG:Build></QPG:Build>
<QPG:FileSorting strip="yes"/>
<QPG:Package targets="standart"/>
<QPG:Repository generate="yes"/>
<QPG:FinalDir></QPG:FinalDir>
<QPG:Cleanup></QPG:Cleanup>
</QPG:Options>
<QPG:Responsible>
<QPG:Company>QNX.ORG.RU Community</QPG:Company>
<QPG:Department></QPG:Department>
<QPG:Group></QPG:Group>
<QPG:Team>QNX.ORG.RU Team</QPG:Team>
<QPG:Employee>Mike Gorchak</QPG:Employee>
<QPG:EmailAddress>mike@malva.ua</QPG:EmailAddress>
</QPG:Responsible>
<QPG:Values>
<QPG:Files>
<QPG:Add file="./COPYING" install="LicenseUrl/" handling="repdata"/>
<QPG:Add permissions="0755" file="./src/.libs/libSDL-@SDL_MAJOR_VERSION@.@SDL_MINOR_VERSION@.so.@LT_AGE@" install="/usr/lib/"/>
<QPG:Add filetype="symlink" file="libSDL.so" install="/usr/lib/" linkto="libSDL-@SDL_MAJOR_VERSION@.@SDL_MINOR_VERSION@.so.@LT_AGE@"/>
<QPG:Add permissions="0644" file="./src/.libs/libSDL.a" install="/usr/lib/"/>
<QPG:Add permissions="0644" file="./src/.libs/libSDL.lai" install="/usr/lib/libSDL.la"/>
<QPG:Add permissions="0644" file="./src/main/libSDLmain.a" install="/usr/lib/"/>
<QPG:Add permissions="0644" file="./include/*.h" install="/usr/include/SDL/"/>
<QPG:Add permissions="0755" file="./sdl-config" install="/usr/bin/"/>
<QPG:Add permissions="0644" file="./BUGS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./COPYING" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./CREDITS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./INSTALL" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README-SDL.txt" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README.CVS" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./README.QNX" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./TODO" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./WhatsNew" install="/usr/share/doc/SDL12/"/>
<QPG:Add permissions="0644" file="./docs.html" install="/usr/share/doc/SDL12/Changes.html"/>
<QPG:Add permissions="0644" file="./docs/index.html" install="/usr/share/doc/SDL12/docs/"/>
<QPG:Add permissions="0644" file="./docs/html/*.html" install="/usr/share/doc/SDL12/docs/html/"/>
<QPG:Add permissions="0644" file="./docs/man3/*.3" install="/usr/share/man/man3/"/>
<QPG:Add permissions="0644" file="./sdl.m4" install="/usr/share/aclocal/"/>
</QPG:Files>
<QPG:PackageFilter>
<QPM:PackageManifest>
<QPM:PackageDescription>
<QPM:PackageType>Library</QPM:PackageType>
<QPM:PackageName>SDL</QPM:PackageName>
<QPM:PackageReleaseNumber>1</QPM:PackageReleaseNumber>
<QPM:PackageRepository>http://qnx.org.ru/repository</QPM:PackageRepository>
<QPM:FileVersion>2.6</QPM:FileVersion>
</QPM:PackageDescription>
<QPM:ProductDescription>
<QPM:ProductName>Simple DirectMedia Layer (SDL)</QPM:ProductName>
<QPM:ProductIdentifier>SDL</QPM:ProductIdentifier>
<QPM:ProductEmail>slouken@libsdl.org</QPM:ProductEmail>
<QPM:VendorName>Public</QPM:VendorName>
<QPM:VendorInstallName>public</QPM:VendorInstallName>
<QPM:VendorURL>http://www.libsdl.org</QPM:VendorURL>
<QPM:VendorEmbedURL/>
<QPM:VendorEmail>slouken@libsdl.org</QPM:VendorEmail>
<QPM:AuthorName>Sam Lantinga</QPM:AuthorName>
<QPM:AuthorURL>http://www.libsdl.org</QPM:AuthorURL>
<QPM:AuthorEmbedURL/>
<QPM:AuthorEmail>slouken@libsdl.org</QPM:AuthorEmail>
<QPM:ProductIconSmall/>
<QPM:ProductIconLarge/>
<QPM:ProductDescriptionShort>This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms.</QPM:ProductDescriptionShort>
<QPM:ProductDescriptionLong>This is the Simple DirectMedia Layer (SDL), a generic API that provides low level access to audio, keyboard, mouse, and display framebuffer across multiple platforms. This is the libraries, include files and other resources you can use to develop and run SDL applications.</QPM:ProductDescriptionLong>
<QPM:ProductDescriptionURL>http://www.libsdl.org</QPM:ProductDescriptionURL>
<QPM:ProductDescriptionEmbedURL/>
</QPM:ProductDescription>
<QPM:ReleaseDescription>
<QPM:ReleaseVersion>@VERSION@</QPM:ReleaseVersion>
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
<QPM:ReleaseNoteMinor/>
<QPM:ReleaseNoteMajor/>
<QPM:ReleaseBuild>1</QPM:ReleaseBuild>
<QPM:CountryExclude/>
<QPM:ReleaseCopyright>GNU Lesser General Public License</QPM:ReleaseCopyright>
</QPM:ReleaseDescription>
<QPM:ContentDescription>
<QPM:ContentTopic xmlmultiple="true">Software Development/Libraries and Extensions/C Libraries</QPM:ContentTopic>
<QPM:ContentKeyword>SDL,audio,graphics,demos,games,emulators,direct,media,layer</QPM:ContentKeyword>
<QPM:TargetOS>qnx6</QPM:TargetOS>
<QPM:HostOS>none</QPM:HostOS>
<QPM:DisplayEnvironment xmlmultiple="true">Photon</QPM:DisplayEnvironment>
<QPM:DisplayEnvironment xmlmultiple="true">Console</QPM:DisplayEnvironment>
<QPM:TargetAudience xmlmultiple="true">Developer</QPM:TargetAudience>
<QPM:TargetAudience xmlmultiple="true">User</QPM:TargetAudience>
</QPM:ContentDescription>
<QPM:LicenseUrl>repdata://LicenseUrl/COPYING</QPM:LicenseUrl>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="none" target="none">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="x86" target="none">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="none" target="x86">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
<QPG:PackageFilter proc="x86" target="x86">
<QPM:PackageManifest>
<QPM:ProductInstallationDependencies>
<QPM:ProductRequirements></QPM:ProductRequirements>
</QPM:ProductInstallationDependencies>
</QPM:PackageManifest>
</QPG:PackageFilter>
</QPG:Values>
</QPG:Generation>

113
ws2010/gdi3/p5/SDL/SDL.spec Normal file
View File

@ -0,0 +1,113 @@
Summary: Simple DirectMedia Layer
Name: SDL
Version: 1.2.14
Release: 1
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
URL: http://www.libsdl.org/
License: LGPL
Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Prefix: %{_prefix}
%ifos linux
Provides: libSDL-1.2.so.0
%endif
%define __defattr %defattr(-,root,root)
%define __soext so
%description
This is the Simple DirectMedia Layer, a generic API that provides low
level access to audio, keyboard, mouse, and display framebuffer across
multiple platforms.
%package devel
Summary: Libraries, includes and more to develop SDL applications.
Group: Development/Libraries
Requires: %{name} = %{version}
%description devel
This is the Simple DirectMedia Layer, a generic API that provides low
level access to audio, keyboard, mouse, and display framebuffer across
multiple platforms.
This is the libraries, include files and other resources you can use
to develop SDL applications.
%prep
%setup -q
%build
%ifos linux
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga
%else
%configure
%endif
make
%install
rm -rf $RPM_BUILD_ROOT
%ifos linux
make install prefix=$RPM_BUILD_ROOT%{prefix} \
bindir=$RPM_BUILD_ROOT%{_bindir} \
libdir=$RPM_BUILD_ROOT%{_libdir} \
includedir=$RPM_BUILD_ROOT%{_includedir} \
datadir=$RPM_BUILD_ROOT%{_datadir} \
mandir=$RPM_BUILD_ROOT%{_mandir}
ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0
%else
%makeinstall
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%{__defattr}
%doc README-SDL.txt COPYING CREDITS BUGS
%{_libdir}/lib*.%{__soext}.*
%files devel
%{__defattr}
%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html
%doc docs/index.html docs/html
%{_bindir}/*-config
%{_libdir}/lib*.a
%{_libdir}/lib*.la
%{_libdir}/lib*.%{__soext}
%dir %{_includedir}/SDL
%{_includedir}/SDL/*.h
%{_libdir}/pkgconfig/sdl.pc
%{_datadir}/aclocal/*
%{_mandir}/man3/*
%changelog
* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
- Removed support for Darwin, due to build problems on ps2linux
* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
- Added support for Darwin, updated spec file
* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
- Re-integrated spec file into SDL distribution
- 'name' and 'version' come from configure
- Some of the documentation is devel specific
- Removed SMP support from %build - it doesn't work with libtool anyway
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
- Hacked Mandrake sdl spec to build 1.1
* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
- Build Release
* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
- Add symlink for libSDL-1.0.so.0 required by sdlbomber
- Added docs
* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
- v 1.0.0
* Mon Nov 1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- First spec file for Mandrake distribution.
# end of file

View File

@ -0,0 +1,113 @@
Summary: Simple DirectMedia Layer
Name: SDL
Version: @SDL_VERSION@
Release: 1
Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
URL: http://www.libsdl.org/
License: LGPL
Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Prefix: %{_prefix}
%ifos linux
Provides: libSDL-1.2.so.0
%endif
%define __defattr %defattr(-,root,root)
%define __soext so
%description
This is the Simple DirectMedia Layer, a generic API that provides low
level access to audio, keyboard, mouse, and display framebuffer across
multiple platforms.
%package devel
Summary: Libraries, includes and more to develop SDL applications.
Group: Development/Libraries
Requires: %{name} = %{version}
%description devel
This is the Simple DirectMedia Layer, a generic API that provides low
level access to audio, keyboard, mouse, and display framebuffer across
multiple platforms.
This is the libraries, include files and other resources you can use
to develop SDL applications.
%prep
%setup -q
%build
%ifos linux
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-aalib --disable-video-directfb --disable-video-ggi --disable-video-svga
%else
%configure
%endif
make
%install
rm -rf $RPM_BUILD_ROOT
%ifos linux
make install prefix=$RPM_BUILD_ROOT%{prefix} \
bindir=$RPM_BUILD_ROOT%{_bindir} \
libdir=$RPM_BUILD_ROOT%{_libdir} \
includedir=$RPM_BUILD_ROOT%{_includedir} \
datadir=$RPM_BUILD_ROOT%{_datadir} \
mandir=$RPM_BUILD_ROOT%{_mandir}
ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0
%else
%makeinstall
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%{__defattr}
%doc README-SDL.txt COPYING CREDITS BUGS
%{_libdir}/lib*.%{__soext}.*
%files devel
%{__defattr}
%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html
%doc docs/index.html docs/html
%{_bindir}/*-config
%{_libdir}/lib*.a
%{_libdir}/lib*.la
%{_libdir}/lib*.%{__soext}
%dir %{_includedir}/SDL
%{_includedir}/SDL/*.h
%{_libdir}/pkgconfig/sdl.pc
%{_datadir}/aclocal/*
%{_mandir}/man3/*
%changelog
* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
- Removed support for Darwin, due to build problems on ps2linux
* Mon Jan 03 2004 Anders Bjorklund <afb@algonet.se>
- Added support for Darwin, updated spec file
* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
- Re-integrated spec file into SDL distribution
- 'name' and 'version' come from configure
- Some of the documentation is devel specific
- Removed SMP support from %build - it doesn't work with libtool anyway
* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
- Hacked Mandrake sdl spec to build 1.1
* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
- Build Release
* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
- Add symlink for libSDL-1.0.so.0 required by sdlbomber
- Added docs
* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
- v 1.0.0
* Mon Nov 1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
- First spec file for Mandrake distribution.
# end of file

25
ws2010/gdi3/p5/SDL/TODO Normal file
View File

@ -0,0 +1,25 @@
Wish list for the 1.3 development branch:
http://bugzilla.libsdl.org/
* Add mousewheel events (new unified event architecture?)
* DirectInput joystick support needs to be implemented
* Be able to enumerate and select available audio and video drivers
* Fullscreen video mode support for Mac OS X
* Explicit vertical retrace wait (maybe separate from SDL_Flip?)
* Shaped windows, windows without borders
* Multiple windows, multiple display support
* SDL_INIT_EVENTTHREAD on Windows and MacOS?
* Add a timestamp to events
* Add audio input API
* Add hardware accelerated scaled blit
* Add hardware accelerated alpha blits
* Redesign blitting architecture to allow blit plugins
In the jump from 1.2 to 1.3, we should change the SDL_Rect members to
int and evaluate all the rest of the datatypes. This is the only place
we should do it though, since the 1.2 series should not break binary
compatibility in this way.
Requests:
* PCM and CDROM volume control (deprecated, but possible)

View File

@ -0,0 +1,171 @@
<HTML>
<HEAD>
<TITLE>Using SDL with Microsoft Visual C++</TITLE>
</HEAD>
<BODY>
<H1>
Using SDL with Microsoft Visual C++ 5,6&nbsp;and 7
</H1>
<H3>
by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro </A>and additions by <A HREF="mailto:james@conceptofzero.net">
James Turk</A>
</H3>
<p>
You can either use the precompiled libraries from <A HREF="http://www.libsdl.org/download.php">
the SDL Download web site </A>, or you can build SDL yourself.
</p>
<H3>
Building SDL
</H3>
<P>
Unzip the <CODE>VisualC.zip</CODE> file into the directory that contains this
file (<CODE>VisualC.html</CODE>).
</P>
<P>
Be certain that you unzip the zip file for your compiler into <strong>this</strong>
directory and not any other directory. If you are using WinZip, be careful to
make sure that it extracts to <strong>this</strong> folder, because it's
convenient feature of unzipping to a folder with the name of the file currently
being unzipped will get you in trouble if you use it right now. And that's all
I have to say about that.
</P>
<P>
Now that it's unzipped, go into the VisualC
directory that is created, and double-click on the VC++ file "<CODE>SDL.dsw</CODE>"<STRONG><FONT color="#009900">
("<CODE>SDL.sln</CODE>").</FONT></STRONG> This should open up the IDE.
</P>
<P>
You may be prompted at this point to upgrade the workspace, should you be using
a more recent version of Visual C++. If so, allow the workspace to be upgraded.
</P>
<P>
Build the <CODE>.dll</CODE> and <CODE>.lib</CODE> files.
</P>
<P>
This is done by right clicking on each project in turn (Projects are listed in
the Workspace panel in the FileView tab), and selecting "Build".
</P>
<P>
If you get an error about SDL_config.h being missing, you should
copy include/SDL_config.h.default to include/SDL_config.h and try again.
</P>
<P>
You may get a few warnings, but you should not get any errors. You do have to
have at least the DirectX 5 SDK installed, however. The latest
version of DirectX can be downloaded or purchased on a cheap CD (my
recommendation) from <A HREF="http://www.microsoft.com">Microsoft </A>.
</P>
<P>
Later, we will refer to the following .lib and .dll files that have just been
generated:
</P>
<ul>
<li> SDL.dll</li>
<li> SDL.lib</li>
<li> SDLmain.lib</li>
</ul>
<P>
Search for these using the Windows Find (Windows-F) utility, if you don't
already know where they should be. For those of you with a clue, look inside
the Debug or Release directories of the subdirectories of the Project folder.
(It might be easier to just use Windows Find if this sounds confusing. And
don't worry about needing a clue; we all need visits from the clue fairy
frequently.)
</P>
<H3>
Creating a Project with SDL
</H3>
<P>
Create a project as a Win32 Application.
</P>
<P>
Create a C++ file for your project.
</P>
<P>
Set the C runtime to "Multi-threaded DLL" in the menu: <CODE>Project|Settings|C/C++
tab|Code Generation|Runtime Library </CODE>.
</P>
<P>
Add the SDL <CODE>include</CODE> directory to your list of includes in the
menu: <CODE>Project|Settings|C/C++ tab|Preprocessor|Additional include directories </CODE>
.
<br>
<STRONG><FONT color="#009900">VC7 Specific: Instead of doing this I find it easier to
add the include and library directories to the list that VC7 keeps. Do this by
selecting Tools|Options|Projects|VC++ Directories and under the "Show
Directories For:" dropbox select "Include Files", and click the "New Directory
Icon" and add the [SDLROOT]\include directory (ex. If you installed to
c:\SDL-1.2.5\ add c:\SDL-1.2.5\include).&nbsp;Proceed to&nbsp;change the
dropbox selection to "Library Files" and add [SDLROOT]\lib.</FONT></STRONG>
</P>
<P>
The "include directory" I am referring to is the <CODE>include</CODE> folder
within the main SDL directory (the one that this HTML file located within).
</P>
<P>
Now we're going to use the files that we had created earlier in the Build SDL
step.
</P>
<P>
Copy the following files into your Project directory:
</P>
<ul>
<li> SDL.dll</li>
</ul>
<P>
Add the following files to your project (It is not necessary to copy them to
your project directory):
</P>
<ul>
<li> SDL.lib </li>
<li> SDLmain.lib</li>
</ul>
<P>
(To add them to your project, right click on your project, and select "Add
files to project")
</P>
<P><STRONG><FONT color="#009900">Instead of adding the files to your project it is more
desireable to add them to the linker options: Project|Properties|Linker|Command
Line and type the names of the libraries to link with in the "Additional
Options:" box.&nbsp; Note: This must be done&nbsp;for&nbsp;each&nbsp;build
configuration (eg. Release,Debug).</FONT></STRONG></P>
<H3>
SDL 101, First Day of Class
</H3>
<P>
Now create the basic body of your project. The body of your program should take
the following form: <CODE>
<PRE>
#include "SDL.h"
int main( int argc, char* argv[] )
{
// Body of the program goes here.
return 0;
}
</PRE>
</CODE>
<P></P>
<H3>
That's it!
</H3>
<P>
I hope that this document has helped you get through the most difficult part of
using the SDL: installing it. Suggestions for improvements to this document
should be sent to the writers of this document.
</P>
<P>
Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port.
</P>
<P>
This document was originally called "VisualC.txt", and was written by <A HREF="mailto:slouken@libsdl.org">
Sam Lantinga</A>.
</P>
<P>
Later, it was converted to HTML and expanded into the document that you see
today by <A HREF="mailto:snowlion@sprynet.com">Lion Kimbro</A>.
</P>
<P>Minor Fixes and Visual C++ 7 Information (In Green) was added by <A HREF="mailto:james@conceptofzero.net">James Turk</A>
</P>
</BODY>
</HTML>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

727
ws2010/gdi3/p5/SDL/WhatsNew Normal file
View File

@ -0,0 +1,727 @@
This is a list of API changes in SDL's version history.
Version 1.0:
1.2.14:
Added cast macros for correct usage with C++:
SDL_reinterpret_cast(type, expression)
SDL_static_cast(type, expression)
Added SDL_VIDEO_FULLSCREEN_DISPLAY as a preferred synonym for
SDL_VIDEO_FULLSCREEN_HEAD on X11.
Added SDL_DISABLE_LOCK_KEYS environment variable to enable normal
up/down events for Caps-Lock and Num-Lock keys.
1.2.13:
Added SDL_BUTTON_X1 and SDL_BUTTON_X2 constants.
1.2.12:
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling
of the screensaver on Mac OS X and X11.
1.2.10:
If SDL_OpenAudio() is passed zero for the desired format
fields, the following environment variables will be used
to fill them in:
SDL_AUDIO_FREQUENCY
SDL_AUDIO_FORMAT
SDL_AUDIO_CHANNELS
SDL_AUDIO_SAMPLES
If an environment variable is not specified, it will be set
to a reasonable default value.
Added support for the SDL_VIDEO_FULLSCREEN_HEAD environment
variable, currently supported on X11 Xinerama configurations.
Added SDL_GL_SWAP_CONTROL to wait for vsync in OpenGL applications.
Added SDL_GL_ACCELERATED_VISUAL to guarantee hardware acceleration.
Added current_w and current_h to the SDL_VideoInfo structure,
which is set to the desktop resolution during video intialization,
and then set to the current resolution when a video mode is set.
SDL_SetVideoMode() now accepts 0 for width or height and will use
the current video mode (or the desktop mode if no mode has been set.)
Added SDL_GetKeyRepeat()
Added SDL_config.h, with defaults for various build environments.
1.2.7:
Added CPU feature detection functions to SDL_cpuinfo.h:
SDL_HasRDTSC(), SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE(),
SDL_HasAltiVec()
Added function to create RWops from const memory: SDL_RWFromConstMem()
1.2.6:
Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject()
Added SDL_GL_MULTISAMPLEBUFFERS and SDL_GL_MULTISAMPLESAMPLES for FSAA
1.2.5:
Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
Added SDL_GL_STEREO for stereoscopic OpenGL contexts
1.2.0:
Added SDL_VIDEOEXPOSE event to signal that the screen needs to
be redrawn. This is currently only delivered to OpenGL windows
on X11, though it may be delivered in the future when the video
memory is lost under DirectX.
1.1.8:
You can pass SDL_NOFRAME to SDL_VideoMode() to create a window
that has no title bar or frame decoration. Fullscreen video
modes automatically have this flag set.
Added a function to query the clipping rectangle for a surface:
void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect)
Added a function to query the current event filter:
SDL_EventFilter SDL_GetEventFilter(void)
If you pass -1 to SDL_ShowCursor(), it won't change the current
cursor visibility state, but will still return it.
SDL_LockSurface() and SDL_UnlockSurface() are recursive, meaning
you can nest them as deep as you want, as long as each lock call
has a matching unlock call. The surface remains locked until the
last matching unlock call.
Note that you may not blit to or from a locked surface.
1.1.7:
The SDL_SetGammaRamp() and SDL_GetGammaRamp() functions now take
arrays of Uint16 values instead of Uint8 values. For the most part,
you can just take your old values and shift them up 8 bits to get
new correct values for your gamma ramps.
You can pass SDL_RLEACCEL in flags passed to SDL_ConvertSurface()
and SDL will try to RLE accelerate colorkey and alpha blits in the
resulting surface.
1.1.6:
Added a function to return the thread ID of a specific thread:
Uint32 SDL_GetThreadID(SDL_Thread *thread)
If 'thread' is NULL, this function returns the id for this thread.
1.1.5:
The YUV overlay structure has been changed to use an array of
pitches and pixels representing the planes of a YUV image, to
better enable hardware acceleration. The YV12 and IYUV formats
each have three planes, corresponding to the Y, U, and V portions
of the image, while packed pixel YUV formats just have one plane.
For palettized mode (8bpp), the screen colormap is now split in
a physical and a logical palette. The physical palette determines
what colours the screen pixels will get when displayed, and the
logical palette controls the mapping from blits to/from the screen.
A new function, SDL_SetPalette() has been added to change
logical and physical palettes separately. SDL_SetColors() works
just as before, and is equivalent to calling SDL_SetPalette() with
a flag argument of (SDL_LOGPAL|SDL_PHYSPAL).
SDL_BlitSurface() no longer modifies the source rectangle, only the
destination rectangle. The width/height members of the destination
rectangle are ignored, only the position is used.
The old source clipping function SDL_SetClipping() has been replaced
with a more useful function to set the destination clipping rectangle:
SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect)
Added a function to see what subsystems have been initialized:
Uint32 SDL_WasInit(Uint32 flags)
The Big Alpha Flip: SDL now treats alpha as opacity like everybody
else, and not as transparency:
A new cpp symbol: SDL_ALPHA_OPAQUE is defined as 255
A new cpp symbol: SDL_ALPHA_TRANSPARENT is defined as 0
Values between 0 and 255 vary from fully transparent to fully opaque.
New functions:
SDL_DisplayFormatAlpha()
Returns a surface converted to a format with alpha-channel
that can be blit efficiently to the screen. (In other words,
like SDL_DisplayFormat() but the resulting surface has
an alpha channel.) This is useful for surfaces with alpha.
SDL_MapRGBA()
Works as SDL_MapRGB() but takes an additional alpha parameter.
SDL_GetRGBA()
Works as SDL_GetRGB() but also returns the alpha value
(SDL_ALPHA_OPAQUE for formats without an alpha channel)
Both SDL_GetRGB() and SDL_GetRGBA() now always return values in
the [0..255] interval. Previously, SDL_GetRGB() would return
(0xf8, 0xfc, 0xf8) for a completely white pixel in RGB565 format.
(N.B.: This is broken for bit fields < 3 bits.)
SDL_MapRGB() returns pixels in which the alpha channel is set opaque.
SDL_SetAlpha() can now be used for both setting the per-surface
alpha, using the new way of thinking of alpha, and also to enable
and disable per-pixel alpha blending for surfaces with an alpha
channel:
To disable alpha blending:
SDL_SetAlpha(surface, 0, 0);
To re-enable alpha blending:
SDL_SetAlpha(surface, SDL_SRCALPHA, 0);
Surfaces with an alpha channel have blending enabled by default.
SDL_SetAlpha() now accepts SDL_RLEACCEL as a flag, which requests
RLE acceleration of blits, just as like with SDL_SetColorKey().
This flag can be set for both surfaces with an alpha channel
and surfaces with an alpha value set by SDL_SetAlpha().
As always, RLE surfaces must be locked before pixel access is
allowed, and unlocked before any other SDL operations are done
on it.
The blit semantics for surfaces with and without alpha and colorkey
have now been defined:
RGBA->RGB:
SDL_SRCALPHA set:
alpha-blend (using alpha-channel).
SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set:
copy RGB.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the
comparison.
RGB->RGBA:
SDL_SRCALPHA set:
alpha-blend (using the source per-surface alpha value);
set destination alpha to opaque.
SDL_SRCALPHA not set:
copy RGB, set destination alpha to opaque.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source colour key.
RGBA->RGBA:
SDL_SRCALPHA set:
alpha-blend (using the source alpha channel) the RGB values;
leave destination alpha untouched. [Note: is this correct?]
SDL_SRCCOLORKEY ignored.
SDL_SRCALPHA not set:
copy all of RGBA to the destination.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source colour key, ignoring alpha in the
comparison.
RGB->RGB:
SDL_SRCALPHA set:
alpha-blend (using the source per-surface alpha value).
SDL_SRCALPHA not set:
copy RGB.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source colour key.
As a special case, blits from surfaces with per-surface alpha
value of 128 (50% transparency) are optimised and much faster
than other alpha values. This does not apply to surfaces with
alpha channels (per-pixel alpha).
New functions for manipulating the gamma of the display have
been added:
int SDL_SetGamma(float red, float green, float blue);
int SDL_SetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue);
int SDL_GetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue);
Gamma ramps are tables with 256 entries which map the screen color
components into actually displayed colors. For an example of
implementing gamma correction and gamma fades, see test/testgamma.c
Gamma control is not supported on all hardware.
1.1.4:
The size of the SDL_CDtrack structure changed from 8 to 12 bytes
as the size of the length member was extended to 32 bits.
You can now use SDL for 2D blitting with a GL mode by passing the
SDL_OPENGLBLIT flag to SDL_SetVideoMode(). You can specify 16 or
32 bpp, and the data in the framebuffer is put into the GL scene
when you call SDL_UpdateRects(), and the scene will be visible
when you call SDL_GL_SwapBuffers().
Run the "testgl" test program with the -logo command line option
to see an example of this blending of 2D and 3D in SDL.
1.1.3:
Added SDL_FreeRW() to the API, to complement SDL_AllocRW()
Added resizable window support - just add SDL_RESIZABLE to the
SDL_SetVideoMode() flags, and then wait for SDL_VIDEORESIZE events.
See SDL_events.h for details on the new SDL_ResizeEvent structure.
Added condition variable support, based on mutexes and semaphores.
SDL_CreateCond()
SDL_DestroyCond()
SDL_CondSignal()
SDL_CondBroadcast()
SDL_CondWait()
SDL_CondTimedWait()
The new function prototypes are in SDL_mutex.h
Added counting semaphore support, based on the mutex primitive.
SDL_CreateSemaphore()
SDL_DestroySemaphore()
SDL_SemWait()
SDL_SemTryWait()
SDL_SemWaitTimeout()
SDL_SemPost()
SDL_SemValue()
The new function prototypes are in SDL_mutex.h
Added support for asynchronous blitting. To take advantage of this,
you must set the SDL_ASYNCBLIT flag when setting the video mode and
creating surfaces that you want accelerated in this way. You must
lock surfaces that have this flag set, and the lock will block until
any queued blits have completed.
Added YUV video overlay support.
The supported YUV formats are: YV12, IYUV, YUY2, UYVY, and YVYU.
This function creates an overlay surface:
SDL_CreateYUVOverlay()
You must lock and unlock the overlay to get access to the data:
SDL_LockYUVOverlay() SDL_UnlockYUVOverlay()
You can then display the overlay:
SDL_DisplayYUVOverlay()
You must free the overlay when you are done using it:
SDL_FreeYUVOverlay()
See SDL_video.h for the full function prototypes.
The joystick hat position constants have been changed:
Old constant New constant
------------ ------------
0 SDL_HAT_CENTERED
1 SDL_HAT_UP
2 SDL_HAT_RIGHTUP
3 SDL_HAT_RIGHT
4 SDL_HAT_RIGHTDOWN
5 SDL_HAT_DOWN
6 SDL_HAT_LEFTDOWN
7 SDL_HAT_LEFT
8 SDL_HAT_LEFTUP
The new constants are bitmasks, so you can check for the
individual axes like this:
if ( hat_position & SDL_HAT_UP ) {
}
and you'll catch left-up, up, and right-up.
1.1.2:
Added multiple timer support:
SDL_AddTimer() and SDL_RemoveTimer()
SDL_WM_SetIcon() now respects the icon colorkey if mask is NULL.
1.1.0:
Added initial OpenGL support.
First set GL attributes (such as RGB depth, alpha depth, etc.)
SDL_GL_SetAttribute()
Then call SDL_SetVideoMode() with the SDL_OPENGL flag.
Perform all of your normal GL drawing.
Finally swap the buffers with the new SDL function:
SDL_GL_SwapBuffers()
See the new 'testgl' test program for an example of using GL with SDL.
You can load GL extension functions by using the function:
SDL_GL_LoadProcAddress()
Added functions to initialize and cleanup specific SDL subsystems:
SDL_InitSubSystem() and SDL_QuitSubSystem()
Added user-defined event type:
typedef struct {
Uint8 type;
int code;
void *data1;
void *data2;
} SDL_UserEvent;
This structure is in the "user" member of an SDL_Event.
Added a function to push events into the event queue:
SDL_PushEvent()
Example of using the new SDL user-defined events:
{
SDL_Event event;
event.type = SDL_USEREVENT;
event.user.code = my_event_code;
event.user.data1 = significant_data;
event.user.data2 = 0;
SDL_PushEvent(&event);
}
Added a function to get mouse deltas since last query:
SDL_GetRelativeMouseState()
Added a boolean datatype to SDL_types.h:
SDL_bool = { SDL_TRUE, SDL_FALSE }
Added a function to get the current audio status:
SDL_GetAudioState();
It returns one of:
SDL_AUDIO_STOPPED,
SDL_AUDIO_PLAYING,
SDL_AUDIO_PAUSED
Added an AAlib driver (ASCII Art) - by Stephane Peter.
1.0.6:
The input grab state is reset after each call to SDL_SetVideoMode().
The input is grabbed by default in fullscreen mode, and ungrabbed in
windowed mode. If you want to set input grab to a particular value,
you should set it after each call to SDL_SetVideoMode().
1.0.5:
Exposed SDL_AudioInit(), SDL_VideoInit()
Added SDL_AudioDriverName() and SDL_VideoDriverName()
Added new window manager function:
SDL_WM_ToggleFullScreen()
This is currently implemented only on Linux
The ALT-ENTER code has been removed - it's not appropriate for a
lib to bind keys when they aren't even emergency escape sequences.
ALT-ENTER functionality can be implemented with the following code:
int Handle_AltEnter(const SDL_Event *event)
{
if ( event->type == SDL_KEYDOWN ) {
if ( (event->key.keysym.sym == SDLK_RETURN) &&
(event->key.keysym.mod & KMOD_ALT) ) {
SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
return(0);
}
}
return(1);
}
SDL_SetEventFilter(Handle_AltEnter);
1.0.3:
Under X11, if you grab the input and hide the mouse cursor,
the mouse will go into a "relative motion" mode where you
will always get relative motion events no matter how far in
each direction you move the mouse - relative motion is not
bounded by the edges of the window (though the absolute values
of the mouse positions are clamped by the size of the window).
The SVGAlib, framebuffer console, and DirectInput drivers all
have this behavior naturally, and the GDI and BWindow drivers
never go into "relative motion" mode.
1.0.2:
Added a function to enable keyboard repeat:
SDL_EnableKeyRepeat()
Added a function to grab the mouse and keyboard input
SDL_WM_GrabInput()
Added a function to iconify the window.
SDL_WM_IconifyWindow()
If this function succeeds, the application will receive an event
signaling SDL_APPACTIVE event
1.0.1:
Added constants to SDL_audio.h for 16-bit native byte ordering:
AUDIO_U16SYS, AUDIO_S16SYS
1.0.0:
New public release
Version 0.11:
0.11.5:
A new function SDL_GetVideoSurface() has been added, and returns
a pointer to the current display surface.
SDL_AllocSurface() has been renamed SDL_CreateRGBSurface(), and
a new function SDL_CreateRGBSurfaceFrom() has been added to allow
creating an SDL surface from an existing pixel data buffer.
Added SDL_GetRGB() to the headers and documentation.
0.11.4:
SDL_SetLibraryPath() is no longer meaningful, and has been removed.
0.11.3:
A new flag for SDL_Init(), SDL_INIT_NOPARACHUTE, prevents SDL from
installing fatal signal handlers on operating systems that support
them.
Version 0.9:
0.9.15:
SDL_CreateColorCursor() has been removed. Color cursors should
be implemented as sprites, blitted by the application when the
cursor moves. To get smooth color cursor updates when the app
is busy, pass the SDL_INIT_EVENTTHREAD flag to SDL_Init(). This
allows you to handle the mouse motion in another thread from an
event filter function, but is currently only supported by Linux
and BeOS. Note that you'll have to protect the display surface
from multi-threaded access by using mutexes if you do this.
Thread-safe surface support has been removed from SDL.
This makes blitting somewhat faster, by removing SDL_MiddleBlit().
Code that used SDL_MiddleBlit() should use SDL_LowerBlit() instead.
You can make your surfaces thread-safe by allocating your own
mutex and making lock/unlock calls around accesses to your surface.
0.9.14:
SDL_GetMouseState() now takes pointers to int rather than Uint16.
If you set the SDL_WINDOWID environment variable under UNIX X11,
SDL will use that as the main window instead of creating it's own.
This is an unsupported extension to SDL, and not portable at all.
0.9.13:
Added a function SDL_SetLibraryPath() which can be used to specify
the directory containing the SDL dynamic libraries. This is useful
for commercial applications which ship with particular versions
of the libraries, and for security on multi-user systems.
If this function is not used, the default system directories are
searched using the native dynamic object loading mechanism.
In order to support C linkage under Visual C++, you must declare
main() without any return type:
main(int argc, char *argv[]) {
/* Do the program... */
return(0);
}
C++ programs should also return a value if compiled under VC++.
The blit_endian member of the SDL_VideoInfo struct has been removed.
SDL_SymToASCII() has been replaced with SDL_GetKeyName(), so there
is now no longer any function to translate a keysym to a character.
The SDL_keysym structure has been extended with a 'scancode' and
'unicode' member. The 'scancode' is a hardware specific scancode
for the key that was pressed, and may be 0. The 'unicode' member
is a 16-bit UNICODE translation of the key that was pressed along
with any modifiers or compose keys that have been pressed.
If no UNICODE translation exists for the key, 'unicode' will be 0.
Added a function SDL_EnableUNICODE() to enable/disable UNICODE
translation of character keypresses. Translation defaults off.
To convert existing code to use the new API, change code which
uses SDL_SymToASCII() to get the keyname to use SDL_GetKeyName(),
and change code which uses it to get the ASCII value of a sym to
use the 'unicode' member of the event keysym.
0.9.12:
There is partial support for 64-bit datatypes. I don't recommend
you use this if you have a choice, because 64-bit datatypes are not
supported on many platforms. On platforms for which it is supported,
the SDL_HAS_64BIT_TYPE C preprocessor define will be enabled, and
you can use the Uint64 and Sint64 datatypes.
Added functions to SDL_endian.h to support 64-bit datatypes:
SDL_SwapLE64(), SDL_SwapBE64(),
SDL_ReadLE64(), SDL_ReadBE64(), SDL_WriteLE64(), SDL_WriteBE64()
A new member "len_ratio" has been added to the SDL_AudioCVT structure,
and allows you to determine either the original buffer length or the
converted buffer length, given the other.
A new function SDL_FreeWAV() has been added to the API to free data
allocated by SDL_LoadWAV_RW(). This is necessary under Win32 since
the gcc compiled DLL uses a different heap than VC++ compiled apps.
SDL now has initial support for international keyboards using the
Latin character set.
If a particular mapping is desired, you can set the DEFAULT_KEYBOARD
compile-time variable, or you can set the environment variable
"SDL_KEYBOARD" to a string identifying the keyboard mapping you desire.
The valid values for these variables can be found in SDL_keyboard.c
Full support for German and French keyboards under X11 is implemented.
0.9.11:
The THREADED_EVENTS compile-time define has been replaced with the
SDL_INIT_EVENTTHREAD flag. If this flag is passed to SDL_Init(),
SDL will create a separate thread to perform input event handling.
If this flag is passed to SDL_Init(), and the OS doesn't support
event handling in a separate thread, SDL_Init() will fail.
Be sure to add calls to SDL_Delay() in your main thread to allow
the OS to schedule your event thread, or it may starve, leading
to slow event delivery and/or dropped events.
Currently MacOS and Win32 do not support this flag, while BeOS
and Linux do support it. I recommend that your application only
use this flag if absolutely necessary.
The SDL thread function passed to SDL_CreateThread() now returns a
status. This status can be retrieved by passing a non-NULL pointer
as the 'status' argument to SDL_WaitThread().
The volume parameter to SDL_MixAudio() has been increased in range
from (0-8) to (0-128)
SDL now has a data source abstraction which can encompass a file,
an area of memory, or any custom object you can envision. It uses
these abstractions, SDL_RWops, in the endian read/write functions,
and the built-in WAV and BMP file loaders. This means you can load
WAV chunks from memory mapped files, compressed archives, network
pipes, or anything else that has a data read abstraction.
There are three built-in data source abstractions:
SDL_RWFromFile(), SDL_RWFromFP(), SDL_RWFromMem()
along with a generic data source allocation function:
SDL_AllocRW()
These data sources can be used like stdio file pointers with the
following convenience functions:
SDL_RWseek(), SDL_RWread(), SDL_RWwrite(), SDL_RWclose()
These functions are defined in the new header file "SDL_rwops.h"
The endian swapping functions have been turned into macros for speed
and SDL_CalculateEndian() has been removed. SDL_endian.h now defines
SDL_BYTEORDER as either SDL_BIG_ENDIAN or SDL_LIL_ENDIAN depending on
the endianness of the host system.
The endian read/write functions now take an SDL_RWops pointer
instead of a stdio FILE pointer, to support the new data source
abstraction.
The SDL_*LoadWAV() functions have been replaced with a single
SDL_LoadWAV_RW() function that takes a SDL_RWops pointer as it's
first parameter, and a flag whether or not to automatically
free it as the second parameter. SDL_LoadWAV() is a macro for
backward compatibility and convenience:
SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
The SDL_*LoadBMP()/SDL_*SaveBMP() functions have each been replaced
with a single function that takes a SDL_RWops pointer as it's
first parameter, and a flag whether or not to automatically
free it as the second parameter. SDL_LoadBMP() and SDL_SaveBMP()
are macros for backward compatibility and convenience:
SDL_LoadBMP_RW(SDL_RWFromFile("sample.bmp", "rb"), 1, ...);
SDL_SaveBMP_RW(SDL_RWFromFile("sample.bmp", "wb"), 1, ...);
Note that these functions use SDL_RWseek() extensively, and should
not be used on pipes or other non-seekable data sources.
0.9.10:
The Linux SDL_SysWMInfo and SDL_SysWMMsg structures have been
extended to support multiple types of display drivers, as well as
safe access to the X11 display when THREADED_EVENTS is enabled.
The new structures are documented in the SDL_syswm.h header file.
Thanks to John Elliott <jce@seasip.demon.co.uk>, the UK keyboard
should now work properly, as well as the "Windows" keys on US
keyboards.
The Linux CD-ROM code now reads the CD-ROM devices from /etc/fstab
instead of trying to open each block device on the system.
The CD must be listed in /etc/fstab as using the iso9660 filesystem.
On Linux, if you define THREADED_EVENTS at compile time, a separate
thread will be spawned to gather X events asynchronously from the
graphics updates. This hasn't been extensively tested, but it does
provide a means of handling keyboard and mouse input in a separate
thread from the graphics thread. (This is now enabled by default.)
A special access function SDL_PeepEvents() allows you to manipulate
the event queue in a thread-safe manner, including peeking at events,
removing events of a specified type, and adding new events of arbitrary
type to the queue (use the new 'user' member of the SDL_Event type).
If you use SDL_PeepEvents() to gather events, then the main graphics
thread needs to call SDL_PumpEvents() periodically to drive the event
loop and generate input events. This is not necessary if SDL has been
compiled with THREADED_EVENTS defined, but doesn't hurt.
A new function SDL_ThreadID() returns the identifier associated with
the current thread.
0.9.9:
The AUDIO_STEREO format flag has been replaced with a new 'channels'
member of the SDL_AudioSpec structure. The channels are 1 for mono
audio, and 2 for stereo audio. In the future more channels may be
supported for 3D surround sound.
The SDL_MixAudio() function now takes an additional volume parameter,
which should be set to SDL_MIX_MAXVOLUME for compatibility with the
original function.
The CD-ROM functions which take a 'cdrom' parameter can now be
passed NULL, and will act on the last successfully opened CD-ROM.
0.9.8:
No changes, bugfixes only.
0.9.7:
No changes, bugfixes only.
0.9.6:
Added a fast rectangle fill function: SDL_FillRect()
Addition of a useful function for getting info on the video hardware:
const SDL_VideoInfo *SDL_GetVideoInfo(void)
This function replaces SDL_GetDisplayFormat().
Initial support for double-buffering:
Use the SDL_DOUBLEBUF flag in SDL_SetVideoMode()
Update the screen with a new function: SDL_Flip()
SDL_AllocSurface() takes two new flags:
SDL_SRCCOLORKEY means that the surface will be used for colorkey blits
and if the hardware supports hardware acceleration of colorkey blits
between two surfaces in video memory, to place the surface in video
memory if possible, otherwise it will be placed in system memory.
SDL_SRCALPHA means that the surface will be used for alpha blits and
if the hardware supports hardware acceleration of alpha blits between
two surfaces in video memory, to place the surface in video memory
if possible, otherwise it will be placed in system memory.
SDL_HWSURFACE now means that the surface will be created with the
same format as the display surface, since having surfaces in video
memory is only useful for fast blitting to the screen, and you can't
blit surfaces with different surface formats in video memory.
0.9.5:
You can now pass a NULL mask to SDL_WM_SetIcon(), and it will assume
that the icon consists of the entire image.
SDL_LowerBlit() is back -- but don't use it on the display surface.
It is exactly the same as SDL_MiddleBlit(), but doesn't check for
thread safety.
Added SDL_FPLoadBMP(), SDL_FPSaveBMP(), SDL_FPLoadWAV(), which take
a FILE pointer instead of a file name.
Added CD-ROM audio control API:
SDL_CDNumDrives()
SDL_CDName()
SDL_CDOpen()
SDL_CDStatus()
SDL_CDPlayTracks()
SDL_CDPlay()
SDL_CDPause()
SDL_CDResume()
SDL_CDStop()
SDL_CDEject()
SDL_CDClose()
0.9.4:
No changes, bugfixes only.
0.9.3:
Mouse motion event now includes relative motion information:
Sint16 event->motion.xrel, Sint16 event->motion.yrel
X11 keyrepeat handling can be disabled by defining IGNORE_X_KEYREPEAT
(Add -DIGNORE_X_KEYREPEAT to CFLAGS line in obj/x11Makefile)
0.9.2:
No changes, bugfixes only.
0.9.1:
Removed SDL_MapSurface() and SDL_UnmapSurface() -- surfaces are now
automatically mapped on blit.
0.8.0:
SDL stable release

Binary file not shown.

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