@ -40,6 +40,39 @@ function dump_class_templates(name)
}
}
functiondump_fileheader()
{
# Break the Id tag, so SVN doesn't replace it
print"/* $I""d$ */"
print""
print"/*"
print" * This file is part of OpenTTD."
print" * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2."
print" * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
print" * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>."
print" */"
print""
print"/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */"
print""
print"#include \"../../script/api/"filename"\""
}
functionreset_reader()
{
enum_size=0
enum_value_size=0
enum_string_to_error_size=0
enum_error_to_string_size=0
struct_size=0
method_size=0
static_method_size=0
virtual_class="false"
cls=""
start_squirrel_define_on_next_line="false"
cls_level=0
cls_in_api=""
}
BEGIN{
enum_size=0
enum_value_size=0
@ -52,26 +85,35 @@ BEGIN {
virtual_class="false"
super_cls=""
cls=""
api_selected=""
cls_in_api=""
start_squirrel_define_on_next_line="false"
has_fileheader="false"
cls_level=0
RS="\r|\n"
}
/@file/{
# Break it, so SVN doesn't replace it
print"/* $I""d$ */"
print""
print"/*"
print" * This file is part of OpenTTD."
print" * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2."
print" * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
print" * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>."
print" */"
print""
print"/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */"
print""
gsub("^"tolower(api)"_","script_",$3)
print"#include \"../../script/api/"$3"\""
filename=$3
gsub("^"tolower(api)"_","script_",filename)
}
/^([ ]*)\* @api/{
# By default, classes are not selected
if(cls_level==0)api_selected="false"
gsub("^([ ]*)","",$0)
gsub("* @api ","",$0)
if($0=="none"){
api_selected="false"
}elseif($0=="-all"){
api_selected="false"
}elseif(match($0,"-"tolower(api))){
api_selected="false"
}elseif(match($0,tolower(api))){
api_selected="true"
}
}
# Remove the old squirrel stuff
@ -84,10 +126,16 @@ BEGIN {
# We only want to have public functions exported for now
/^( *)class/{
if(cls_level==0){
if(api_selected==""){
print"Class '"$2"' has no @api. It won't be published to any API.">"/dev/stderr"