Skip to content

Commit

Permalink
initial MESA support - glLoadIdentity, glMatrixMode
Browse files Browse the repository at this point in the history
  • Loading branch information
kburtch committed Sep 20, 2013
1 parent 10ecc14 commit 3864518
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 118 deletions.
91 changes: 3 additions & 88 deletions ChangeLog
@@ -1,93 +1,8 @@
For the latest news, visit the Linux Cafe at the PegaSoft web site.

SparForte 1.4's focus was on REST, DB, OpenGL
SparForte 1.5's focus was on REST, DB, OpenGL

KNOWN BUGS
CHANGES SINCE 1.4

- integer type casting is not working on parameters
- freebsd rounding of 2.5 fails because freebsd rounds down instead of up (FreeBSD Ada bug??)

CHANGES SINCE 1.3

1. New: RPM spec for Red Hat builds.

2. Fix: numerics.even no longer requires extra parenthesis.

3. Fix: numerics.hash_of, sdbm_hash_of, fnv_hash_of, murmur_hash_of no longer
throw an exception on a number instead of a string as the first parameter.

4. Fix: FreeBSD 9 support.

5. Fix: AdaVox discriminant error on newer Ada compilers corrected.

6. Fix: EINTR handling on one line was for 64-bit now works with 32-bit also.

7. New: started pen OpenGL capabilities by defining OpenGL constants.

8. Fix: boolean shortcut no longer runs on lines that are not executing
[check].

9. Fix: Kudge for division by zero bug found in GCC Ada 4.7.1. Dividing by zero now throws an exception again.

10. New: Raspberry Pi / ARM6l support in configure script.

11. Change: gstreamer replaces ADAVOX OSS for sound package.

12. New: Pragma block. Pragma is...end pragma.

13. New: Pragma chains. Pragmas may be chained using @, both stand-alone pragmas and pragma blocks.

14. New: Example program: weave.sp

15. Change: pragma debug no longer strips a final end-of-line. put_line and put now work normally, not as they would in a backquote literal.

16. Fix: pragma debug - source_info and error messages now use the enclosing script's line number, rather than the backquotes script line number (e.g. line 1). This makes source_info useful in pragma debug. The character count in errors is still counted from the first backquote.

17. Fix: backquote literals - source_info and error messages now use the enclosing script's line number, rather than the backquotes script line number (e.g. line 1). The character count in errors is still counted from the first backquote.

18. Fix: Bourne shell command immediately following 'else' are no longer treated as Ada format.

19. New: Unused variables are not permitted. In --test mode, most unused identifiers are not permitted. Does not affect unused record fields or enumerated types and their items (see next item).

20. New: pragma restriction( no_unused_identifiers ); In --test mode, require that all enumerated items and type names are explicitly used.

21. Fix: out record parameters no longer allocate a new record for an existing record.

22. New: Basic exception handlers implemented. Reraising exceptions. Not completely negative tested.

23. New: Style checks on identifiers. Apply only in specific contexts.

24. Fix: strings.split, numerics.set_re, numerics.set_im,memcache.new_cluster, memcache.get, memcache.version, memcache.stats (and highreads) now classed as a procedure, not a function. pen.inside_rect, pen.in_rect, pen.greyscale, directory_operations.dir_separator now classed as a function not a procedure.

25. Fix: mysql.clear, mysql.will_rollback_on_finalize, mysql.is_trace, db.clear, db.will_rollback_on_finalize, db.is_trace no longer run during a syntax check.

26. Fix: mysql.tuples returns mysql.tuple_count_type as documented, not a natural. db.tuples returns db.tuple_count_type as document, not a natural.

27. Fix: backported some fixes from APQ 3.0 to APQ 2.1. Fixed closed trace file bugs, disconnect/reconnect bug and several others.

28. Fix: global profiles work correctly. (A line was mistakenly deleted in source code at some point.)

29. Fix: stats package functions now appear as functions not procedures (this did not affect their execution).

30. Fix: pen.get_pen_brush existed but wasn't visible. Now is visible.

31. Change: profile files and include files are now checked that they are not empty, not world-readable.

32. Fix: command_line.argument_count now returns a natural as documenteded, not a universal numeric. command_name now returns a string as document, not a universal string.

33. New: mysqlm package, mysql with multiple connections. New mysqlm.fetch_values procedure.

34. Change: Most built-in procedures and some functions now run using callbacks which should run slightly faster.

35. Fix: mysql.list now limits output to the current database, has fixed table type and engine layout and has been upgraded to show info properly for newer versions of MySQL and MariaDB.

36. Fix: assignments and user-defind subprogram parameters for integer subtypes (integer, positive, natural) to be assigned to the larger ranged integer type.

37. New: mysqlm.append_for_insert and mysqlm.append_for_update procedures that take a record as a parameter.

38. New: directory_operations.open, close, is_open, read. New data type directory_operations.dir_file_id.

39. New: style check: variable expansions must be in double quotes (with the exception of $?, $$, etc). New pragma suppress( word_quoting ) will disable this check.

40. Change: positive and natural are now subtypes of integer.
1. New: End of line whitespace check.

3 changes: 1 addition & 2 deletions configure
Expand Up @@ -715,7 +715,6 @@ fi

echo -n "configuring OpenGL (pkg-config)... "
if [ -n "PKGCONFIG" ] ; then
#TODO: these aren't implemented yet
MESALIBSTYPE=`(exec $PKGCONFIG --libs gl glu 2>/dev/null)`
MESALIBSTYPE=`echo "$MESALIBSTYPE" | sed 's/\ /\\\ /g;s/\//\\\\\//g'`
MESAINCLTYPE=`(exec $PKGCONFIG --cflags gl glu 2>/dev/null)`
Expand Down Expand Up @@ -1128,7 +1127,7 @@ touch c_gstreamer.c

echo "Creating...src/GNUmakefile"

sed "s/CPUFLAG/$CPU_FLAG/g;s/CCTYPE/$CC/g;s/CPUTYPE/$ARCH/g;s/MANPREFIXSUB/$MANPREFIX/g;s/PREFIXSUB/$PREFIX/g;s/GMAKETYPE/$GMAKETYPE/g;s/SDLLIBSTYPE/$SDLLIBSTYPE/g;s/SDLINCLTYPE/$SDLINCLTYPE/g;s/CFLAGSTYPE/$CFLAGSTYPE/g;s/PGLIBSSUB/$PGLIBSSUB/g;s/MYSQLLIBSSUB/$MYSQLLIBSSUB/g;s/APQLIBSSUB/$APQLIBSSUB/g;s/APQINCLSSUB/$APQINCLSSUB/g;s/ADAVOXINCLSSUB/$ADAVOXINCLSSUB/g;s/ADAVOXLIBSSUB/$ADAVOXLIBSSUB/g;s/ADAVOXMAKESUB/$ADAVOXMAKESUB/g;s/SDLINCLSSUB/$SDLINCLSSUB/g;s/APQMAKESUB/$APQMAKESUB/g;s/FASTCGISUB/$FASTCGISUB/g;s/GSTREAMERLIBSSUB/$GSTREAMERLIBS/g;s/GSTREAMERFLAGSUB/$GSTREAMERFLAG/g" < GNUmakefile.orig > GNUmakefile
sed "s/CPUFLAG/$CPU_FLAG/g;s/CCTYPE/$CC/g;s/CPUTYPE/$ARCH/g;s/MANPREFIXSUB/$MANPREFIX/g;s/PREFIXSUB/$PREFIX/g;s/GMAKETYPE/$GMAKETYPE/g;s/SDLLIBSTYPE/$SDLLIBSTYPE/g;s/SDLINCLTYPE/$SDLINCLTYPE/g;s/CFLAGSTYPE/$CFLAGSTYPE/g;s/PGLIBSSUB/$PGLIBSSUB/g;s/MYSQLLIBSSUB/$MYSQLLIBSSUB/g;s/APQLIBSSUB/$APQLIBSSUB/g;s/APQINCLSSUB/$APQINCLSSUB/g;s/ADAVOXINCLSSUB/$ADAVOXINCLSSUB/g;s/ADAVOXLIBSSUB/$ADAVOXLIBSSUB/g;s/ADAVOXMAKESUB/$ADAVOXMAKESUB/g;s/SDLINCLSSUB/$SDLINCLSSUB/g;s/APQMAKESUB/$APQMAKESUB/g;s/FASTCGISUB/$FASTCGISUB/g;s/GSTREAMERLIBSSUB/$GSTREAMERLIBS/g;s/GSTREAMERFLAGSUB/$GSTREAMERFLAG/g;s/MESAINCLSUB/$MESAINCLTYPE/g;s/MESALIBSSUB/$MESALIBSTYPE/g" < GNUmakefile.orig > GNUmakefile

cd ..
echo "Creating...GNUmakefile"
Expand Down
5 changes: 5 additions & 0 deletions doc/intro_sffaq.html
Expand Up @@ -400,6 +400,11 @@ <h4>Can you do Continuous Integration with Sparforte?</h4>
not the lines it executes, but it will give you and idea a script is
doing during a test.</p>

<h4>Can you do Test-driven Development with SparForte?</h4>

<p>Develop your programs with "spar --test", treating them as permanently
in the testing phase.</p>

<h4>Is there a libspar I can call to run Spar scripts from another
language, like I can with lua?</h4>

Expand Down
6 changes: 3 additions & 3 deletions examples/mandel.sp
Expand Up @@ -73,11 +73,11 @@ begin
blue := 0.0;
else
bits := (loop_count and 3 );
red := 100.0-pen.rgbcomponent((100*bits/3));
red := 100.0-pen.rgbcomponent((100*bits/3));
bits := (loop_count / 3 ) and 3;
green := 100.0-pen.rgbcomponent((100*bits/3));
green := 100.0-pen.rgbcomponent((100*bits/3));
bits := (loop_count / 27 ) and 2;
blue := 100.0-pen.rgbcomponent((100*bits)/2);
blue := 100.0-pen.rgbcomponent((100*bits)/2);
end if;
pen.set_pen_ink( c, red, green, blue );

Expand Down
44 changes: 23 additions & 21 deletions src/GNUmakefile.orig
Expand Up @@ -27,18 +27,20 @@ APQMAKE=APQMAKESUB
#ADAVOXMAKE=ADAVOXMAKESUB
GSTREAMERLIBS=GSTREAMERLIBSSUB
GSTREAMERFLAG=GSTREAMERFLAGSUB
MESAINCL=MESAINCLSUB
MESALIBS=MESALIBSSUB

# Libraries and Paths

#INCLUDE=-I./adacgi-1.6/ -I./apq-2.1/ -I./ADAVOX-0.51/bc -I./ADAVOX-0.51/wc -I./ADAVOX-0.51/main -I/usr/include/SDL
# Compiling options for including files
INCLUDE=-I./adacgi-1.6/ ${APQINCL} -I./pegasock/ ${ADAVOXINCL} ${SDLINCL}
INCLUDE=-I./adacgi-1.6/ ${APQINCL} -I./pegasock/ ${MESAINCL} ${SDLINCL}
# When binding, don't need to include the SDL files. In particular, the -D
# option created by the SDL config program will break gnatbind.
INCLUDE_BIND=-I./adacgi-1.6/ ${APQINCL} -I./pegasock/ ${ADAVOXINCL}
INCLUDE_BIND=-I./adacgi-1.6/ ${APQINCL} -I./pegasock/ #${MESAINCL}
#LIBS=-L`pg_config --libdir` -L./apq-1.92/ -lpq -lSDL ${PTHREAD_LIBS}
#LIBS=-L`pg_config --libdir` -L./apq-2.1/ ./apq-2.1/c_mysql.o -l SDL -l SDL_image ${PTHREAD_LIBS}
LIBS=-L ${PGLIBS} ${MYSQLLIBS} ${APQLIBS} -L./pegasock/ ./pegasock/c_tinyserve.o ./pegasock/c_os.o ${SDLLIBS}
LIBS=-L ${PGLIBS} ${MYSQLLIBS} ${APQLIBS} -L./pegasock/ ./pegasock/c_tinyserve.o ./pegasock/c_os.o ${SDLLIBS} ${MESALIBS}
# c_mysql.o missing in APQ 2.1 library

# Make Rules Start
Expand All @@ -56,13 +58,13 @@ all: c_os.o c_scanner.o c_gstreamer.o
@echo "---------------------------------------------------------------"
@echo
$(MAKE) -C adacgi-1.6
@echo
@echo "---------------------------------------------------------------"
@echo " Making AdaVOX (Wav/AU Player)"
@echo " http://home.cogeco.ca/~ve3wwg"
@echo "---------------------------------------------------------------"
@echo
$(ADAVOXMAKE)
#@echo
#@echo "---------------------------------------------------------------"
#@echo " Making AdaVOX (Wav/AU Player)"
#@echo " http://home.cogeco.ca/~ve3wwg"
#@echo "---------------------------------------------------------------"
#@echo
#$(ADAVOXMAKE)
@echo
@echo "---------------------------------------------------------------"
@echo " Making PegaSoft Socket Library"
Expand All @@ -84,7 +86,7 @@ all: c_os.o c_scanner.o c_gstreamer.o
@echo
$(GNATMAKE) -j2 -c -i -O1 $(CPU_FLAG)=$(CPU) -gnat05 -gnatfaon -gnatybdh -fstack-check -c $(INCLUDE) spar
gnatbind -x $(INCLUDE_BIND) spar.ali
gnatlink spar.ali ${ADAVOXLIBS} ${GSTREAMERLIBS} c_os.o c_scanner.o c_gstreamer.o $(LIBS)
gnatlink spar.ali ${GSTREAMERLIBS} c_os.o c_scanner.o c_gstreamer.o $(LIBS)
@echo
@echo "---------------------------------------------------------------"
@echo " Thanks for choosing SparForte"
Expand Down Expand Up @@ -120,12 +122,12 @@ max: clean c_os.o c_scanner.o c_gstreamer.o
@echo "---------------------------------------------------------------"
@echo
$(MAKE) -C adacgi-1.6
@echo
@echo "---------------------------------------------------------------"
@echo "Making AdaVOX"
@echo "---------------------------------------------------------------"
@echo
$(ADAVOXMAKE)
#@echo
#@echo "---------------------------------------------------------------"
#@echo "Making AdaVOX"
#@echo "---------------------------------------------------------------"
#@echo
#$(ADAVOXMAKE)
@echo
@echo "---------------------------------------------------------------"
@echo " Making PegaSoft Socket Library"
Expand All @@ -146,18 +148,18 @@ max: clean c_os.o c_scanner.o c_gstreamer.o
@echo
$(GNATMAKE) -j2 -c -i -O3 $(CPU_FLAG)=$(CPU) -gnatf -gnatn -gnatp -ffast-math -c $(INCLUDE) spar
gnatbind -x $(INCLUDE_BIND) spar.ali
gnatlink spar.ali ${ADAVOXLIBS} ${GSTREAMERLIBS} c_os.o c_scanner.o c_gstreamer.o $(LIBS)
gnatlink spar.ali ${GSTREAMERLIBS} c_os.o c_scanner.o c_gstreamer.o $(LIBS)

clean:
$(MAKE) -C adacgi-1.6 clean
$(MAKE) -C apq-2.1 clean
$(MAKE) -C ADAVOX-0.51 clean
#$(MAKE) -C ADAVOX-0.51 clean
$(MAKE) -C pegasock clean
-rm -f *.o *.ali t.t t.spar core spar.zip spar testsuite/write_only.txt testsuite/exec_only.txt

distclean:
$(MAKE) -C adacgi-1.6 clean
$(MAKE) -C ADAVOX-0.51 clobber
#$(MAKE) -C ADAVOX-0.51 clobber
$(MAKE) -C apq-2.1 clobber
$(MAKE) -C pegasock clean
-rm -f *.o *.ali *~ t.t t.spar core spar.zip spar testsuite/write_only.txt testsuite/exec_only.txt
Expand Down Expand Up @@ -198,7 +200,7 @@ rpm: all

bintar: c_os.o all
gnatbind -x $(INCLUDE_BIND) spar.ali
gnatlink spar.ali ${ADAVOXLIBS} ${GSTREAMERLIBS} c_os.o c_scanner.o c_gstreamer.o $(LIBS)
gnatlink spar.ali ${GSTREAMERLIBS} c_os.o c_scanner.o c_gstreamer.o $(LIBS)
(cd ..; rm -f spar.tgz; tar cfvz spar.tgz src/spar src/spar.1 README COPYING INSTALL examples doc GNUmakefile sparforte_icon.xpm; rm -f spar )
@echo "Don't forget to unpack and repack under a descriptive directory"

Expand Down
2 changes: 1 addition & 1 deletion src/bush_os-opengl.ads
Expand Up @@ -1340,7 +1340,7 @@ procedure glPopAttrib;
procedure glPushClientAttrib( mask : GLbitfield ); -- /* 1.1 */
procedure glPopClientAttrib; -- /* 1.1 */
function glRenderMode( mode : GLrendermodes ) return GLint;
function glGetError return GLenum;
function glGetError return GLerrors;
function glGetString( name : GLenum ) return system.address; -- GLUbyte*
procedure glFinish;
procedure glFlush;
Expand Down
17 changes: 14 additions & 3 deletions src/parser_pen.adb
Expand Up @@ -85,6 +85,11 @@ begin
identifiers( bottom_field_t ).value := to_unbounded_string( long_float( pen_rect.bottom ) );
end penRect2bushRect;

procedure opengl_err is
begin
-- TODO: need message, function glGetString( name : GLenum ) return system.address
err( "OpenGL error" );
end opengl_err;

----> Rects

Expand Down Expand Up @@ -2538,7 +2543,7 @@ begin
expect( pen_glgeterror_t );
if isExecutingCommand then
declare
errNum : GLenum := glGetError;
errNum : GLerrors := glGetError;
begin
result := to_unbounded_string( long_float( errNum ) );
exception when others =>
Expand Down Expand Up @@ -2744,6 +2749,9 @@ begin
if isExecutingCommand then
begin
glMatrixMode( GLmodes( to_numeric( mode_val ) ) );
if glGetError /= GL_NO_ERROR then
opengl_err;
end if;
exception when others =>
err( "exception raised" );
end;
Expand Down Expand Up @@ -2876,6 +2884,9 @@ begin
if isExecutingCommand then
begin
glLoadIdentity;
if glGetError /= GL_NO_ERROR then
opengl_err;
end if;
exception when others =>
err( "exception raised" );
end;
Expand Down Expand Up @@ -16934,13 +16945,13 @@ begin
declareProcedure( pen_gldepthrange_t, "pen.gldepthrange" );
declareProcedure( pen_glclearaccum_t, "pen.glclearaccum" );
declareProcedure( pen_glaccum_t, "pen.glaccum" );
declareProcedure( pen_glmatrixmode_t, "pen.glmatrixmode" );
declareProcedure( pen_glmatrixmode_t, "pen.glmatrixmode", ParsePenglMatrixMode'access );
declareProcedure( pen_glortho_t, "pen.glortho" );
declareProcedure( pen_glfrustum_t, "pen.glfrustum" );
declareProcedure( pen_glviewport_t, "pen.glviewport" );
declareProcedure( pen_glpushmatrix_t, "pen.glpushmatrix" );
declareProcedure( pen_glpopmatrix_t, "pen.glpopmatrix" );
declareProcedure( pen_glloadidentity_t, "pen.glloadidentity" );
declareProcedure( pen_glloadidentity_t, "pen.glloadidentity", ParsePenglLoadIdentity'access );
declareProcedure( pen_glloadmatrixd_t, "pen.glloadmatrixd" );
declareProcedure( pen_glloadmatrixf_t, "pen.glloadmatrixf" );
declareProcedure( pen_glmultmatrixd_t, "pen.glmultmatrixd" );
Expand Down
4 changes: 4 additions & 0 deletions src/parser_pen.ads
Expand Up @@ -2194,4 +2194,8 @@ procedure ParsePenPut;

procedure ParsePenPlot;

-- OpenGL (Mesa)

procedure ParsePenglMatrixMode;

end parser_pen;
19 changes: 19 additions & 0 deletions src/scanner.adb
Expand Up @@ -6222,6 +6222,9 @@ begin
lastLinePos := linePos - 1; -- back up one
line2compile := to_unbounded_string( slice( command, firstLinePos, lastLinePos ) );
line2ByteCode( ci, line2compile ); -- compress that slice
if element( line2compile, lastLinePos ) = ' ' or element( line2compile, lastLinePos ) = ASCII.HT then
err_tokenize( "trailing whitespace at end of line", to_string( line2compile ) );
end if;
-- DOS text files have CR+LF
if linePos < length( command ) then
if element( command, linePos ) = ASCII.CR then
Expand Down Expand Up @@ -6392,6 +6395,22 @@ begin
end if;
end if;
line2ByteCode( ci, command ); -- compress line
-- check for white space at end-of-line. Do line2ByteCode first because
-- it increments the line number so line number is accurate.
declare
i : integer := length( command );
ch : character;
begin
while i > 0 loop
ch := element( command, i );
if ch = ' ' or ch = ASCII.HT then
err_tokenize( "trailing whitespace at end-of-line", to_string( command ) );
elsif ch /= ASCII.CR and ch /= ASCII.LF then
exit;
end if;
i := i - 1;
end loop;
end;
exit when error_found; -- quit on err
compileDone := not LineRead( command'access ); -- quit when done
end loop;
Expand Down

0 comments on commit 3864518

Please sign in to comment.