Browse Source

DYNAMIC ESDL - add dynamic esdl support to HPCC
add roxie test page
Add configmanager support (more changes needed)
update esxdl2xsd.xslt to generate schema with appropritate URN
fix unencoded & issue in EspBinding::getNavigationData

-Refactor existing esdl tool to esdl2xml

Removes idle esp/esdl code.
Refactors esdl2xml to esdl-gen-xml
Dynamically install esdl-gen-xml tool in EE package builds only

Removes stowaway tabs and superfluous white spaces.

Signed-off-by: Rodrigo Pastrana <Rodrigo.Pastrana@lexisnexis.com>

Drop "gen-" from commands, and rename esdl-gen-xml to esdl-xml

Rodrigo Pastrana 12 years ago
parent
commit
31a93741f3

+ 0 - 15
esp/esdl/CMakeLists.txt

@@ -1,15 +0,0 @@
-################################################################################
-#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License");
-#    you may not use this file except in compliance with the License.
-#    You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-################################################################################

+ 0 - 516
esp/esdl/esdl2ecl.cpp

@@ -1,516 +0,0 @@
-/*##############################################################################
-
-    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-############################################################################## */
-
-// esdl2ecl.cpp : Defines the entry point for the console application.
-//
-#include <vld.h>
-
-#include "jliball.hpp"
-#include "xslprocessor.hpp"
-
-typedef IPropertyTree * IPTreePtr;
-
-
-class TypeEntry : public CInterface
-{
-public:
-    IMPLEMENT_IINTERFACE;
-
-    StringAttr name;
-    StringAttr src;
-    IPTreePtr ptree;
-
-    TypeEntry(const char *name_, const char *src_, IPropertyTree *ptree_) : 
-        name(name_), src(src_), ptree(ptree_) 
-    {
-    }
-
-};
-
-typedef TypeEntry * TypeEntryPtr;
-
-MAKESTRINGMAPPING(IPTreePtr, IPTreePtr, AddedList);
-MAKESTRINGMAPPING(TypeEntryPtr, TypeEntryPtr, TypeIndex);
-
-
-class EsdlIndexedPropertyTrees
-{
-public:
-    CIArrayOf<TypeEntry> types;
-    
-    AddedList included;
-    TypeIndex index;
-
-    Owned<IPropertyTree> all;
-    
-    EsdlIndexedPropertyTrees()
-    {
-        all.setown(createPTree("ESDL_files"));
-    }
-
-    ~EsdlIndexedPropertyTrees()
-    {
-        all.clear();
-    }
-
-    StringBuffer &getQualifiedTypeName(const char *localsrc, const char *type, StringBuffer &qname)
-    {
-        if (type && *type)
-        {
-            TypeEntry **typeEntry = index.getValue(type);
-            if (typeEntry && *typeEntry)
-            {
-                const char *src = (*typeEntry)->src.get();
-                if (stricmp(src, localsrc))
-                {
-                    const char *finger = src;
-                    if (!strnicmp(finger, "wsm_", 4))
-                    {
-                        finger+=4;
-                    }
-                    qname.appendf("%s.", finger);
-                }
-                qname.appendf("t_%s", type);
-            }
-        }
-        return qname;
-    }
-
-    void loadFile(const char *srcpath, const char *srcfile, IProperties *versions=NULL)
-    {
-        if (!srcfile || !*srcfile)
-            throw MakeStringException(-1, "EsdlInclude no file name");
-        if (!included.getValue(srcfile))
-        {
-            DBGLOG("ESDL Loading include: %s", srcfile);
-
-            StringBuffer FileName;
-            if (srcpath && *srcpath)
-            {
-                FileName.append(srcpath);
-                if (FileName.length() && !strchr("/\\", FileName.charAt(FileName.length()-1)))
-                    FileName.append('/');
-            }
-            FileName.append(srcfile).append(".xml");
-
-            IPropertyTree *src = createPTreeFromXMLFile(FileName.str());
-            if (!src)
-            {
-                StringBuffer msg("EsdlInclude file not found - ");
-                msg.append(FileName);
-                throw MakeStringException(-1, msg.str());
-            }
-
-            included.setValue(srcfile, src);
-            all->addPropTree("esxdl", src);
-
-            StringArray add_includes;
-
-            Owned<IPropertyTreeIterator> iter = src->getElements("*");
-            ForEach (*iter)
-            {
-                IPropertyTree &e = iter->query();
-                const char *tag = e.queryName();
-                if (!stricmp(tag, "EsdlInclude"))
-                    add_includes.append(e.queryProp("@file"));
-                else if (!stricmp(tag, "EsdlVersion"))
-                {
-                    if (versions)
-                        versions->setProp(e.queryProp("@name"), e.queryProp("@version"));
-                }
-                else
-                {
-                    e.setProp("@src", srcfile);
-                    const char *name = e.queryProp("@name");
-                    if (name && *name)
-                    {
-                        TypeEntry *te =  new TypeEntry(name, srcfile, &e);
-                        types.append(*dynamic_cast<CInterface*>(te));                       
-                        index.setValue(name, te);
-                    }
-                }
-            }
-
-            ForEachItemIn(idx, add_includes)
-            {
-                const char *file=add_includes.item(idx);
-                loadFile(srcpath, file, versions);
-            }
-        }
-    }
-};
-
-
-
-void xsltTransform(const char* xml, const char* sheet, IProperties *params, const char *filename)
-{
-    StringBuffer xsl;
-    xsl.loadFile(sheet);
-
-    Owned<IXslProcessor> proc  = getXslProcessor();
-    Owned<IXslTransform> trans = proc->createXslTransform();
-
-    trans->setXmlSource(xml, strlen(xml));
-    trans->setXslSource(xsl, xsl.length());
-
-    if (params)
-    {
-        Owned<IPropertyIterator> it = params->getIterator();
-        for (it->first(); it->isValid(); it->next())
-        {
-            const char *key = it->getPropKey();
-            //set parameter in the XSL transform skipping over the @ prefix, if any
-            const char* paramName = *key == '@' ? key+1 : key;
-            trans->setParameter(paramName, StringBuffer().append('\'').append(params->queryProp(key)).append('\'').str());
-        }
-    }
-
-    trans->setResultTarget(filename);
-    trans->transform();
-}
-
-
-bool isEclKeyword(const char *name)
-{
-    //complete list from hash table later
-    return (!stricmp(name, "shared") || 
-            !stricmp(name, "function") || 
-            !stricmp(name, "record") || 
-            !stricmp(name, "header") || 
-            !stricmp(name, "service") ||
-            !stricmp(name, "type") ||
-            !stricmp(name, "penalty") ||
-            !stricmp(name, "isvalid"));
-}
-
-void updateEclName(IPropertyTree &item)
-{
-    const char *name = item.queryProp("@name");
-    if (name && *name)
-    {
-        if (!item.hasProp("@ecl_name") && isEclKeyword(name))
-        {
-            StringBuffer ecl_name("_");
-            ecl_name.append(name);
-            item.addProp("@ecl_name", ecl_name.str());
-        }
-    }
-}
-
-void updateEclType(const char *curfile, const char *type_attr, IPropertyTree &item, EsdlIndexedPropertyTrees &trees, const char *ecl_type_attr="@ecl_type")
-{
-    if (!item.hasProp("@ecl_type"))
-    {
-        const char *type = item.queryProp(type_attr);
-        StringBuffer ecltype;
-        trees.getQualifiedTypeName(curfile, type, ecltype);
-        if (ecltype.length())
-            item.setProp(ecl_type_attr, ecltype.str());
-    }
-}
-
-
-void expandEsxdlStructure(EsdlIndexedPropertyTrees &trees, IPropertyTree &item, const char *file)
-{
-    //updateEclName(item);
-    updateEclType(file, "@base_type", item, trees, "@ecl_base_type");
-    
-    Owned<IPropertyTreeIterator> children = item.getElements("*");
-    ForEach(*children)
-    {
-        IPropertyTree &child = children->query();
-        updateEclName(child);
-        if (!stricmp(child.queryName(), "EsdlElement"))
-            updateEclType(file, "@complex_type", child, trees);
-        else if (!stricmp(child.queryName(), "EsdlArray"))
-        {
-            if (!child.hasProp("@max_count") && !child.hasProp("@max_count_var"))
-                child.addPropInt("@max_count", 1);
-            updateEclType(file, "@type", child, trees);
-        }
-        else if (!stricmp(child.queryName(), "EsdlEnum"))
-        {
-            const char *enum_type = child.queryProp("@enum_type");
-            if (enum_type && *enum_type)
-            {
-                TypeEntry **typeEntry = trees.index.getValue(enum_type);
-                if (typeEntry && *typeEntry)
-                {
-                    StringBuffer ecl_type("string");
-                    if ((*typeEntry)->ptree->hasProp("@max_len"))
-                        ecl_type.append((*typeEntry)->ptree->queryProp("@max_len"));
-                    child.addProp("@ecl_type", ecl_type.str());
-                    StringBuffer comment;
-                    Owned<IPropertyTreeIterator> items = (*typeEntry)->ptree->getElements("EsdlEnumItem");
-                    bool emptydefined=false;
-                    ForEach(*items)
-                    {
-                        if (!comment.length())
-                            comment.append("//values[");
-                        else
-                            comment.append(',');
-                        const char *enum_val=items->query().queryProp("@enum");
-                        comment.appendf("'%s'", enum_val);
-                        if (!*enum_val)
-                            emptydefined=true;
-                    }
-                    if (!emptydefined)
-                        comment.append(",''");
-                    comment.append("]");
-                    child.addProp("@ecl_comment", comment.str());
-                }
-            }
-        }
-    }
-}
-
-void addFlatTagList(EsdlIndexedPropertyTrees &trees, IPropertyTree &dst, IPropertyTree &cur, StringBuffer &path)
-{
-    const char *base_type=cur.queryProp("@base_type");
-    if (base_type && *base_type)
-    {
-        TypeEntry **base_entry = trees.index.getValue(base_type);
-        if (base_entry && *base_entry)
-        {
-            unsigned len = path.length();
-            path.append('(').append(base_type).append(')');;
-            addFlatTagList(trees, dst, *((*base_entry)->ptree), path);
-            path.setLength(len);
-        }
-    }
-
-    Owned<IPropertyTreeIterator> elems = cur.getElements("EsdlElement");
-    ForEach(*elems)
-    {
-        IPropertyTree &item = elems->query();
-        const char *complex_type = item.queryProp("@complex_type");
-        if (complex_type)
-        {
-            TypeEntry **elem_entry = trees.index.getValue(complex_type);
-            if (elem_entry && *elem_entry)
-            {
-                unsigned len = path.length();
-                path.append('/').append(item.queryProp("@name"));
-                addFlatTagList(trees, dst, *((*elem_entry)->ptree), path);
-                path.setLength(len);
-            }
-        }
-        else
-        {
-            const char *flat_tag = item.queryProp("@flat_tag");
-            if (flat_tag && *flat_tag=='.')
-                flat_tag=item.queryProp("@name");
-            StringBuffer xml;
-            if (flat_tag && *flat_tag)
-            {
-                xml.appendf("<InputTag flat_name=\"%s\" path=\"%s/%s\" type=\"%s\"/>", flat_tag, path.str(), item.queryProp("@name"), item.queryProp("@type"));
-                dst.addPropTree("InputTag", createPTreeFromXMLString(xml.str()));
-            }
-            else
-            {
-                xml.appendf("<NoInputTag path=\"%s/%s\" type=\"%s\"/>", path.str(), item.queryProp("@name"), item.queryProp("@type"));
-                dst.addPropTree("NoInputTag", createPTreeFromXMLString(xml.str()));
-            }
-
-        }
-    }
-}
-
-
-void expandEsxdlRequest(EsdlIndexedPropertyTrees &trees, IPropertyTree &item, const char *file)
-{
-    expandEsxdlStructure(trees, item, file);
-    StringBuffer path;
-    addFlatTagList(trees, item, item, path);
-}
-
-void expandEsxdlForEclGeneration(EsdlIndexedPropertyTrees &trees, const char *file)
-{
-    IPropertyTree **content = trees.included.getValue(file);
-    if (content && *content)
-    {
-        DBGLOG("Expanding the ESDL XML content for %s", file);
-        Owned<IPropertyTreeIterator> structs = (*content)->getElements("*");
-        ForEach(*structs)
-        {
-            IPropertyTree &item = structs->query();
-            const char *esdltag = item.queryName();
-            if (!strnicmp(esdltag, "Esdl", 4))
-            {
-                if (!stricmp(esdltag+4, "Request"))
-                    expandEsxdlRequest(trees, item, file);
-                else if (!stricmp(esdltag+4, "Struct") || !stricmp(esdltag+4, "Response"))
-                    expandEsxdlStructure(trees, item, file);
-            }
-        }
-    }
-}
-
-void outputEcl(EsdlIndexedPropertyTrees &trees, const char *file, const char *path, bool savexml)
-{
-    IPropertyTree **content = trees.included.getValue(file);
-    if (content && *content)
-    {
-        DBGLOG("Generating ECL file for %s", file);
-        
-        const char *finger = file;
-        if (!strnicmp(finger, "wsm_", 4))
-            finger+=4;
-
-        if (savexml)
-        {
-            StringBuffer xmlfile;
-            if (path && *path)
-            {
-                xmlfile.append(path);
-                if (xmlfile.length() && !strchr("/\\", xmlfile.charAt(xmlfile.length()-1)))
-                    xmlfile.append('/');
-            }
-            xmlfile.append(finger).append("_expanded.xml");
-            saveXML(xmlfile.str(), *content);
-        }
-        
-        StringBuffer outfile;
-        if (path && *path)
-        {
-            outfile.append(path);
-            if (outfile.length() && !strchr("/\\", outfile.charAt(outfile.length()-1)))
-                outfile.append('/');
-        }
-        outfile.append(finger).append(".attr");
-
-        StringBuffer expstr;
-        toXML(*content, expstr);
-        Owned<IProperties> params = createProperties();
-        params->setProp("sourceFileName", file);
-        xsltTransform(expstr.str(), "xslt/esdl2ecl.xslt", params, outfile.str());
-    }
-}
-
-
-void usage()
-{
-    puts("Usage:");
-    printf(" esdl2ecl srcfile [options]\n");
-    puts("Options:");
-    puts("  -?/-h: display this usage");
-    puts("  -x: output expanded xml files");
-    puts("  -p=dir: path to output ecl files");
-    puts("  -all: generate ECL files for all includes");
-    
-    exit(1);
-}
-
-class esdl2ecl_options
-{
-public:
-    bool generateAllIncludes;
-    bool outputExpandedXML;
-
-    StringBuffer srcFile;
-    StringBuffer outputPath;
-
-    esdl2ecl_options() : generateAllIncludes(false), outputExpandedXML(false) {}
-};
-
-void parseCommandLineOptions(esdl2ecl_options &options, int argc, char** argv)
-{
-    if (argc<2)
-        usage();
-
-    options.srcFile.append(argv[1]);
-    
-    int i;
-    for (i=2;i<argc;i++)
-    {
-        if (*(argv[i]) == '-')
-        {
-            if (!strcmp(argv[i], "-?") || !strcmp(argv[i], "-h"))
-                usage();
-            else if (!strcmp(argv[i],"-all"))
-                options.generateAllIncludes = true;
-            else if (!strcmp(argv[i],"-x"))
-                options.outputExpandedXML = true;
-            else if (!strncmp(argv[i],"-p=",3))
-                options.outputPath.append(argv[i]+3);
-            // unknown
-            else {
-                fprintf(stderr, "Unknown options: %s\n", argv[i]);
-                exit(1);
-            }               
-        }
-    }
-}
-
-
-
-int main(int argc, char* argv[])
-{
-    InitModuleObjects();
-
-    esdl2ecl_options opts;
-    parseCommandLineOptions(opts, argc, argv);
-
-    if (opts.outputPath.length())
-        recursiveCreateDirectory(opts.outputPath.str());
-
-    StringBuffer srcPath;
-    StringBuffer srcName;
-    StringBuffer srcExt;
-
-    splitFilename(opts.srcFile.str(), NULL, &srcPath, &srcName, &srcExt);
-
-    try
-    {
-        unsigned start = msTick();
-        EsdlIndexedPropertyTrees trees;
-        trees.loadFile(srcPath.str(), srcName.str());
-        DBGLOG("Time taken to load ESDL files %u", msTick() - start);
-
-        if (opts.generateAllIncludes)
-        {
-            Owned<IPropertyTreeIterator> files = trees.all->getElements("esxdl");
-            ForEach(*files)
-            {
-                IPropertyTree &incl = files->query();
-                const char *src = incl.queryProp("@name");
-                expandEsxdlForEclGeneration(trees, src);
-                outputEcl(trees, src, opts.outputPath.str(), opts.outputExpandedXML);
-            }
-        }
-        else
-        {
-            expandEsxdlForEclGeneration(trees, srcName.str());
-            outputEcl(trees, srcName.str(), opts.outputPath.str(), opts.outputExpandedXML);
-        }
-    }
-    catch(IException* e) 
-    {
-        StringBuffer msg;
-        DBGLOG("Exception: %s", e->errorMessage(msg).str());
-        e->Release();
-    }
-    catch(...)
-    {
-        DBGLOG("Unknown exception caught");
-    }
-
-    ExitModuleObjects();
-    releaseAtoms();
-    return 0;
-}
-

File diff suppressed because it is too large
+ 0 - 1488
esp/esdl/esdl_transformer.cpp


+ 0 - 47
esp/esdl/esdl_transformer.hpp

@@ -1,47 +0,0 @@
-/*##############################################################################
-
-    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-############################################################################## */
-
-#include "jliball.hpp"
-#include "esp.hpp"
-#include "soapesp.hpp"
-#include "ws_ecl_client.hpp"
-
-typedef  enum EsdlProcessMode_
-{
-    EsdlRequestMode,
-    EsdlResponseMode
-} EsdlProcessMode;
-
-interface IEsdlMethodInfo : extends IInterface
-{
-    virtual const char *queryMethodName()=0;
-    virtual const char *queryRequestType()=0;
-    virtual const char *queryResponseType()=0;
-};
-
-interface IEsdlTransformer : extends IInterface
-{
-    virtual IEsdlMethodInfo *queryMethodInfo(const char *method)=0;
-
-    virtual int process(IEspContext &ctx, EsdlProcessMode mode, const char *method, StringBuffer &xmlout, const char *xmlin)=0;
-    virtual int process(IEspContext &ctx, EsdlProcessMode mode, const char *method, IClientWsEclRequest &clReq, IEspStruct& r)=0;
-};
-
-IEsdlTransformer *createEsdlXFormerFromXMLString(const char *xml);
-IEsdlTransformer *createEsdlXFormerFromXMLFile(const char *filename, StringArray &types);
-
-IEsdlTransformer *createEsdlXFormerFromXMLFiles(StringArray &files, StringArray &types);

+ 3 - 3
esp/scm/additional.cmake

@@ -23,7 +23,7 @@
 set ( ESPSCM_SOURCE_DIR ${HPCC_SOURCE_DIR}/esp/scm )
 set ( ESPSCM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated )
 GET_TARGET_PROPERTY(HIDL_EXE hidl LOCATION)
-GET_TARGET_PROPERTY(ESDL_EXE esdl LOCATION)
+GET_TARGET_PROPERTY(ESDL-XML_EXE esdl-xml LOCATION)
 
 set ( ESPSCM_SRCS
       ws_config.ecm
@@ -40,9 +40,9 @@ foreach ( loop_var ${ESPSCM_SRCS} )
                            OUTPUT ${ESPSCM_GENERATED_DIR}/${result}.esp ${ESPSCM_GENERATED_DIR}/${result}.hpp ${ESPSCM_GENERATED_DIR}/${result}.int ${ESPSCM_GENERATED_DIR}/${result}.ipp ${ESPSCM_GENERATED_DIR}/${result}_esp.cpp ${ESPSCM_GENERATED_DIR}/${result}_esp.ipp
                            COMMAND ${HIDL_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
                          )
-      add_custom_command ( DEPENDS esdl ${ESPSCM_SOURCE_DIR}/${loop_var}
+      add_custom_command ( DEPENDS esdl-xml ${ESPSCM_SOURCE_DIR}/${loop_var}
                            OUTPUT ${ESPSCM_GENERATED_DIR}/${result}.xml
-                           COMMAND ${ESDL_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
+                           COMMAND ${ESDL-XML_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
                          )
     endif ()
     set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}.esp PROPERTIES GENERATED TRUE)

+ 3 - 3
esp/scm/espscm.cmake

@@ -23,7 +23,7 @@
 set ( ESPSCM_SOURCE_DIR ${HPCC_SOURCE_DIR}/esp/scm )
 set ( ESPSCM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated )
 GET_TARGET_PROPERTY(HIDL_EXE hidl LOCATION)
-GET_TARGET_PROPERTY(ESDL_EXE esdl LOCATION)
+GET_TARGET_PROPERTY(ESDL-XML_EXE esdl-xml LOCATION)
 
 set ( ESPSCM_SRCS
       common.ecm
@@ -51,9 +51,9 @@ foreach ( loop_var ${ESPSCM_SRCS} )
                            OUTPUT ${ESPSCM_GENERATED_DIR}/${result}.esp ${ESPSCM_GENERATED_DIR}/${result}.hpp ${ESPSCM_GENERATED_DIR}/${result}.int ${ESPSCM_GENERATED_DIR}/${result}.ipp ${ESPSCM_GENERATED_DIR}/${result}_esp.cpp ${ESPSCM_GENERATED_DIR}/${result}_esp.ipp
                            COMMAND ${HIDL_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
                          )
-      add_custom_command ( DEPENDS esdl ${ESPSCM_SOURCE_DIR}/${loop_var}
+      add_custom_command ( DEPENDS esdl-xml ${ESPSCM_SOURCE_DIR}/${loop_var}
                            OUTPUT ${ESPSCM_GENERATED_DIR}/${result}.xml
-                           COMMAND ${ESDL_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
+                           COMMAND ${ESDL-XML_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
                          )
     endif ()
     set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}.esp PROPERTIES GENERATED TRUE)

+ 3 - 3
esp/scm/ncmscm.cmake

@@ -23,7 +23,7 @@
 set ( ESPSCM_SOURCE_DIR ${HPCC_SOURCE_DIR}/esp/scm )
 set ( ESPSCM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated )
 GET_TARGET_PROPERTY(HIDL_EXE hidl LOCATION)
-GET_TARGET_PROPERTY(ESDL_EXE esdl LOCATION)
+GET_TARGET_PROPERTY(ESDL-XML_EXE esdl-xml LOCATION)
 
 set ( ECMCSM_SRCS 
       ws_riskwise.ncm
@@ -39,9 +39,9 @@ foreach ( loop_var ${ESPSCM_SRCS} )
                          OUTPUT ${ESPSCM_GENERATED_DIR}/${result}.esp ${ESPSCM_GENERATED_DIR}/${result}.hpp ${ESPSCM_GENERATED_DIR}/${result}.int ${ESPSCM_GENERATED_DIR}/${result}.ipp ${ESPSCM_GENERATED_DIR}/${result}_esp.cpp ${ESPSCM_GENERATED_DIR}/${result}_esp.ipp ${ESPSCM_GENERATED_DIR}/${result}_esp_ng.cpp ${ESPSCM_GENERATED_DIR}/${result}_esp_ng.ipp
                          COMMAND ${HIDL_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ncm ${ESPSCM_GENERATED_DIR}
                        )
-    add_custom_command ( DEPENDS esdl ${ESPSCM_SOURCE_DIR}/${loop_var}
+    add_custom_command ( DEPENDS esdl-xml ${ESPSCM_SOURCE_DIR}/${loop_var}
                          OUTPUT ${ESPSCM_GENERATED_DIR}/${result}.xml 
-                         COMMAND ${ESDL_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
+                         COMMAND ${ESDL-XML_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
                        )
     set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}.esp PROPERTIES ESPSCM_GENERATED_DIR TRUE)
     set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}.hpp PROPERTIES ESPSCM_GENERATED_DIR TRUE)

+ 3 - 3
esp/scm/smcscm.cmake

@@ -24,7 +24,7 @@
 set ( ESPSCM_SOURCE_DIR ${HPCC_SOURCE_DIR}/esp/scm )
 set ( ESPSCM_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated )
 GET_TARGET_PROPERTY(HIDL_EXE hidl LOCATION)
-GET_TARGET_PROPERTY(ESDL_EXE esdl LOCATION)
+GET_TARGET_PROPERTY(ESDL-XML_EXE esdl-xml LOCATION)
 
 set ( ESPSCM_SRCS
       common.ecm
@@ -45,9 +45,9 @@ foreach ( loop_var ${ESPSCM_SRCS} )
                            OUTPUT ${ESPSCM_GENERATED_DIR}/${result}.esp ${ESPSCM_GENERATED_DIR}/${result}.hpp ${ESPSCM_GENERATED_DIR}/${result}.int ${ESPSCM_GENERATED_DIR}/${result}.ipp ${ESPSCM_GENERATED_DIR}/${result}_esp.cpp ${ESPSCM_GENERATED_DIR}/${result}_esp.ipp
                            COMMAND ${HIDL_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
                          )
-      add_custom_command ( DEPENDS esdl ${ESPSCM_SOURCE_DIR}/${loop_var}
+      add_custom_command ( DEPENDS esdl-xml ${ESPSCM_SOURCE_DIR}/${loop_var}
                            OUTPUT ${ESPSCM_GENERATED_DIR}/${result}.xml
-                           COMMAND ${ESDL_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
+                           COMMAND ${ESDL-XML_EXE} ${ESPSCM_SOURCE_DIR}/${result}.ecm ${ESPSCM_GENERATED_DIR}
                          )
     endif ()
     set_source_files_properties(${ESPSCM_GENERATED_DIR}/${result}.esp PROPERTIES GENERATED TRUE)

+ 0 - 1
esp/xslt/CMakeLists.txt

@@ -19,7 +19,6 @@ FOREACH( iFILES
     ${CMAKE_CURRENT_SOURCE_DIR}/appframe.xsl
     ${CMAKE_CURRENT_SOURCE_DIR}/dict_sort.xsl
     ${CMAKE_CURRENT_SOURCE_DIR}/env2jstree.xslt
-    ${CMAKE_CURRENT_SOURCE_DIR}/esdl2ecl.xslt
     ${CMAKE_CURRENT_SOURCE_DIR}/esdl_method.xslt
     ${CMAKE_CURRENT_SOURCE_DIR}/espheader.xsl
     ${CMAKE_CURRENT_SOURCE_DIR}/esxdl2req.xslt

+ 0 - 191
esp/xslt/esdl2ecl.xslt

@@ -1,191 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-##############################################################################
-#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License");
-#    you may not use this file except in compliance with the License.
-#    You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-##############################################################################
--->
-
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-    <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes" />
-    <xsl:param name="sourceFileName" select="'UNKNOWN'"/>
-    <xsl:variable name="docname" select="esxdl/@name"/>
-    <xsl:template match="/">
-        <xsl:apply-templates select="esxdl"/>
-    </xsl:template>
-    <xsl:template name="doNotChangeManuallyComment">
-        <xsl:text>/*** Not to be hand edited (changes will be lost on re-generation) ***/
-/*** ECL Interface generated by esdl2ecl version 1.0 from </xsl:text><xsl:copy-of select="$sourceFileName"/> <xsl:text>.xml. ***/
-/*===================================================*/
-
-</xsl:text>
-    </xsl:template>
-    <xsl:template match="esxdl">
-                 <xsl:call-template name="doNotChangeManuallyComment"/>
-            <xsl:text>export </xsl:text>
-            <xsl:choose>
-                <xsl:when test="starts-with(@name, 'wsm_')"><xsl:value-of select="substring(@name, 5)"/></xsl:when>
-                <xsl:otherwise><xsl:value-of select="@name"/></xsl:otherwise>
-            </xsl:choose>
-            <xsl:text> := MODULE
-            
-</xsl:text>
-        <xsl:if test="$docname='wsm_share'">
-        <xsl:text>export t_StringArrayItem := record, MAXLENGTH (1024)
-            string value { xpath('') };
-end;
-
-</xsl:text>
-        </xsl:if>
-        <xsl:apply-templates select="EsdlStruct"/>
-        <xsl:apply-templates select="EsdlRequest"/>
-        <xsl:apply-templates select="EsdlResponse"/>
-
-        <xsl:text>
-end;
-
-</xsl:text>
-          <xsl:call-template name="doNotChangeManuallyComment"/>
-    </xsl:template>
-
-    <xsl:template match="EsdlElement[@complex_type]">
-        <xsl:if test="not(@ecl_hide)">
-            <xsl:text>  </xsl:text><xsl:value-of select="@ecl_type"/><xsl:text> </xsl:text> <xsl:call-template name="output_ecl_name"/><xsl:text> {xpath('</xsl:text><xsl:value-of select="@name"/><xsl:text>')};</xsl:text>
-            <xsl:if test="@optional">
-                <xsl:text>//hidden[</xsl:text><xsl:value-of select="@optional"/><xsl:text>]</xsl:text>
-            </xsl:if>
-<xsl:text>
-</xsl:text>
-        </xsl:if>
-    </xsl:template>
-    <xsl:template match="EsdlElement[@type]">
-        <xsl:if test="not(@ecl_hide)">
-            <xsl:text>  </xsl:text><xsl:call-template name="output_basic_type"/><xsl:text> </xsl:text><xsl:call-template name="output_ecl_name"/><xsl:text> {xpath('</xsl:text><xsl:value-of select="@name"/><xsl:text>')};</xsl:text>
-            <xsl:if test="@optional">
-                <xsl:text>//hidden[</xsl:text><xsl:value-of select="@optional"/><xsl:text>]</xsl:text>
-            </xsl:if>
-<xsl:text>
-</xsl:text>
-        </xsl:if>
-    </xsl:template>
-    <xsl:template match="EsdlEnum">
-        <xsl:variable name="entype" select="@enum_type"/>
-        <xsl:text>  </xsl:text><xsl:value-of select="@ecl_type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/><xsl:text> {xpath('</xsl:text><xsl:value-of select="@name"/><xsl:text>')}; </xsl:text><xsl:value-of select="@ecl_comment"/>
-        <xsl:if test="@optional">
-            <xsl:text>//hidden[</xsl:text><xsl:value-of select="@optional"/><xsl:text>]</xsl:text>
-        </xsl:if>
-<xsl:text>
-</xsl:text>
-    </xsl:template>
-    <xsl:template match="EsdlArray[@type='string']">
-        <xsl:if test="not(@ecl_hide)">
-        <xsl:text>  dataset(</xsl:text><xsl:if test="$docname!='wsm_share'"><xsl:text>share.</xsl:text></xsl:if><xsl:text>t_StringArrayItem) </xsl:text><xsl:call-template name="output_ecl_name"/>
-        <xsl:text> {</xsl:text>
-        <xsl:text>xpath('</xsl:text><xsl:value-of select="@name"/><xsl:text>/</xsl:text><xsl:value-of select="@item_tag"/><xsl:text>')</xsl:text>
-        <xsl:choose>
-            <xsl:when test="@max_count_var"><xsl:text>, MAXCOUNT(</xsl:text><xsl:value-of select="@max_count_var"/><xsl:text>)</xsl:text></xsl:when>
-            <xsl:when test="@max_count"><xsl:text>, MAXCOUNT(</xsl:text><xsl:value-of select="@max_count"/><xsl:text>)</xsl:text></xsl:when>
-        </xsl:choose>
-        <xsl:text>};</xsl:text>
-        <xsl:if test="@optional">
-            <xsl:text>//hidden[</xsl:text><xsl:value-of select="@optional"/><xsl:text>]</xsl:text>
-        </xsl:if>
-        <xsl:text>
-</xsl:text>
-    </xsl:if>
-    </xsl:template>
-    <xsl:template match="EsdlArray">
-        <xsl:if test="not(@ecl_hide)">
-            <xsl:text>  dataset(</xsl:text> <xsl:value-of select="@ecl_type"/><xsl:text>) </xsl:text><xsl:call-template name="output_ecl_name"/>
-            <xsl:text> {</xsl:text>
-            <xsl:text>xpath('</xsl:text><xsl:value-of select="@name"/><xsl:text>/</xsl:text><xsl:value-of select="@item_tag"/><xsl:text>')</xsl:text>
-            <xsl:choose>
-                <xsl:when test="@max_count_var"><xsl:text>, MAXCOUNT(</xsl:text><xsl:value-of select="@max_count_var"/><xsl:text>)</xsl:text></xsl:when>
-                <xsl:when test="@max_count"><xsl:text>, MAXCOUNT(</xsl:text><xsl:value-of select="@max_count"/><xsl:text>)</xsl:text></xsl:when>
-            </xsl:choose>
-        <xsl:text>};</xsl:text>
-        <xsl:if test="@optional">
-            <xsl:text>//hidden[</xsl:text><xsl:value-of select="@optional"/><xsl:text>]</xsl:text>
-        </xsl:if>
-        <xsl:text>
-</xsl:text>
-        </xsl:if>
-    </xsl:template>
-
-    <xsl:template match="EsdlStruct">
-        <xsl:if test="not(@ecl_hide)">
-            <xsl:text>export t_</xsl:text><xsl:call-template name="output_ecl_name"/><xsl:text> := record</xsl:text>
-            <xsl:if test="@ecl_base_type"><xsl:text> (</xsl:text><xsl:value-of select="@ecl_base_type"/><xsl:text>)</xsl:text></xsl:if>
-            <xsl:if test="@max_len"><xsl:text>, MAXLENGTH (</xsl:text><xsl:value-of select="@max_len"/><xsl:text>)</xsl:text></xsl:if>
-            <xsl:text>
-</xsl:text>
-            <xsl:apply-templates select="*"/>
-            <xsl:text>end;
-        
-</xsl:text>
-        </xsl:if>
-    </xsl:template>
-
-    <xsl:template match="EsdlRequest">
-        <xsl:text>export t_</xsl:text><xsl:call-template name="output_ecl_name"/><xsl:text> := record</xsl:text>
-        <xsl:if test="@ecl_base_type"><xsl:text> (</xsl:text><xsl:value-of select="@ecl_base_type"/><xsl:text>)</xsl:text></xsl:if>
-        <xsl:if test="@max_len"><xsl:text>, MAXLENGTH (</xsl:text><xsl:value-of select="@max_len"/><xsl:text>)</xsl:text></xsl:if>
-        <xsl:text>
-</xsl:text>
-        <xsl:apply-templates select="*"/>
-        <xsl:text>end;
-        
-</xsl:text>
-    </xsl:template>
-
-    <xsl:template match="EsdlResponse">
-        <xsl:text>export t_</xsl:text><xsl:call-template name="output_ecl_name"/><xsl:text> := record</xsl:text>
-        <xsl:if test="@ecl_base_type"><xsl:text> (</xsl:text><xsl:value-of select="@ecl_base_type"/><xsl:text>)</xsl:text></xsl:if>
-        <xsl:if test="@max_len"><xsl:text>, MAXLENGTH (</xsl:text><xsl:value-of select="@max_len"/><xsl:text>)</xsl:text></xsl:if>
-        <xsl:text>
-</xsl:text>
-        <xsl:apply-templates select="*"/>
-        <xsl:text>end;
-        
-</xsl:text>
-    </xsl:template>
-
-
-<xsl:template name="output_ecl_name">
-<xsl:choose>
-    <xsl:when test="@ecl_name"><xsl:value-of select="@ecl_name"/></xsl:when>
-    <xsl:otherwise><xsl:value-of select="@name"/></xsl:otherwise>
-</xsl:choose>
-
-</xsl:template>
-
-<xsl:template name="output_basic_type">
-    <xsl:param name="basic_type" select="@type"/>
-    <xsl:param name="size" select="@max_len"/>
-    <xsl:choose>
-        <xsl:when test="@ecl_type"><xsl:value-of select="@ecl_type"/></xsl:when>
-        <xsl:when test="$basic_type='int'"><xsl:text>integer</xsl:text><xsl:value-of select="$size"/></xsl:when>
-        <xsl:when test="$basic_type='long'"><xsl:text>integer4</xsl:text><xsl:value-of select="$size"/></xsl:when>
-        <xsl:when test="$basic_type='short'"><xsl:text>integer2</xsl:text></xsl:when>
-        <xsl:when test="$basic_type='bool'"><xsl:text>boolean</xsl:text></xsl:when>
-        <xsl:when test="$basic_type='string'"><xsl:text>string</xsl:text><xsl:value-of select="$size"/></xsl:when>
-        <xsl:when test="$basic_type='double'"><xsl:text>real8</xsl:text></xsl:when>
-        <xsl:when test="$basic_type='float'"><xsl:text>real4</xsl:text></xsl:when>
-        <xsl:when test="$basic_type='base64Binary'"><xsl:text>string</xsl:text></xsl:when>
-        <xsl:otherwise><xsl:value-of select="$basic_type"/><xsl:value-of select="$size"/></xsl:otherwise>
-    </xsl:choose>
-</xsl:template>
-
-
-</xsl:stylesheet>

+ 1 - 1
tools/CMakeLists.txt

@@ -13,7 +13,7 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 ################################################################################
-HPCC_ADD_SUBDIRECTORY (esdl)
+HPCC_ADD_SUBDIRECTORY (esdlcmd-xml)
 HPCC_ADD_SUBDIRECTORY (hidl)
 HPCC_ADD_SUBDIRECTORY (backupnode "PLATFORM")
 HPCC_ADD_SUBDIRECTORY (addScopes "PLATFORM")

+ 0 - 26
tools/esdl/sourcedoc.xml

@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-################################################################################
-#    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License");
-#    you may not use this file except in compliance with the License.
-#    You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-################################################################################
--->
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
-<section>
-    <title>tools/esdl</title>
-
-    <para>
-        The tools/esdl directory contains the sources for the tools/esdl library.
-    </para>
-</section>

+ 22 - 14
tools/esdl/CMakeLists.txt

@@ -14,43 +14,51 @@
 #    limitations under the License.
 ################################################################################
 
-# Component: esdl 
+# Component: esdlcmd-xml
 
 #####################################################
 # Description:
 # ------------
-#    Cmake Input File for esdl
+#    Cmake Input File for esdlcmd-xml
 #####################################################
 
-
-project( esdl ) 
+project( esdl-xml )
 
 add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/esdlgram.cpp ${CMAKE_CURRENT_BINARY_DIR}/esdlgram.h
     COMMAND ${bisoncmdprefix} ${bisoncmd} --defines=${CMAKE_CURRENT_BINARY_DIR}/esdlgram.h --output=${CMAKE_CURRENT_BINARY_DIR}/esdlgram.cpp ${CMAKE_CURRENT_SOURCE_DIR}/esdlgram.y
     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/esdlgram.y
 )
 
-add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/esdllex.cpp 
+add_custom_command ( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/esdllex.cpp
     COMMAND ${flexcmdprefix} ${flexcmd} --outfile=${CMAKE_CURRENT_BINARY_DIR}/esdllex.cpp ${CMAKE_CURRENT_SOURCE_DIR}/esdllex.l
     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/esdllex.l
 )
 
-set ( SRCS 
-        ${CMAKE_CURRENT_BINARY_DIR}/esdlgram.cpp 
-        ${CMAKE_CURRENT_BINARY_DIR}/esdllex.cpp 
-        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 
+set ( SRCS
+        ${CMAKE_CURRENT_BINARY_DIR}/esdlgram.cpp
+        ${CMAKE_CURRENT_BINARY_DIR}/esdllex.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/esdlcomp.cpp
-        ${CMAKE_CURRENT_SOURCE_DIR}/esdl_utils.cpp 
+        ${CMAKE_CURRENT_SOURCE_DIR}/esdl_utils.cpp
     )
 
-include_directories ( 
+include_directories (
          ${CMAKE_CURRENT_BINARY_DIR}   # for generated .h file
-         ${HPCC_SOURCE_DIR}/system/include 
+         ${HPCC_SOURCE_DIR}/system/include
          ${CMAKE_CURRENT_SOURCE_DIR}
     )
 
 ADD_DEFINITIONS( -D_CONSOLE -O0 )
 
-HPCC_ADD_EXECUTABLE ( esdl ${SRCS} )
-#install ( TARGETS esdl RUNTIME DESTINATION ${EXEC_DIR} )
+HPCC_ADD_EXECUTABLE ( esdl-xml ${SRCS} )
 
+# The tool esdl-xml is built in HPCCPlatform as a build-time
+# pre-req. But it is not distributed in CE packages.
+if ("${BUILD_LEVEL}" STREQUAL "ENTERPRISE")
+    MESSAGE("----INSTALLING ESDL-XML")
+    install ( TARGETS esdl-xml RUNTIME DESTINATION ${EXEC_DIR} )
+    if ( UNIX )
+        install ( PROGRAMS esdl-xml.install DESTINATION etc/init.d/install COMPONENT Runtime )
+        install ( PROGRAMS esdl-xml.uninstall DESTINATION etc/init.d/uninstall COMPONENT Runtime )
+    endif ( UNIX )
+endif()

+ 1 - 0
tools/esdlcmd-xml/esdl-xml.install

@@ -0,0 +1 @@
+installFile "$binPath/esdl-xml" "/usr/bin/esdl-xml" 1 || exit 1

+ 1 - 0
tools/esdlcmd-xml/esdl-xml.uninstall

@@ -0,0 +1 @@
+removeSymlink "/usr/bin/esdl-xml"

+ 17 - 11
tools/esdl/esdl.cmake

@@ -14,20 +14,20 @@
 #    limitations under the License.
 ################################################################################
 
-# Component: esdl 
+# Component: esdl-xml
 
 #####################################################
 # Description:
 # ------------
-#    Cmake Input File for esdl
+#    Cmake Input File for esdl-xml
 #####################################################
 
 
-project( esdl ) 
+project( esdl-xml )
 
-include_directories ( 
-         ./../../system/include 
-         ./../../system/jlib 
+include_directories (
+         ./../../system/include
+         ./../../system/jlib
     )
 
 ADD_DEFINITIONS ( -D_CONSOLE )
@@ -37,14 +37,20 @@ add_custom_command ( OUTPUT esdlgram.cpp esdlgram.h
     DEPENDS esdlgram.h
 )
 
-add_custom_command ( OUTPUT esdllex.cpp 
+add_custom_command ( OUTPUT esdllex.cpp
     COMMAND ../pcyacc/pclex -i -Cesdllex.cpp esdllex.l
     DEPENDS esdllex.l
 )
 
 set ( SRCS esdlgram.cpp esdllex.cpp main.cpp esdlcomp.cpp esdl_utils.cpp )
-# esdlgram.y esdllex.l main.cpp esdlcomp.cpp esdl_utils.cpp 
-HPCC_ADD_EXECUTABLE ( esdl ${SRCS} )
-install ( TARGETS esdl RUNTIME DESTINATION ${EXEC_DIR} )
-#add_dependencies ( esdl esdlgram.cpp esdlgram.h esdllex.cpp )
+# esdlgram.y esdllex.l main.cpp esdlcomp.cpp esdl_utils.cpp
 
+HPCC_ADD_EXECUTABLE ( esdl-xml ${SRCS} )
+
+# The tool esdl-xml is built in HPCCPlatform as a build-time
+# pre-req. But it is not distributed in CE packages.
+if ("${BUILD_LEVEL}" STREQUAL "ENTERPRISE")
+    MESSAGE("----INSTALLING ESDL-XML")
+    install ( TARGETS esdl-xml RUNTIME DESTINATION ${EXEC_DIR} )
+    add_dependencies ( esdl-xml esdlgram.cpp esdlgram.h esdllex.cpp )
+endif()

+ 30 - 32
tools/esdl/esdl_esp_ng.cpp

@@ -28,14 +28,14 @@
 
 extern int gOutfile;
 
-//more flexible SCM/ESP code gen initially for RiskWise -- ProtocolX 
+//more flexible SCM/ESP code gen initially for RiskWise -- ProtocolX
 void ESDLcompiler::write_esp_ng()
 {
     //create the *.esp file
     gOutfile = espng;
     outf("// *** Source file generated by ESDL Version %s from %s.scm ***\n", ESDLVER, packagename);
-    outf("// *** Not to be hand edited (changes will be lost on re-generation) ***\n\n"); 
-    
+    outf("// *** Not to be hand edited (changes will be lost on re-generation) ***\n\n");
+
     outf("#ifndef %s_ESP_NG_INCLUDED\n", packagename);
     outf("#define %s_ESP_NG_INCLUDED\n\n", packagename);
     outs("\n");
@@ -45,24 +45,24 @@ void ESDLcompiler::write_esp_ng()
 
     outs("#include \"bind_ng.hpp\"\n");
     outf("#include \"%s.hpp\"\n", packagename);
-    
+
     outs("\n\n");
-    
+
     EspMessageInfo * mi;
-    for (mi=msgs;mi;mi=mi->next) 
+    for (mi=msgs;mi;mi=mi->next)
     {
         mi->write_esp_ng_ipp();
     }
-    
+
     EspServInfo *si;
-    for (si=servs;si;si=si->next) 
+    for (si=servs;si;si=si->next)
     {
         si->write_esp_binding_ng_ipp(msgs);
         outs("\n\n");
         si->write_esp_service();
         outs("\n\n");
     }
-    
+
     outf("#endif //%s_ESP_NG_INCLUDED\n", packagename);
 }
 
@@ -71,11 +71,11 @@ void ESDLcompiler::write_esp_ng_cpp()
     //create the *.esp file
     gOutfile = espngc;
     outf("// *** Source file generated by ESDL Version %s from %s.scm ***\n", ESDLVER, packagename);
-    outf("// *** Not to be hand edited (changes will be lost on re-generation) ***\n\n"); 
+    outf("// *** Not to be hand edited (changes will be lost on re-generation) ***\n\n");
     outf("#include \"%s_esp_ng.ipp\"\n\n\n", packagename);
-    
+
     EspServInfo *si;
-    for (si=servs;si;si=si->next) 
+    for (si=servs;si;si=si->next)
     {
         si->write_esp_binding_ng_cpp(msgs);
         outs("\n\n");
@@ -105,7 +105,7 @@ void EspMessageInfo::write_esp_ng_ipp()
 
     outf("   implements IEsp%s\n", name_);
     outs("{\n");
-    
+
     outs("protected:\n");
     int pcount=0;
     ParamInfo *pi=NULL;
@@ -120,9 +120,9 @@ void EspMessageInfo::write_esp_ng_ipp()
     outs(1,"StringBuffer m_serviceName;\n");
     outs(1,"StringBuffer m_methodName;\n");
     outs(1,"StringBuffer m_msgName;\n");
-    
+
     outs(1,"IMPLEMENT_IINTERFACE;\n\n");
-    
+
     outs(1, "void init_params()\n");
     outs(1, "{\n");
     outf(2, "m_pcount=%d;\n", pcount);
@@ -132,7 +132,7 @@ void EspMessageInfo::write_esp_ng_ipp()
         pi->write_esp_ng_declaration(pidx++);
     }
     outs(1, "}\n\n");
-    
+
     outs(1, "virtual IEspNgParameterIterator * getParameterIterator()\n");
     outs(1, "{\n");
     outs(2, "return new EspNgParameterIterator(m_params, m_pcount);\n");
@@ -149,19 +149,19 @@ void EspMessageInfo::write_esp_ng_ipp()
     outs(2, "for(int i=0; i < m_pcount; i++)\n");
     outs(3, "m_params[i]->Release();\n");
     outs(1, "}\n");
-    
+
     if (espm_type_==espm_response)
     {
         outs(1,"virtual void setRedirectUrl(const char *url){CEspNgResponse::setRedirectUrl(url);}\n");
         outs(1,"virtual const IMultiException & getExceptions(){return CEspNgResponse::getExceptions();}\n");
         outs(1,"virtual void noteException(IException & e){CEspNgResponse::noteException(e);}\n");
     }
-    
+
     outs("\n");
     write_esp_methods_ng(espaxm_both);
 
-    outf(1, "virtual void copy(IConst%s &from){/*not implemented*/}\n", name_); 
-    outf(1, "virtual const char * queryName(){return \"%s\";}\n", name_); 
+    outf(1, "virtual void copy(IConst%s &from){/*not implemented*/}\n", name_);
+    outf(1, "virtual const char * queryName(){return \"%s\";}\n", name_);
 
     outs("};\n\n");
 }
@@ -171,7 +171,7 @@ void ParamInfo::write_esp_ng_declaration(int pos)
 {
     char metatype[256]={0};
     cat_type(metatype);
-    
+
     esp_xlate_info *xlation=esp_xlat(metatype, false);
     const char *type_name="StringBuffer";
     if (xlation)
@@ -192,12 +192,12 @@ void ParamInfo::write_esp_attr_method_ng(const char *msgname, int pos, bool isSe
 {
     char metatype[256]={0};
     cat_type(metatype);
-    
+
     esp_xlate_info *xlation=esp_xlat(metatype);
-    
+
     char *methName=strdup(name);
     *methName=upperchar(*methName);
-    
+
     if (isSet)
     {
         if (hasNilRemove)
@@ -224,7 +224,7 @@ void EspMessageInfo::write_esp_methods_ng(enum espaxm_type axstype)
             pi->write_esp_attr_method_ng(name_, pos++, false, getMetaInt("nil_remove")!=0);
         }
     }
-    
+
     if (axstype!=espaxm_getters)
     {
         int pos=0;
@@ -246,11 +246,11 @@ void EspServInfo::write_esp_binding_ng_ipp(EspMessageInfo *msgs)
     outs("{\npublic:\n");
 
     outf(1,"CNg%sServiceBinding(IPropertyTree* cfg, const char *bindname=NULL, const char *procname=NULL) : base_binding(cfg, bindname, procname){}\n", name_);
-    
+
     outs(1,"IEspNgRequest* createRequest(const char *method)\n");
     outs(1,"{\n");
     int count=0;
-    for (mthi=methods;mthi;mthi=mthi->next) 
+    for (mthi=methods;mthi;mthi=mthi->next)
     {
         outf(2,"%sif (!stricmp(method, \"%s\"))\n", (count++==0)? "" : "else ", mthi->getName());
         outs(2,"{\n");
@@ -263,7 +263,7 @@ void EspServInfo::write_esp_binding_ng_ipp(EspMessageInfo *msgs)
     outs(1,"virtual IEspNgResponse* createResponse(const char *method)\n");
     outs(1,"{\n");
     count=0;
-    for (mthi=methods;mthi;mthi=mthi->next) 
+    for (mthi=methods;mthi;mthi=mthi->next)
     {
         outf(2,"%sif (!stricmp(method, \"%s\"))\n", (count++==0)? "" : "else ", mthi->getName());
         outs(2,"{\n");
@@ -278,7 +278,7 @@ void EspServInfo::write_esp_binding_ng_ipp(EspMessageInfo *msgs)
     outs(1,"{\n");
     outf(2, "Owned<IEsp%s> iserv = (IEsp%s*)base_binding::getService();\n", name_, name_);
     count=0;
-    for (mthi=methods;mthi;mthi=mthi->next) 
+    for (mthi=methods;mthi;mthi=mthi->next)
     {
         outf(2,"%sif (!stricmp(method_name, \"%s\")/*||!stricmp(req->queryName(), \"%s\")*/)\n", (count++==0)? "" : "else ", mthi->getName(), mthi->getReq());
         outs(2,"{\n");
@@ -287,10 +287,9 @@ void EspServInfo::write_esp_binding_ng_ipp(EspMessageInfo *msgs)
     }
     outs(2,"return 0;\n");
     outs(1,"}\n\n");
-    
+
     //method ==> getServiceName
     outf(1,"StringBuffer & getServiceName(StringBuffer &resp){resp.clear().append(\"%s\");}\n", name_);
-    
 
     outs("};\n\n");
 }
@@ -298,4 +297,3 @@ void EspServInfo::write_esp_binding_ng_ipp(EspMessageInfo *msgs)
 void EspServInfo::write_esp_binding_ng_cpp(EspMessageInfo *msgs)
 {
 }
-

+ 18 - 18
tools/esdl/esdl_utils.cpp

@@ -60,7 +60,7 @@ int es_createFile(const char* src, const char* ext)
     char * path = es_changeext(src,ext);
     //printf("Target: %s\n", path);
     int h = open(path,_O_WRONLY | _O_CREAT | _O_TRUNC | _O_TEXT  , _S_IREAD|_S_IWRITE);
-    if (h==-1) 
+    if (h==-1)
     {
         printf("Could not open file for write: %s (current dir: %s)\n",path,getcwd(NULL,0));
     }
@@ -101,20 +101,20 @@ char * es_changeext(const char *fn,const char *ext)
     char *p;
     for (p=(char*)(fn+preext-1); p>=fn; p--)
     {
-        if (*p == '.')  
+        if (*p == '.')
         {
             preext = p-fn;
             break;
         }
     }
-    
+
     //  char *ret=gettail(fn);
     //  size_t l = strlen(ret);
     //  ret = (char *)realloc(ret,l+strlen(ext)+2);
-    
+
     char *ret = (char *)malloc(preext+strlen(ext)+2);
     memcpy(ret, fn, preext);
-    
+
     ret[preext] = '.';
     strcpy(ret+preext+1,ext);
     return ret;
@@ -127,16 +127,16 @@ char * es_changetail(const char *fn,const char *tail, const char *ext)
     char *p;
     for (p=(char*)(fn+preext-1); p>=fn; p--)
     {
-        if (*p == '.')  
+        if (*p == '.')
         {
             preext = p-fn;
             break;
         }
     }
-    
+
     char *ret = (char *)malloc(preext+strlen(tail)+strlen(ext)+2);
     memcpy(ret, fn, preext);
-    
+
     ret[preext] = 0;
     strcat(ret,tail);
     strcat(ret,".");
@@ -156,7 +156,7 @@ int es_createFile(const char* src, const char* tail, const char* ext)
 {
     char * path=es_changetail(src,tail,ext);
     int h = open(path,_O_WRONLY | _O_CREAT | _O_TRUNC | _O_TEXT  , _S_IREAD|_S_IWRITE);
-    if (h==-1) 
+    if (h==-1)
     {
         printf("Could not open file for write: %s (current dir: %s)\n",path,getcwd(NULL,0));
     }
@@ -213,7 +213,7 @@ void StrBuffer::_realloc(size32_t newLen)
         char * newStr;
         if(!newMax || !(newStr=(char *)realloc(buffer, newMax)))
             throw "StrBuffer::_realloc: Failed to realloc memory";
-        
+
         buffer = newStr;
         maxLen = newMax;
     }
@@ -222,7 +222,7 @@ void StrBuffer::_realloc(size32_t newLen)
 StrBuffer & StrBuffer::append(int value)
 {
     char temp[12];
-    
+
     unsigned written = sprintf(temp, "%d", value);
     return append(written, temp);
 }
@@ -230,12 +230,12 @@ StrBuffer & StrBuffer::append(int value)
 StrBuffer & StrBuffer::append(unsigned int value)
 {
     char temp[12];
-    
+
     unsigned written = sprintf(temp, "%u", value);
     return append(written, temp);
 }
 
-StrBuffer & StrBuffer::append(char c) 
+StrBuffer & StrBuffer::append(char c)
 {
     appendf("%c",c);
     return *this;
@@ -253,7 +253,7 @@ StrBuffer & StrBuffer::append(const char * value)
     if (value)
     {
         size32_t SourceLen = (size32_t)::strlen(value);
-        
+
         ensureCapacity(SourceLen);
         memcpy(buffer + curLen, value, SourceLen);
         curLen += SourceLen;
@@ -322,7 +322,7 @@ StrBuffer & StrBuffer::valist_appendf(const char *format, va_list args)
 {
     const int BUF_SIZE = 1024;
     char  buf[BUF_SIZE];
-    
+
     int len = _vsnprintf(buf,sizeof(buf),format,args);
     if (len >= 0)
     {
@@ -332,7 +332,7 @@ StrBuffer & StrBuffer::valist_appendf(const char *format, va_list args)
         {
             ensureCapacity(len);
             // no need for _vsnprintf since the buffer is already made big enough
-            vsprintf(buffer+curLen,format,args); 
+            vsprintf(buffer+curLen,format,args);
             curLen += len;
         }
     }
@@ -348,7 +348,7 @@ StrBuffer & StrBuffer::valist_appendf(const char *format, va_list args)
         append(len, pbuf);
         free(pbuf);
     }
-    
+
     return *this;
 }
 
@@ -494,5 +494,5 @@ void splitFilename(const char * filename, StrBuffer * drive, StrBuffer * path, S
         ext->append(text);
 }
 
-bool streq(const char* s, const char* t) 
+bool streq(const char* s, const char* t)
 { return strcmp(s,t)==0; }

+ 7 - 7
tools/esdl/esdl_utils.hpp

@@ -53,7 +53,7 @@ public:
     inline size32_t length() const                      { return curLen; }
     void            setLength(unsigned len);
     inline void     ensureCapacity(unsigned max)        { if (maxLen <= curLen + max) _realloc(curLen + max); }
-    
+
     StrBuffer &  append(int value);
     StrBuffer &  append(unsigned int value);
     StrBuffer &  append(char c);
@@ -65,7 +65,7 @@ public:
     StrBuffer &  setf(const char* format, ...) __attribute__((format(printf, 2, 3)));
     StrBuffer &  set(const char* val) { return clear().append(val); }
     StrBuffer &  clear() { curLen = 0; return *this; }
-    
+
     StrBuffer & append(const char*, int offset, int len);
     StrBuffer & replace(char oldChar, char newChar);
 
@@ -73,14 +73,14 @@ public:
     operator const char* () const { return str(); }
     char charAt(size32_t pos) { return buffer[pos]; }
     void setCharAt(size32_t pos, char value) { buffer[pos] = value; }
-    char* detach() 
-    { 
+    char* detach()
+    {
         if (buffer)
         {
             buffer[curLen] = 0;
-            char* ret = buffer; 
+            char* ret = buffer;
             init();
-            return ret; 
+            return ret;
         }
         return strdup("");
     }
@@ -97,7 +97,7 @@ protected:
     void _realloc(size32_t newLen);
     StrBuffer & valist_appendf(const char *format, va_list args);
 
-private:    
+private:
     mutable char * buffer;
     size32_t       curLen;
     size32_t       maxLen;

+ 58 - 60
tools/esdl/esdlcomp.cpp

@@ -74,7 +74,7 @@ static const char* getTypeKindName(type_kind kind)
     }
 };
 
-const char *type_name[] = 
+const char *type_name[] =
 {
     "??",
     "char",
@@ -98,7 +98,7 @@ const char *type_name[] =
     "??" // ESPENUM
 };
 
-const int type_size[] = 
+const int type_size[] =
 {
     1,
     1,
@@ -121,7 +121,7 @@ const int type_size[] =
     1  // ESP_ENUM
 };
 
-static const char *xlattable[] = 
+static const char *xlattable[] =
 {
     "abs","_abs",
     "add","_add",
@@ -280,7 +280,7 @@ void voutf(const char* fmt,va_list args)
     // Better to use StringBuffer.valist_appendf, but unfortunately, project dependencies
     // disallow us to use StringBuffer (defined in jlib).
     if (_vsnprintf(buf, BUF_LEN, fmt, args)<0)
-        fprintf(stderr,"Warning: outf() gets too many long buffer (>%d)", BUF_LEN);     
+        fprintf(stderr,"Warning: outf() gets too many long buffer (>%d)", BUF_LEN);
     va_end(args);
 
     outs(buf);
@@ -296,14 +296,14 @@ void outf(const char *fmt, ...)
 void outf(int indents, const char *fmt, ...)
 {
     indent(indents);
-    
+
     va_list args;
     va_start(args, fmt);
-    voutf(fmt,args);    
+    voutf(fmt,args);
 }
 
 // ------------------------------------
-// "auto" indenting 
+// "auto" indenting
 
 int gIndent = 0;
 
@@ -331,7 +331,7 @@ void indentOuts1(int inc, const char* s)
 void indentOutf(const char* fmt, ...)
 {
     indent(gIndent);
-    
+
     va_list args;
     va_start(args, fmt);
     voutf(fmt,args);
@@ -341,7 +341,7 @@ void indentOutf(int inc, const char* fmt, ...)
 {
     gIndent += inc;
     indent(gIndent);
-    
+
     va_list args;
     va_start(args, fmt);
     voutf(fmt,args);
@@ -350,7 +350,7 @@ void indentOutf(int inc, const char* fmt, ...)
 void indentOutf1(int inc, const char* fmt, ...)
 {
     indent(gIndent+inc);
-    
+
     va_list args;
     va_start(args, fmt);
     voutf(fmt,args);
@@ -379,7 +379,7 @@ ParamInfo::ParamInfo()
     templ=NULL;
     typname=NULL;
     size = NULL;
-    flags = 0;      
+    flags = 0;
     next = NULL;
     kind = TK_null;
     sizebytes = NULL;
@@ -401,7 +401,7 @@ ParamInfo::~ParamInfo()
         free(xsdtype);
     if (m_arrayImplType)
         delete m_arrayImplType;
-    while (layouts) 
+    while (layouts)
     {
         LayoutInfo *l=layouts;
         layouts = l->next;
@@ -409,7 +409,7 @@ ParamInfo::~ParamInfo()
     }
 }
 
-char * ParamInfo::bytesize(int deref) 
+char * ParamInfo::bytesize(int deref)
 {
     if (!size)
         return NULL;
@@ -418,7 +418,7 @@ char * ParamInfo::bytesize(int deref)
     char str[1024];
     if (type_size[kind]==1)
     {
-        if (deref) 
+        if (deref)
         {
             strcpy(str,"*");
             strcat(str,size);
@@ -471,7 +471,7 @@ void ParamInfo::cat_type(char *s,int deref,int var)
     else {
         if (kind!=TK_null)
             strcat(s,type_name[kind]);
-        else 
+        else
             strcat(s,"string"); // TODO: why this happens?
     }
     if (!deref) {
@@ -483,7 +483,7 @@ void ParamInfo::cat_type(char *s,int deref,int var)
 }
 
 clarion_special_type_enum ParamInfo::clarion_special_type()
-{   
+{
     if ((type_size[kind]==1)&&((flags&(PF_PTR|PF_REF))==PF_PTR)) {
         if ((flags&PF_CONST)==0)
             return cte_cstr;
@@ -564,10 +564,10 @@ void ParamInfo::write_body_struct_elem(int ref)
 {
     outs("\t");
     out_type(ref,1);
-    if (ref&&(flags&(PF_REF|PF_PTR))) 
+    if (ref&&(flags&(PF_REF|PF_PTR)))
     {
         outs(" *");
-        if ((flags&(PF_REF|PF_PTR))==(PF_REF|PF_PTR)) 
+        if ((flags&(PF_REF|PF_PTR))==(PF_REF|PF_PTR))
         {
             outs(" *");
         }
@@ -591,14 +591,14 @@ static esp_xlate_info esp_xlate_table[]=
 {
     //meta type                 xsd type                implementation      array impl      access type             type_kind           flags               method
     //------------------        ---------------         --------------      --------------  --------------          -----------         ------------        ----------
-    
+
 //  {"string",                  "string",               "StringBuffer",     "StringArray",  "const char *",         TK_CHAR,            (PF_PTR|PF_CONST),  EAM_jsbuf},
     {"string",                  "string",               "StringBuffer",     "StringArray",  "const char *",         TK_CHAR,            (PF_PTR|PF_CONST),  EAM_jsbuf},
     {"StringBuffer",            "string",               "StringBuffer",     "StringArray",  "const char *",         TK_CHAR,            (PF_PTR|PF_CONST),  EAM_jsbuf},
 //  {"hexBinary",               "base64Binary",         "MemoryBuffer",     "???",          "unsigned char *",      TK_UNSIGNEDCHAR,    (PF_PTR),           EAM_jmbuf},
     {"binary",                  "base64Binary",         "MemoryBuffer",     "???",          "const MemoryBuffer &", TK_STRUCT,          (PF_REF),           EAM_jmbin},
-    {"bool",                    "boolean",              "bool",             "BoolArray",    "bool",                 TK_BOOL,            0,                  EAM_basic}, 
-    {"boolean",                 "boolean",              "bool",             "BoolArray",    "bool",                 TK_BOOL,            0,                  EAM_basic}, 
+    {"bool",                    "boolean",              "bool",             "BoolArray",    "bool",                 TK_BOOL,            0,                  EAM_basic},
+    {"boolean",                 "boolean",              "bool",             "BoolArray",    "bool",                 TK_BOOL,            0,                  EAM_basic},
     {"decimal",                 "decimal",              "float",            "???",          "float",                TK_FLOAT,           0,                  EAM_basic},
     {"float",                   "float",                "float",            "FloatArray",   "float",                TK_FLOAT,           0,                  EAM_basic},
     {"double",                  "double",               "double",           "DoubleArray",  "double",               TK_DOUBLE,          0,                  EAM_basic},
@@ -619,7 +619,7 @@ static esp_xlate_info esp_xlate_table[]=
     {"normalizedString",        "normalizedString",     "StringBuffer",     "StringArray",  "const char *",         TK_CHAR,            (PF_PTR|PF_CONST),  EAM_jsbuf},
     {"xsdString",               "string",               "StringBuffer",     "StringArray",  "const char *",         TK_CHAR,            (PF_PTR|PF_CONST),  EAM_jsbuf},
     {"xsdBinary",               "binary",               "MemoryBuffer",     "???",          "const MemoryBuffer &", TK_STRUCT,          (PF_REF),           EAM_jmbin},
-    {"xsdBoolean",              "boolean",              "bool",             "???",          "bool",                 TK_BOOL,            0,                  EAM_basic}, 
+    {"xsdBoolean",              "boolean",              "bool",             "???",          "bool",                 TK_BOOL,            0,                  EAM_basic},
     {"xsdDecimal",              "decimal",              "float",            "???",          "float",                TK_FLOAT,           0,                  EAM_basic},
     {"xsdInteger",              "integer",              "int",              "???",          "int",                  TK_INT,             0,                  EAM_basic},
     {"xsdByte",                 "byte",                 "unsigned char",    "???",          "unsigned char",        TK_UNSIGNEDCHAR,    0,                  EAM_basic},
@@ -667,7 +667,7 @@ esp_xlate_info *esp_xlat(const char *from, bool defaultToString)
 {
     if (from)
     {
-        for (unsigned i=0; esp_xlate_table[i].meta_type!=NULL; i++) 
+        for (unsigned i=0; esp_xlate_table[i].meta_type!=NULL; i++)
         {
             if (stricmp(from,esp_xlate_table[i].meta_type)==0)
                 return &esp_xlate_table[i];
@@ -683,12 +683,12 @@ static char* getToBeDefinedType(const char* type)
 {
     const char* colon = strchr(type, ':');
     const char* bareType = colon ? colon+1 : type;
-    
+
     if (strnicmp(type, "xsd",colon-type)==0)
         return NULL;
 
     /*
-    for (unsigned i=0; esp_xlate_table[i].meta_type!=NULL; i++) 
+    for (unsigned i=0; esp_xlate_table[i].meta_type!=NULL; i++)
     {
         if (stricmp(bareType,esp_xlate_table[i].xsd_type)==0)
             return NULL;
@@ -720,15 +720,15 @@ static const char *MetaTypeToXsdType(const char *val)
 bool hasMetaVerInfo(MetaTagInfo *list, const char* tag)
 {
     double ver = getMetaDouble(list,tag,-1);
-    if (ver>0) 
+    if (ver>0)
         return true;
 
     const char* vs = getMetaString(list,tag, NULL);
-    if (vs!=NULL) 
+    if (vs!=NULL)
         return true;
 
     const char* id = getMetaConstId(list,tag,NULL);
-    if (id) 
+    if (id)
         return true;
 
     return false;
@@ -764,9 +764,9 @@ static esp_xlate_info *esp_xlat(ParamInfo *pi)
 {
     char metatype[256];
     *metatype=0;
-    
+
     pi->cat_type(metatype);
-    
+
     return esp_xlat(metatype);
 }
 
@@ -774,11 +774,11 @@ void ParamInfo::setXsdType(const char *value)
 {
     if (xsdtype)
         free(xsdtype);
-    
+
     const char *newValue=value;
     if (strncmp(value, "xsd", 3)==0)
         newValue=MetaTypeToXsdType(value);
-    
+
     xsdtype = (newValue!=NULL) ? strdup(newValue) : NULL;
 }
 
@@ -790,10 +790,10 @@ const char *ParamInfo::getXsdType()
         char metatype[256];
         *metatype=0;
         cat_type(metatype);
-        
+
         setXsdType(MetaTypeToXsdType(metatype));
     }
-    
+
     return xsdtype;
 }
 
@@ -805,8 +805,8 @@ const char* ParamInfo::getArrayImplType()
     if (isPrimitiveArray())
     {
         char metatype[256];
-        metatype[0] = 0;        
-        cat_type(metatype);     
+        metatype[0] = 0;
+        cat_type(metatype);
         esp_xlate_info *xlation=esp_xlat(metatype, false);
         m_arrayImplType = new StrBuffer(xlation->array_type);
     }
@@ -817,7 +817,7 @@ const char* ParamInfo::getArrayImplType()
         else
             m_arrayImplType = new VStrBuffer("IArrayOf<IConst%s>", typname);
     }
-    
+
     return m_arrayImplType->str();
 }
 
@@ -842,11 +842,11 @@ const char* ParamInfo::getArrayItemXsdType()
 
     case TK_null: return "string";
 
-    case TK_STRUCT: 
-    case TK_VOID: 
-    case TK_ESPSTRUCT: 
-    case TK_ESPENUM: 
-    default: throw "Unimplemented"; 
+    case TK_STRUCT:
+    case TK_VOID:
+    case TK_ESPSTRUCT:
+    case TK_ESPENUM:
+    default: throw "Unimplemented";
     }
 }
 
@@ -877,7 +877,7 @@ ProcInfo::~ProcInfo()
     free(conntimeout);
     free(calltimeout);
     delete rettype;
-    while (params) 
+    while (params)
     {
         ParamInfo *p=params;
         params = p->next;
@@ -928,7 +928,7 @@ ModuleInfo::ModuleInfo(const char *n)
 ModuleInfo::~ModuleInfo()
 {
     free(name);
-    while (procs) 
+    while (procs)
     {
         ProcInfo *p=procs;
         procs = p->next;
@@ -1003,8 +1003,6 @@ EspMessageInfo *EspMethodInfo::getRequestInfo()
     return NULL;
 }
 
-
-
 static EspMethodInfo* sortMethods(EspMethodInfo* ms)
 {
     if (ms==NULL)
@@ -1055,8 +1053,8 @@ void EspServInfo::sortMethods()
 
 char* getTargetBase(const char* outDir, const char* src)
 {
-    if (outDir && *outDir) 
-    { 
+    if (outDir && *outDir)
+    {
         int dirlen = strlen(outDir);
         int srclen = strlen(src);
         char* buf = (char*)malloc(dirlen+srclen+5);
@@ -1070,12 +1068,12 @@ char* getTargetBase(const char* outDir, const char* src)
         strcpy(buf,outDir);
 
         int len = strlen(buf);
-        if (buf[len-1]=='/' || buf[len-1]=='\\') 
+        if (buf[len-1]=='/' || buf[len-1]=='\\')
         {
             buf[len-1]=0;
             len--;
         }
-        
+
         // now buf has the directory name for output: make the directory if not exist
         es_createDirectory(buf);
 
@@ -1100,7 +1098,7 @@ ESDLcompiler::ESDLcompiler(const char * sourceFile,const char *outDir)
     includes=NULL;
     methods=NULL;
     versions = NULL;
-    
+
     splitFilename(sourceFile, NULL, NULL, &name, NULL);
 
 
@@ -1113,7 +1111,7 @@ ESDLcompiler::ESDLcompiler(const char * sourceFile,const char *outDir)
         exit(1);
     }
     packagename = es_gettail(sourceFile);
-    
+
     char* targetBase = getTargetBase(outDir, sourceFile);
 
     esxdlo = es_createFile(targetBase,"xml");
@@ -1152,38 +1150,38 @@ void ESDLcompiler::write_esxdl()
     outf("<esxdl name=\"%s\">\n", name.str());
 
     VersionInfo * vi;
-    for (vi=versions;vi;vi=vi->next) 
+    for (vi=versions;vi;vi=vi->next)
     {
         vi->write_esxdl();
     }
 
     IncludeInfo * ii;
-    for (ii=includes;ii;ii=ii->next) 
+    for (ii=includes;ii;ii=ii->next)
     {
         ii->write_esxdl();
     }
 
     EspMessageInfo * mi;
-    for (mi=msgs;mi;mi=mi->next) 
+    for (mi=msgs;mi;mi=mi->next)
     {
         mi->write_esxdl();
     }
-    
+
     EspServInfo *si;
-    for (si=servs;si;si=si->next) 
+    for (si=servs;si;si=si->next)
     {
         si->write_esxdl();
     }
-    
+
     if (methods)
     {
         EspMethodInfo *sm;
-        for (sm=methods;sm;sm=sm->next) 
+        for (sm=methods;sm;sm=sm->next)
         {
             sm->write_esxdl();
         }
     }
-    
+
     outs("</esxdl>");
 
 

+ 35 - 35
tools/esdl/esdlcomp.h

@@ -114,7 +114,7 @@ char *appendstr(char *text,const char *str);
 struct attribute
 {
 private:
-    union 
+    union
     {
         char *str_val;
         int int_val;
@@ -123,7 +123,7 @@ private:
 
     enum { t_none, t_string, t_int, t_double } atr_type;
     char name_[MAX_IDENT];
-    
+
 public:
 
     attribute()
@@ -136,7 +136,7 @@ public:
     {
         release();
     }
-    
+
     void release()
     {
         if (atr_type==t_string)
@@ -188,7 +188,7 @@ public:
     {
         strcpy(name_,(value)? value : (char *)"");
     }
-    
+
     void setNameF(const char *format, ...) __attribute__((format(printf, 2, 3)))
     {
         va_list args;
@@ -214,7 +214,7 @@ class MetaTagInfo
 {
 private:
     char *name_;
-    
+
     union
     {
         char *str_val_;
@@ -288,7 +288,7 @@ public:
     {
         if (mttype_==mt_string && str_val_!=NULL)
             free(str_val_);
-        
+
         str_val_=strdup(val);
 
         mttype_=mt_string;
@@ -380,7 +380,7 @@ inline bool getMetaStringValue(MetaTagInfo *list, StrBuffer &val, const char *ta
     if (!mtval || strlen(mtval)<2)
         return false;
     val.append(strlen(mtval)-2, mtval+1);
-    return true;    
+    return true;
 }
 
 inline int getMetaInt(MetaTagInfo *list, const char *tag, int def_val=0)
@@ -411,7 +411,7 @@ public:
     ParamInfo();
     ~ParamInfo();
 
-    char *bytesize(int deref=0); 
+    char *bytesize(int deref=0);
     bool simpleneedsswap();
     void cat_type(char *s,int deref=0,int var=0);
     clarion_special_type_enum clarion_special_type();
@@ -423,7 +423,7 @@ public:
     size_t typesizealign(size_t &ofs);
     void write_body_struct_elem(int ref);
     void write_param_convert(int deref=0);
-    
+
     bool isEspArrayOf(const char *elem_type=NULL, bool def=true)
     {
         if (flags & PF_TEMPLATE && !strcmp(templ, "ESParray"))
@@ -442,14 +442,14 @@ public:
         return false;
     }
 
-    bool isPrimitiveArray() 
-    { 
+    bool isPrimitiveArray()
+    {
         if (flags & PF_TEMPLATE && !strcmp(templ, "ESParray"))
             return (kind != TK_STRUCT && kind != TK_null && kind != TK_ESPENUM && kind != TK_ESPSTRUCT) || !typname;
         return false;
     }
 
-    type_kind getArrayItemType() 
+    type_kind getArrayItemType()
     {
         assert(isPrimitiveArray());
         return kind;
@@ -506,7 +506,7 @@ public:
     const char *getMetaXsdType() {  const char* xsd = getMetaString("xsd_type",NULL);  return xsd ? xsd : getMetaString("format_as",NULL); }
 
     // should be call once at a time. Better: use CStringBuffer
-    const char* getXmlTag() 
+    const char* getXmlTag()
     {
         static char buffer[256];
         const char* xmlTag = getMetaString("xml_tag", NULL);
@@ -542,7 +542,7 @@ public:
         {
             char typestr[256]={0};
             cat_type(typestr, 0, 0);
-            
+
             outf(" %s=\"%s\"", (kind==TK_ESPSTRUCT) ? "complex_type" : "type", typestr);
         }
     }
@@ -589,13 +589,13 @@ public:
     char      *sizebytes;
     unsigned   flags;
     LayoutInfo *layouts;
-    ParamInfo  *next;   
+    ParamInfo  *next;
     MetaTagInfo     *tags;
 
 private:
     char      *xsdtype;
     StrBuffer *m_arrayImplType;
-};  
+};
 
 class ProcInfo
 {
@@ -611,8 +611,8 @@ public:
     char      * calltimeout;
     int         async;
     int         callback;
-    ParamInfo * firstin;    
-    ParamInfo * lastin; 
+    ParamInfo * firstin;
+    ParamInfo * lastin;
     int         virt;
     int         constfunc;
 };
@@ -630,7 +630,7 @@ public:
     ModuleInfo  *next;
     bool            isSCMinterface;
 };
-        
+
 class ExportDefInfo
 {
 public:
@@ -639,7 +639,7 @@ public:
         name_=strdup(name);
         next=NULL;
     }
-    
+
     ~ExportDefInfo()
     {
         if (name_)
@@ -680,7 +680,7 @@ public:
        outf(1, "<EsdlInclude file=\"%s\"/>\n", pathstr.str());
    }
 
-   StrBuffer pathstr;   
+   StrBuffer pathstr;
    IncludeInfo  *next;
 };
 
@@ -701,7 +701,7 @@ public:
        outf(1, "<EsdlVersion name=\"%s\" version=\"%f\" />\n", version_name.str(), version_value);
    }
 
-   StrBuffer version_name;  
+   StrBuffer version_name;
    double version_value;
    VersionInfo *next;
 };
@@ -772,7 +772,7 @@ public:
         espm_type_=type;
 
         name_ =strdup(procInfo->name);
-        
+
         if (espm_type_==espm_struct)
         {
             name_ =(char *)malloc(strlen(procInfo->name)+6);
@@ -817,7 +817,7 @@ public:
             free(name_);
         name_=strdup(name);
     }
-    
+
     const char *getBase(){return base_;}
     void setBase(const char *base)
     {
@@ -857,7 +857,7 @@ public:
         return xsdgrouptype;
     }
 
-    
+
     const char *getMetaString(const char *tag, const char *def_val)
     {
         return ::getMetaString(tags, tag, def_val);
@@ -901,7 +901,7 @@ public:
     }
 
     EspMessageInfo *find_parent();
-    
+
     void write_esxdl_children()
     {
         EspMessageInfo *parmsg = find_parent();
@@ -962,17 +962,17 @@ public:
         tags=NULL;
         next=NULL;
     }
-    
+
     EspMethodInfo(ProcInfo *procInfo)
     {
         proc_=procInfo;
 
         name_ =strdup(procInfo->name);
-        
+
         request_ =(char *)malloc(strlen(name_)+8);
         strcpy(request_, name_);
         strcat(request_, "Request");
-        
+
         response_ =(char *)malloc(strlen(name_)+9);
         strcpy(response_, name_);
         strcat(response_, "Response");
@@ -980,7 +980,7 @@ public:
         tags=NULL;
         next=NULL;
     }
-    
+
     const char *getName(){return name_;}
     void setName(const char *name)
     {
@@ -1056,7 +1056,7 @@ public:
         tags=NULL;
         next=NULL;
     }
-    
+
     const char *getName(){return name_;}
     void setName(const char *name)
     {
@@ -1110,7 +1110,7 @@ public:
         tags=NULL;
         next=NULL;
     }
-    
+
     const char *getName(){return name_;}
     void setName(const char *name)
     {
@@ -1139,7 +1139,7 @@ public:
 };
 
 typedef enum _catch_type
-{ 
+{
     ct_httpresp,
     ct_soapresp,
 } catch_type;
@@ -1164,7 +1164,7 @@ public:
         next=NULL;
         needsXslt = false;
     }
-    
+
     ~EspServInfo()
     {
         if (name_)
@@ -1210,7 +1210,7 @@ public:
         for (MetaTagInfo *mtag=tags; mtag; mtag=mtag->next)
             mtag->write_xml_attr();
         outs(">\n");
-        
+
         for (EspMethodInfo *mth=methods; mth; mth=mth->next)
             mth->write_esxdl();
         outs(2, "</EsdlService>");

tools/esdl/esdlfile.cpp → tools/esdlcmd-xml/esdlfile.cpp


tools/esdl/esdlfile.h → tools/esdlcmd-xml/esdlfile.h


+ 113 - 113
tools/esdl/esdlgram.y

@@ -42,7 +42,7 @@ ModuleInfo * CurModule=NULL;
 ProcInfo *   CurProc;
 ParamInfo *  CurParam;
 LayoutInfo * CurLayout;
-EnumInfo *   CurEnum=NULL;  
+EnumInfo *   CurEnum=NULL;
 EnumValInfo *   CurEnumVal;
 int EnumValue = 0;
 ApiInfo * CurApi=NULL;
@@ -57,7 +57,7 @@ ModuleInfo * LastModule;
 ProcInfo *   LastProc;
 ParamInfo *  LastParam;
 LayoutInfo * LastLayout;
-EnumInfo *   LastEnum;  
+EnumInfo *   LastEnum;
 EnumValInfo *   LastEnumVal;
 ApiInfo * LastApi=NULL;
 IncludeInfo *LastInclude=NULL;
@@ -143,7 +143,7 @@ SectionList
  ;
 
 Section
- : Module 
+ : Module
  | Enumeration
  | ExportDef
  | EspDefExport
@@ -177,7 +177,7 @@ EspService
     AddEspService();
     //Now the default is sorted
     if (CurService->getMetaInt("sort_method",1)!=0)
-        CurService->sortMethods();  
+        CurService->sortMethods();
     CurService=NULL;
  }
  ;
@@ -191,8 +191,8 @@ EspServiceStart
  ;
 
 EspServiceBody
- : '{' EspServiceEntryList '}' 
- | '{' '}' 
+ : '{' EspServiceEntryList '}'
+ | '{' '}'
  ;
 
 EspServiceEntryList
@@ -221,7 +221,7 @@ EspServiceMethod
         CurEspMessage = new EspMessageInfo(EspMessageInfo::espm_request, CurProc);
         AddEspMessage();
         CurEspMessage=NULL;
-    
+
         CurEspMessage = new EspMessageInfo(EspMessageInfo::espm_response, CurProc);
         AddEspMessage();
         CurEspMessage=NULL;
@@ -238,7 +238,7 @@ EspServiceMethod
         CurEspMessage = new EspMessageInfo(EspMessageInfo::espm_request, CurProc);
         AddEspMessage();
         CurEspMessage=NULL;
-    
+
         CurEspMessage = new EspMessageInfo(EspMessageInfo::espm_response, CurProc);
         AddEspMessage();
         CurEspMessage=NULL;
@@ -246,7 +246,7 @@ EspServiceMethod
         EspMethodInfo *CurMethod=new EspMethodInfo(CurProc);
         delete CurProc;
         CurProc=NULL;
-        
+
         AddEspMethod();
         CurMethod=NULL;
     }
@@ -269,7 +269,7 @@ EspServiceUses
  : ESPUSES EspMetaData EspType ID ';'
  {
     EspStructInfo *esp_struct=new EspStructInfo($4.getName());
-    
+
     esp_struct->tags = getClearCurMetaTags();
 
     esp_struct->next=CurService->structs;
@@ -286,7 +286,7 @@ EspStruct
  ;
 
 EspStructStart
- : ESPSTRUCT EspMetaData ID 
+ : ESPSTRUCT EspMetaData ID
  {
     CurEspMessage = new EspMessageInfo($3.getName(), EspMessageInfo::espm_struct);
     CurEspMessage->tags = getClearCurMetaTags();
@@ -305,7 +305,7 @@ EspEnum
  ;
 
 EspEnumStart
- : ESPENUM EspMetaData ID 
+ : ESPENUM EspMetaData ID
  {
     CurEspMessage = new EspMessageInfo($3.getName(), EspMessageInfo::espm_enum);
     CurEspMessage->tags = getClearCurMetaTags();
@@ -319,7 +319,7 @@ EnumBase
     if (CurEspMessage->getParentName())
         yyerror("parent is already specified by meta extends");
     CurEspMessage->setParentName($2.getName());
- } 
+ }
  |
  {
     yyerror("base type must be specified for enumeration type");
@@ -346,7 +346,7 @@ EnumBaseType
  ;
 
 EnumBody
- : '{' EnumList OptionalComma '}' 
+ : '{' EnumList OptionalComma '}'
  {
     CurParam=NULL;
     LastParam=NULL;
@@ -356,7 +356,7 @@ EnumBody
  ;
 
 EnumList
- : EnumItemDef 
+ : EnumItemDef
  | EnumList ',' EnumItemDef
  ;
 
@@ -367,7 +367,7 @@ EnumItemDef
     CurParam->name = strdup($1.getName());
     CurParam->kind = TK_ENUM;
     CurParam->tags = getClearCurMetaTags();
-    AddEspProperty(); 
+    AddEspProperty();
  }
  | ID '(' EnumConstValue ',' string_const ')'
  {
@@ -376,7 +376,7 @@ EnumItemDef
     CurParam->kind = TK_ENUM;
     AddMetaTag(new MetaTagInfo("desc", $5.getString()));
     CurParam->tags = getClearCurMetaTags();;
-    AddEspProperty(); 
+    AddEspProperty();
  }
  | ID
  {
@@ -386,7 +386,7 @@ EnumItemDef
     AddMetaTag(new MetaTagInfo("enum", VStrBuffer("\"%s\"", $1.getName()).str()));
     CurParam->tags = getClearCurMetaTags();
 
-    AddEspProperty(); 
+    AddEspProperty();
  }
  ;
 
@@ -422,7 +422,7 @@ EspRequest
  ;
 
 EspRequestStart
- : ESPREQUEST EspMetaData ID 
+ : ESPREQUEST EspMetaData ID
  {
     CurEspMessage = new EspMessageInfo($3.getName(), EspMessageInfo::espm_request);
     CurEspMessage->tags = getClearCurMetaTags();
@@ -454,17 +454,17 @@ OptionalExtends
     if (CurEspMessage->getParentName())
         yyerror("parent is already specified by meta extends");
     CurEspMessage->setParentName($2.getName());
- } 
+ }
  |
  ;
 
 EspMessageBody
- : '{' EspPropertyList '}' 
+ : '{' EspPropertyList '}'
  {
     CurParam=NULL;
     LastParam=NULL;
  }
- | '{' '}' 
+ | '{' '}'
  ;
 
 EspPropertyList
@@ -477,20 +477,20 @@ EspPropertyDef
  {
     if (CurParam)
     {
-        if (CurParam->name && ((CurParam->flags & PF_RETURN)==0)) 
+        if (CurParam->name && ((CurParam->flags & PF_RETURN)==0))
         {
-            if (CurParam->kind==TK_null) 
+            if (CurParam->kind==TK_null)
             {
                 CurParam->kind = TK_STRUCT;
                 CurParam->typname = CurParam->name;
             }
-            else 
+            else
             {
                 errnum = 9;
                 yyerror("unknown/unexpected ID");
             }
         }
-    
+
         CurParam->flags |= PF_TEMPLATE;
         CurParam->templ = strdup($2.getName());
         CurParam->name = strdup($6.getName());
@@ -498,26 +498,26 @@ EspPropertyDef
     }
     else
         CurMetaTags=NULL;
-    AddEspProperty(); 
+    AddEspProperty();
  }
  | EspTemplateStart ESPTEMPLATE '<' EspTemplateParams ',' ID '>' ID EspPropertyInit ';'
  {
     if (CurParam)
     {
-        if (CurParam->name && ((CurParam->flags & PF_RETURN)==0)) 
+        if (CurParam->name && ((CurParam->flags & PF_RETURN)==0))
         {
-            if (CurParam->kind==TK_null) 
+            if (CurParam->kind==TK_null)
             {
                 CurParam->kind = TK_STRUCT;
                 CurParam->typname = CurParam->name;
             }
-            else 
+            else
             {
                 errnum = 21;
                 yyerror("invalid type declaration in template");
             }
         }
-    
+
         CurParam->flags |= PF_TEMPLATE;
         CurParam->templ = strdup($2.getName());
         CurParam->name = strdup($8.getName());
@@ -528,7 +528,7 @@ EspPropertyDef
     }
     else
         CurMetaTags=NULL;
-    AddEspProperty(); 
+    AddEspProperty();
  }
  | EspTemplateStart ESPTEMPLATE '<' EspType ID '>' ID ';'
  {
@@ -543,7 +543,7 @@ EspPropertyDef
     }
     else
         CurMetaTags=NULL;
-    AddEspProperty(); 
+    AddEspProperty();
  }
  | EspTemplateStart ESPTEMPLATE '<' EspType ID ',' ID '>' ID ';'
  {
@@ -561,7 +561,7 @@ EspPropertyDef
     }
     else
         CurMetaTags=NULL;
-    AddEspProperty(); 
+    AddEspProperty();
  }
  | EspPropertyStart StartParam ESPSTRUCTREF ID ID ';'
  {
@@ -571,7 +571,7 @@ EspPropertyDef
         CurParam->typname=strdup($4.getName());
         CurParam->kind=TK_ESPSTRUCT;
         CurParam->tags = getClearCurMetaTags();
-        AddEspProperty(); 
+        AddEspProperty();
     }
  }
  | EspPropertyStart StartParam ESPENUMREF ID ID OptEspEnumInit ';'
@@ -582,7 +582,7 @@ EspPropertyDef
         CurParam->typname=strdup($4.getName());
         CurParam->kind=TK_ESPENUM;
         CurParam->tags = getClearCurMetaTags();
-        AddEspProperty(); 
+        AddEspProperty();
     }
  }
  | EspPropertyStart Param EspPropertyInit ';'
@@ -596,7 +596,7 @@ EspPropertyDef
                 CurParam->kind=TK_INT;
         }
         CurParam->tags = getClearCurMetaTags();
-        AddEspProperty(); 
+        AddEspProperty();
     }
  }
  ;
@@ -610,7 +610,7 @@ OptEspEnumInit
  {
     AddMetaTag(new MetaTagInfo("default", $2.getString()));
  }
- | 
+ |
  {
  }
  ;
@@ -648,7 +648,7 @@ EspPropertyInit
  {
     AddMetaTag(new MetaTagInfo("default", 0));
  }
- | 
+ |
  {
     //AddMetaTag(new MetaTagInfo("default", 0));
  }
@@ -702,7 +702,7 @@ EspMetaData
 
 EspMetaPropertyList
  : EspMetaProperty
- | EspMetaPropertyList ',' EspMetaProperty 
+ | EspMetaPropertyList ',' EspMetaProperty
  ;
 
 EspMetaProperty
@@ -737,7 +737,7 @@ Module
  }
  ;
 
- 
+
 ModuleStart
  : MODULE ID
  {
@@ -761,7 +761,7 @@ ModuleVersion
    {
         errnum = 5;
         yyerror("version must be in range 0-255");
-   } 
+   }
  }
  | '(' ID ')'
  {
@@ -771,8 +771,8 @@ ModuleVersion
  ;
 
 ModuleBody
- : '{' ProcDefList '}' 
- | '{' '}' 
+ : '{' ProcDefList '}'
+ | '{' '}'
  ;
 
 
@@ -784,7 +784,7 @@ Enumeration
  }
  ;
 
- 
+
 EnumerationStart
  : SCMENUM ID
  {
@@ -795,7 +795,7 @@ EnumerationStart
  ;
 
 EnumerationBody
- : '{' EnumDefList '}' 
+ : '{' EnumDefList '}'
  ;
 
 
@@ -817,18 +817,18 @@ EnumDefList
    {
      LastEnumVal->next = CurEnumVal;
      LastEnumVal = CurEnumVal;
-   } 
+   }
  }
  ;
 
 EnumDef
- : ID '=' INTEGER_CONST 
+ : ID '=' INTEGER_CONST
  {
     EnumValue = $3.getInt();
     CurEnumVal = new EnumValInfo($1.getName(),EnumValue);
     EnumValue++;
  }
- | ID '=' '-' INTEGER_CONST 
+ | ID '=' '-' INTEGER_CONST
  {
     EnumValue = - $3.getInt();
     CurEnumVal = new EnumValInfo($1.getName(),EnumValue);
@@ -921,7 +921,7 @@ ProcDefList
    {
      LastProc->next = CurProc;
      LastProc = CurProc;
-   } 
+   }
  }
  ;
 
@@ -943,9 +943,9 @@ ProcAttr
 ProcAttrList
  : ProcAttr ProcAttrList
  |
- ;  
+ ;
+
 
-  
 RetParam
  : StartRetParam TypeModifiers TypeList
  {
@@ -994,7 +994,7 @@ TypeModifiers
  : TypeModifier TypeModifiers
  |
  ;
-    
+
 TypeModifier
  : InOut
  | String
@@ -1003,7 +1003,7 @@ TypeModifier
  ;
 
 
-                                
+
 Layout
  : LAYOUT '(' LayoutParams ')'
  {
@@ -1057,7 +1057,7 @@ LayoutSizeVal
  ;
 
 StartLayout
- : 
+ :
  {
    CurLayout = new LayoutInfo;
  }
@@ -1136,13 +1136,13 @@ Type
  {
    switch(CurParam->kind)
    {
-     case TK_UNSIGNED:  
-       CurParam->kind = TK_UNSIGNEDCHAR; 
+     case TK_UNSIGNED:
+       CurParam->kind = TK_UNSIGNEDCHAR;
        break;
      case TK_null:
-       CurParam->kind = TK_CHAR; 
+       CurParam->kind = TK_CHAR;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1154,9 +1154,9 @@ Type
    switch(CurParam->kind)
    {
      case TK_null:
-       CurParam->kind = TK_BYTE; 
+       CurParam->kind = TK_BYTE;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1168,9 +1168,9 @@ Type
    switch(CurParam->kind)
    {
      case TK_null:
-       CurParam->kind = TK_BOOL; 
+       CurParam->kind = TK_BOOL;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1181,13 +1181,13 @@ Type
  {
    switch(CurParam->kind)
    {
-     case TK_UNSIGNED:  
-       CurParam->kind = TK_UNSIGNEDSHORT; 
+     case TK_UNSIGNED:
+       CurParam->kind = TK_UNSIGNEDSHORT;
        break;
      case TK_null:
-       CurParam->kind = TK_SHORT; 
+       CurParam->kind = TK_SHORT;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1202,18 +1202,18 @@ Type
  {
    switch(CurParam->kind)
    {
-     case TK_UNSIGNED: 
+     case TK_UNSIGNED:
        break;
      case TK_SHORT:
-       CurParam->kind = TK_SHORT; 
+       CurParam->kind = TK_SHORT;
        break;
      case TK_LONG:
        CurParam->kind = TK_LONG;
-       break;   
+       break;
      case TK_null:
-       CurParam->kind = TK_INT; 
+       CurParam->kind = TK_INT;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1225,9 +1225,9 @@ Type
    switch(CurParam->kind)
    {
      case TK_null:
-       CurParam->kind = TK_UNSIGNED; 
+       CurParam->kind = TK_UNSIGNED;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1241,16 +1241,16 @@ Type
      case TK_LONG:
        CurParam->kind = TK_LONGLONG;
        break;
-     case TK_UNSIGNED:  
-       CurParam->kind = TK_UNSIGNEDLONG; 
+     case TK_UNSIGNED:
+       CurParam->kind = TK_UNSIGNEDLONG;
        break;
      case TK_UNSIGNEDLONG:
        CurParam->kind = TK_UNSIGNEDLONGLONG;
        break;
      case TK_null:
-       CurParam->kind = TK_LONG; 
+       CurParam->kind = TK_LONG;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1259,7 +1259,7 @@ Type
  }
  | STAR
  {
-    if (CurParam->flags&(PF_PTR|PF_REF)) 
+    if (CurParam->flags&(PF_PTR|PF_REF))
     {
         errnum = 8;
         yyerror("parameter type not supported");
@@ -1268,10 +1268,10 @@ Type
     {
         CurParam->flags|=PF_PTR;
     }
- }  
+ }
  | UMBERSAND
  {
-    if (CurParam->flags&(PF_REF)) 
+    if (CurParam->flags&(PF_REF))
     {
         errnum = 8;
         yyerror("parameter type not supported");
@@ -1280,7 +1280,7 @@ Type
     {
         CurParam->flags|=PF_REF;
     }
- }  
+ }
  | ESDL_CONST
  {
     CurParam->flags |= PF_CONST;
@@ -1290,9 +1290,9 @@ Type
    switch(CurParam->kind)
    {
      case TK_null:
-       CurParam->kind = TK_DOUBLE; 
+       CurParam->kind = TK_DOUBLE;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1304,9 +1304,9 @@ Type
    switch(CurParam->kind)
    {
      case TK_null:
-       CurParam->kind = TK_FLOAT; 
+       CurParam->kind = TK_FLOAT;
        break;
-     default: 
+     default:
      {
        errnum = 7;
        yyerror("invalid type");
@@ -1321,38 +1321,38 @@ Type
  {
    if (rettype)
    {
-     if (!CurParam) 
+     if (!CurParam)
      {
        errnum = 9;
        yyerror("unknown/unexpected ID");
      }
-     else if (CurParam->kind==TK_null) 
+     else if (CurParam->kind==TK_null)
      {
        CurParam->kind = TK_STRUCT;
        CurParam->typname = strdup($1.getName());
-     } 
-     else if ((CurParam->kind==TK_VOID)&&((CurParam->flags&PF_PTR)==0)) 
+     }
+     else if ((CurParam->kind==TK_VOID)&&((CurParam->flags&PF_PTR)==0))
      {
        CurProc->name = strdup($1.getName());
        delete CurParam;
        CurParam = NULL;
      }
-     else 
+     else
      {
        CurParam->flags |= (PF_OUT|PF_RETURN);
        check_param();
-     } 
+     }
    }
    if (CurParam)
    {
-     if (CurParam->name && ((CurParam->flags&PF_RETURN)==0)) 
+     if (CurParam->name && ((CurParam->flags&PF_RETURN)==0))
      {
-       if (CurParam->kind==TK_null) 
+       if (CurParam->kind==TK_null)
        {
          CurParam->kind = TK_STRUCT;
          CurParam->typname = CurParam->name;
        }
-       else 
+       else
        {
          errnum = 9;
          yyerror("unknown/unexpected ID");
@@ -1360,7 +1360,7 @@ Type
      }
      CurParam->name = strdup($1.getName());
    }
- }  
+ }
 // | ESPTEMPLATE
  ;
 
@@ -1379,7 +1379,7 @@ Virtual
    if (CurProc->virt==0)
       CurProc->virt = 1;
  }
- ; 
+ ;
 
 Abstract
  : '=' INTEGER_CONST
@@ -1390,7 +1390,7 @@ Abstract
    {
      errnum = 10;
      yyerror("abstract not allowed on non-virtual");
-   } 
+   }
  }
  |
  ;
@@ -1414,7 +1414,7 @@ Async
  : ASYNC
  {
    CurProc->async = 1;
- } 
+ }
  ;
 
 Timeout
@@ -1436,7 +1436,7 @@ string_const
      memcpy(s+len1, $2.getString(), len2+1);
      $$.setVal(s);
  }
- ; 
+ ;
 
 /************************  END OF RULES  **********************/
 
@@ -1546,19 +1546,19 @@ MetaTagInfo* getClearCurMetaTags()
     {
         // alias
         if (streq("deprecated_ver",t->getName()))
-            t->setName("depr_ver"); 
+            t->setName("depr_ver");
 
-        if (tagNames.find(t->getName())!= tagNames.end()) 
+        if (tagNames.find(t->getName())!= tagNames.end())
         {
             VStrBuffer msg("Attribute '%s' are declared more than once", t->getName());
             yyerror(msg.str());
         }
-        else 
-        {           
+        else
+        {
             if ( (streq("depr_ver",t->getName()) && tagNames.find("max_ver")!=tagNames.end())
               || (streq("max_ver",t->getName()) && tagNames.find("depr_ver")!=tagNames.end()) )
                 yyerror("max_ver and depr_ver can not be used together");
-                
+
             tagNames.insert(t->getName());
         }
     }
@@ -1583,7 +1583,7 @@ void AddEnum()
 
 extern char *yytext;
 void yyerror(const char *s)
-{ 
+{
     if (!errnum)
       errnum = 99;
     if (yytext[0] == '\n')
@@ -1591,8 +1591,8 @@ void yyerror(const char *s)
       yytext = (char*)strdup("EOL");
     }
     // the following error format work with Visual Studio double click.
-    printf("%s(%d) : syntax error H%d : %s near \"%s\"\n",hcp->filename, linenum, errnum, s, yytext); 
-    outf("*** %s(%d) syntax error H%d : %s near \"%s\"\n",hcp->filename, linenum, errnum, s, yytext); 
+    printf("%s(%d) : syntax error H%d : %s near \"%s\"\n",hcp->filename, linenum, errnum, s, yytext);
+    outf("*** %s(%d) syntax error H%d : %s near \"%s\"\n",hcp->filename, linenum, errnum, s, yytext);
     errnum = 0;
 }
 
@@ -1600,17 +1600,17 @@ void check_param(void)
 {
     if ((CurParam->flags&PF_PTR)&&(CurParam->kind==TK_CHAR))
         CurParam->flags |= PF_STRING;
-    if ((CurProc->async)&&(CurParam->flags&(PF_OUT|PF_RETURN))) 
+    if ((CurProc->async)&&(CurParam->flags&(PF_OUT|PF_RETURN)))
     {
         errnum = 1;
         yyerror("out parameters not allowed on async procedure");
     }
-    if ((CurParam->flags&(PF_CONST&PF_OUT))==(PF_CONST|PF_OUT)) 
+    if ((CurParam->flags&(PF_CONST&PF_OUT))==(PF_CONST|PF_OUT))
     {
         errnum = 2;
         yyerror("const not allowed on out parameter");
     }
-    switch (CurParam->flags&(PF_IN|PF_OUT|PF_STRING|PF_VARSIZE|PF_PTR|PF_REF|PF_RETURN)) 
+    switch (CurParam->flags&(PF_IN|PF_OUT|PF_STRING|PF_VARSIZE|PF_PTR|PF_REF|PF_RETURN))
     {
         case PF_IN:                                 // int T
         case (PF_IN|PF_REF):                        // in T&
@@ -1622,11 +1622,11 @@ void check_param(void)
         case (PF_OUT|PF_PTR|PF_REF|PF_VARSIZE):     // inout size() T*&
         case (PF_IN|PF_PTR|PF_STRING):              // in string const char *
         case (PF_OUT|PF_PTR|PF_REF|PF_STRING):      // out string char *&
-        case (PF_OUT|PF_RETURN):                    // return simple    
+        case (PF_OUT|PF_RETURN):                    // return simple
         case (PF_OUT|PF_PTR|PF_VARSIZE|PF_RETURN):  // return size() T*
         case (PF_OUT|PF_PTR|PF_STRING|PF_RETURN):   // return out string char *
             break;
-        case (PF_OUT|PF_PTR|PF_RETURN):                 // return T*    
+        case (PF_OUT|PF_PTR|PF_RETURN):                 // return T*
         case (PF_OUT|PF_REF|PF_RETURN):                 // return T&
                 break;
         default:

+ 25 - 25
tools/esdl/esdllex.l

@@ -5,7 +5,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "esdlcomp.h"
-#include "esdlgram.h"           
+#include "esdlgram.h"
 
 extern YYSTYPE yylval;
 extern unsigned linenum;
@@ -104,45 +104,45 @@ xsdHexBinary                {yylval.setName((const char *) yytext); if (check_re
 xsdBinary                   {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdQName                        {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdNOTATION                 {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
-xsdToken                        {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;} 
+xsdToken                        {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdLanguage                 {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
-xsdNMTOKEN                  {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;} 
+xsdNMTOKEN                  {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdNMTOKENS                 {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdName                     {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdNCName                   {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdID                           {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
-xsdIDREF                        {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;} 
+xsdIDREF                        {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdIDREFS                   {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdENTITY                   {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 xsdENTITIES                 {yylval.setName((const char *) yytext); if (check_return(XSDTYPE)) return XSDTYPE;}
 
-(true|TRUE|Yes) { 
+(true|TRUE|Yes) {
     if (check_return( BOOL_CONST ))
     {
         yylval.setVal(1);
-        return BOOL_CONST; 
+        return BOOL_CONST;
     }
 }
 
 (false|FALSE|No) {
-    if (check_return( BOOL_CONST )) 
+    if (check_return( BOOL_CONST ))
     {
         yylval.setVal(0);
-        return BOOL_CONST; 
+        return BOOL_CONST;
     }
 }
 
-L?\"([^"\\\n]|{esc})*\" { 
+L?\"([^"\\\n]|{esc})*\" {
     if (check_return( STRING_CONST ))
     {
         char *sval = (char *) malloc(yyleng+1);
-        
+
         char *thestr=(char*)yytext;
         strncpy(sval, (char *)yytext, yyleng);
         sval[yyleng]=0;
         yylval.setVal(sval);
-        
-        return STRING_CONST; 
+
+        return STRING_CONST;
     }
 }
 
@@ -151,16 +151,16 @@ L?\"([^"\\\n]|{esc})*\" {
                 if (check_return(INTEGER_CONST)) return INTEGER_CONST;
                 }
 
-{digit}+    { yylval.setVal(atoi ((const char *)yytext)); 
-              if (check_return(INTEGER_CONST)) return INTEGER_CONST; 
+{digit}+    { yylval.setVal(atoi ((const char *)yytext));
+              if (check_return(INTEGER_CONST)) return INTEGER_CONST;
             }
 
-{digit}+\.{digit}+((e|E)("+"|"-")?{digit}+)? { yylval.setVal(atof((const char *)yytext)); 
-              if (check_return(DOUBLE_CONST)) return DOUBLE_CONST; 
+{digit}+\.{digit}+((e|E)("+"|"-")?{digit}+)? { yylval.setVal(atof((const char *)yytext));
+              if (check_return(DOUBLE_CONST)) return DOUBLE_CONST;
             }
 
-\.{digit}+((e|E)("+"|"-")?{digit}+)? { yylval.setVal(atof((const char *)yytext)); 
-              if (check_return(DOUBLE_CONST)) return DOUBLE_CONST; 
+\.{digit}+((e|E)("+"|"-")?{digit}+)? { yylval.setVal(atof((const char *)yytext));
+              if (check_return(DOUBLE_CONST)) return DOUBLE_CONST;
             }
 
 
@@ -183,10 +183,10 @@ L?\"([^"\\\n]|{esc})*\" {
 <COMMENT>\n         { linenum++;  }
 <COMMENT>"*"        { }
 
-"*/"                { yyerror("No comment has started; \"*/\" is illegal"); }                   
+"*/"                { yyerror("No comment has started; \"*/\" is illegal"); }
 
 
-.           { if (check_return(yytext[0])) return yytext[0]; 
+.           { if (check_return(yytext[0])) return yytext[0];
             }
 
 %%
@@ -195,7 +195,7 @@ L?\"([^"\\\n]|{esc})*\" {
 
 bool check_return(int a)
 {
-    if (state==LSskip) 
+    if (state==LSskip)
    {
       if (true)
       {
@@ -245,20 +245,20 @@ bool check_return(int a)
             }
         }
     }
-    else if (state==LSclarion) 
+    else if (state==LSclarion)
    {
         if (a == SCMEND)
         {
             state = LSskip;
-        } 
-        else 
+        }
+        else
             output_text();
         return false;
     }
     if (a == '{')
     {
         opencurly++;
-        if (state==LSsectionheader) 
+        if (state==LSsectionheader)
             state = LSsectionbody;
     }
     else if (a == '}')

+ 4 - 4
tools/esdl/main.cpp

@@ -54,7 +54,7 @@ void parseCommandLine(int argc, char* argv[])
             if (stricmp(argv[i], "-?")==0 || stricmp(argv[i], "-h")==0)
                 usage(argv[0]);
 
-            else 
+            else
             {
                 printf("Unknown option: %s\n", argv[i]);
                 exit(1);
@@ -65,7 +65,7 @@ void parseCommandLine(int argc, char* argv[])
     }
     gArgv[gArgc] = NULL;
 
-    if (gArgc<2 || gArgc>4) 
+    if (gArgc<2 || gArgc>4)
         usage(argv[0]);
 }
 
@@ -75,10 +75,10 @@ void parseCommandLine(int argc, char* argv[])
 int main(int argc, char* argv[])
 {
     parseCommandLine(argc, argv);
-    
+
     char* sourcefile = gArgv[1];
     char* outdir = (gArgc>=3)?(char*)gArgv[2]:(char*)"";
-    
+
     ESDLcompiler hc(sourcefile, outdir);
     hc.Process();
 

+ 2 - 2
esp/esdl/sourcedoc.xml

@@ -18,9 +18,9 @@
 -->
 <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
 <section>
-    <title>esp/esdl</title>
+    <title>tools/esdl-xml</title>
 
     <para>
-        The esp/esdl directory contains the sources for the esp/esdl library.
+        This tool is created in HPCCPlatform, but not distributed in any CE package.
     </para>
 </section>