X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2FMKlib_gen.sh;h=66ae295c607cbbed974cc2d4cdff8f357ff460cc;hp=decf3c6a5ffc6ad75d38c79e5f1e317cc68e8690;hb=70322aa06a4a97ebff76d2869ad923cdf51ee0a9;hpb=f79b52fddd95c7a6f1ead29ef9c39eb8cdf60795 diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh index decf3c6a..66ae295c 100755 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh @@ -2,10 +2,10 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# ($Id: MKlib_gen.sh,v 1.41 2010/12/19 00:39:24 tom Exp $) +# ($Id: MKlib_gen.sh,v 1.43 2011/01/22 19:47:29 tom Exp $) # ############################################################################## -# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. # +# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -200,6 +200,7 @@ $0 !~ /^P_/ { } } second = first + 1; + returnCast = ""; if ( $first == "chtype" ) { returnType = "Chtype"; } else if ( $first == "SCREEN" ) { @@ -207,7 +208,8 @@ $0 !~ /^P_/ { } else if ( $first == "WINDOW" ) { returnType = "Win"; } else if ( $first == "attr_t" || $second == "attrset" || $second == "standout" || $second == "standend" || $second == "wattrset" || $second == "wstandout" || $second == "wstandend" ) { - returnType = "Attr"; + returnType = "IntAttr"; + returnCast = "(attr_t)"; } else if ( $first == "bool" || $first == "NCURSES_BOOL" ) { returnType = "Bool"; } else if ( $second == "*" ) { @@ -283,6 +285,7 @@ $0 !~ /^P_/ { } if ( ch == "," || ch == ")" ) { + argcast = ""; if (va_list) { call = call "%s" } else if (varargs) { @@ -303,6 +306,9 @@ $0 !~ /^P_/ { } else if ( argtype != "" ) { call = call "%s" comma = comma "_trace" argtype "2(" num "," + if (argtype == "attr") { + argcast = "(chtype)"; + } } else { call = call "%#lx" comma = comma "(long)" @@ -316,7 +322,7 @@ $0 !~ /^P_/ { } else if ( varargs ) { args = args comma "\"...\"" } else { - args = args comma "z" + args = args comma argcast "z" } } call = call ch @@ -338,12 +344,16 @@ $0 !~ /^P_/ { if (dotrace) printf "%s", call - if (match($0, "^void")) + if (match($0, "^void")) { call = "" - else if (dotrace) + } else if (dotrace) { call = sprintf("return%s( ", returnType); - else + if (returnCast != "") { + call = call returnCast; + } + } else { call = "@@return "; + } call = call $myfunc "("; for (i = 1; i < argcount; i++) { @@ -358,8 +368,9 @@ $0 !~ /^P_/ { } if (!match($0, "^void")) call = call ") "; - if (dotrace) + if (dotrace) { call = call ")"; + } print call ";" if (match($0, "^void"))