[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-smalltalk] [PATCH] Use "returning: #{...}"
From: |
Paolo Bonzini |
Subject: |
[Help-smalltalk] [PATCH] Use "returning: #{...}" |
Date: |
Mon, 13 Aug 2007 14:55:32 +0200 |
User-agent: |
Thunderbird 2.0.0.6 (Macintosh/20070728) |
Almost there...
Paolo
2007-08-13 Paolo Bonzini <address@hidden>
* packages/gdbm/gdbm-c.st: Switch to the new syntax for "returning:".
* packages/ncurses/ncurses.st: Switch to the new syntax for "returning:"
* packages/gtk/MoreFuncs.st: Switch to the new syntax for "returning:".
* packages/gtk/funcs.awk: Likewise.
* looking for address@hidden/smalltalk--devo--2.2--patch-514 to compare with
* comparing to address@hidden/smalltalk--devo--2.2--patch-514
M NEWS
M packages/ncurses/ncurses.st
M packages/gdbm/gdbm-c.st
M packages/gtk/MoreFuncs.st
M packages/gtk/funcs.awk
--- orig/NEWS
+++ mod/NEWS
@@ -36,13 +36,29 @@ o GNU Smalltalk now needs InfoZIP to b
it is compiled, in order to use the new single-file package facility.
In the future, this dependency may be removed.
+o The tool for automatic documentation generator, that has been used by
+ the GNU Smalltalk distribution for a long time, is now installed as
gst-doc.
+
+
+Backwards-incompatible changes:
+
+o If you want to return a specific CObject class from a C call-out,
+ it is suggested that you stop using "returning: ClassName type", as in
+
+ <cCall: 'dupwin' returning: NCWindow type args: #(#self )>!
+
+ and instead use
+
+ <cCall: 'dupwin' returning: #{NCWindow} args: #(#self )>!
+ ^^^^^^^^^^^
+
+ The source code conversion tool might silently produce an incorrect
+ output if you use the former syntax.
+
o The ABI for external usage has changed. libgst.a does not know anymore
how to parse options, but exports functions to achieve the same effect
as options.
-o The tool for automatic documentation generator, that has been used by
- the GNU Smalltalk distribution for a long time, is now installed as
gst-doc.
-
Packages improvements:
@@ -124,6 +140,15 @@ o Since they are not portable outside
package, only #uzip is available and it will only support extracting from
ZIP files.
+o When declaring a C function, the #returning: argument now supports
+ specifying CPtr and CArray types, the same way it is done in CStruct
+ and CUnion declarations. For example, since you can specify an "int *"
+ as "#{CInt}", an "int **" (pointer to pointer to Integer, i.e. pointer
+ to CInt) would be written "#(#ptr #{CInt})".
+
+ Conversion from Array to CType is generally available using the
+ CType class>>#from: method.
+
-----------------------------------------------------------------------------
NEWS FROM 2.3.5 TO 2.3.6
--- orig/packages/gdbm/gdbm-c.st
+++ mod/packages/gdbm/gdbm-c.st
@@ -88,7 +88,7 @@ open: fileName blockSize: size flags: fl
mode: modeInt fatalFunc: funcAddr
"GDBM_FILE gdbm_open(name, block_size, flags, mode, fatal_func);"
- <cCall: 'gdbm_open' returning: GDBM type
+ <cCall: 'gdbm_open' returning: #{GDBM}
args: #(#string #int #int #int #cObject)>! !
!GDBM methodsFor: 'C call-outs'!
@@ -105,7 +105,7 @@ at: key put: value flag: aFlag
at: key
"datum gdbm_fetch(dbf, key);"
- <cCall: 'gdbm_fetch' returning: DatumStruct type args: #(#self #cObject)>
+ <cCall: 'gdbm_fetch' returning: #{DatumStruct} args: #(#self #cObject)>
!
removeKey: key
@@ -115,12 +115,12 @@ removeKey: key
firstKey
"datum gdbm_firstkey(dbf);"
- <cCall: 'gdbm_firstkey' returning: DatumStruct type args: #(#self)>
+ <cCall: 'gdbm_firstkey' returning: #{DatumStruct} args: #(#self)>
!
nextKey: afterDatum
"datum gdbm_nextkey(dbf, key);"
- <cCall: 'gdbm_nextkey' returning: DatumStruct type args: #(#self #cObject)>
+ <cCall: 'gdbm_nextkey' returning: #{DatumStruct} args: #(#self #cObject)>
!
reorganize
--- orig/packages/gtk/MoreFuncs.st
+++ mod/packages/gtk/MoreFuncs.st
@@ -79,11 +79,11 @@ propertiesAt: name put: anObject
!GtkWidget methodsFor: 'C call-outs'!
getAllocation
- <cCall: 'gstGtkWidgetGetAllocation' returning: GtkAllocation type
+ <cCall: 'gstGtkWidgetGetAllocation' returning: #{GtkAllocation}
args: #(#self )>!
getWindow
- <cCall: 'gstGtkGetWindow' returning: GdkWindow type args: #(#self )>!
+ <cCall: 'gstGtkGetWindow' returning: #{GdkWindow} args: #(#self )>!
getState
<cCall: 'gstGtkGetState' returning: #int args: #(#self )>!
@@ -133,10 +133,10 @@ setOop: iter column: aColumn value: aVal
!GtkDialog methodsFor: 'C call-outs'!
getVBox
- <cCall: 'gstGtkDialogGetVBox' returning: GtkWidget type args: #(#self )>!
+ <cCall: 'gstGtkDialogGetVBox' returning: #{GtkWidget} args: #(#self )>!
getActionArea
- <cCall: 'gstGtkDialogGetActionArea' returning: GtkWidget type
+ <cCall: 'gstGtkDialogGetActionArea' returning: #{GtkWidget}
args: #(#self )>! !
!GtkScrolledWindow methodsFor: 'C call-outs'!
--- orig/packages/gtk/funcs.awk
+++ mod/packages/gtk/funcs.awk
@@ -358,7 +358,7 @@ function returned( var )
else {
res = ptr_type[res]
if (res == "")
- res = var " type"
+ res = "#{" var "}"
}
return res
--- orig/packages/ncurses/ncurses.st
+++ mod/packages/ncurses/ncurses.st
@@ -484,14 +484,14 @@ derwin: anInt1 forColumns: anInt2 atY: a
call."
"WINDOW *derwin (WINDOW *, int, int, int, int);"
- <cCall: 'derwin' returning: NCWindow type
+ <cCall: 'derwin' returning: #{NCWindow}
args: #(#self #int #int #int #int )>!
dupwin
"I return a duplicate of my window. See the man(3) dupwin entry
for a description of my c function call."
"WINDOW *dupwin (WINDOW *);"
- <cCall: 'dupwin' returning: NCWindow type
+ <cCall: 'dupwin' returning: #{NCWindow}
args: #(#self )>!
getbkgd
@@ -926,7 +926,7 @@ subpad: anInt1 ncols: anInt2 beginY: anI
c function call."
"WINDOW *subpad (WINDOW *, int, int, int, int);"
- <cCall: 'subpad' returning: NCWindow type
+ <cCall: 'subpad' returning: #{NCWindow}
args: #(#self #int #int #int #int )>!
subwin: anInt1 ncols: anInt2 beginY: anInt3 beginX: anInt4
@@ -935,7 +935,7 @@ subwin: anInt1 ncols: anInt2 beginY: anI
function call."
"WINDOW *subwin (WINDOW *, int, int, int, int);"
- <cCall: 'subwin' returning: NCWindow type
+ <cCall: 'subwin' returning: #{NCWindow}
args: #(#self #int #int #int #int )>!
syncok: aBoolean
@@ -2388,7 +2388,7 @@ newpad: anInt1 ncols: anInt2
man(3) newpad entry for a description of my c function call."
"WINDOW *newpad (int, int);"
- <cCall: 'newpad' returning: NCWindow type
+ <cCall: 'newpad' returning: #{NCWindow}
args: #(#int #int )>!
newwin: anInt1 cols: anInt2 beginY: anInt3 beginX: anInt4
@@ -2398,7 +2398,7 @@ newwin: anInt1 cols: anInt2 beginY: anIn
description of my c function call."
"WINDOW *newwin (int, int, int, int);"
- <cCall: 'newwin' returning: NCWindow type
+ <cCall: 'newwin' returning: #{NCWindow}
args: #(#int #int #int #int )>!
nl
@@ -2473,7 +2473,7 @@ pairNumber: anInt
primInitScr
"WINDOW *initscr (void);"
- <cCall: 'initscr' returning: NCWindow type
+ <cCall: 'initscr' returning: #{NCWindow}
args: #( )>!
printw: aString
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Help-smalltalk] [PATCH] Use "returning: #{...}",
Paolo Bonzini <=