reverting back to xdc-C06
diff --git a/src/packages/xdc/cfg/Program.xdc b/src/packages/xdc/cfg/Program.xdc
index e695073..c7fb818 100644
--- a/src/packages/xdc/cfg/Program.xdc
+++ b/src/packages/xdc/cfg/Program.xdc
@@ -372,9 +372,8 @@
/*!
* ======== memoryExclude ========
- * @_nodoc
* Exclude memory definitions from linker command file generation
- *
+ * @_nodoc
* This parameter accepts boolean values. If true, it disables default
* memory definitions from being added to the generated linker command
* file.
@@ -382,9 +381,6 @@
* This allows the user to define a custom memory map in a separate file
* and add it to the linker's command line.
*
- * The parameter was meant to be used only in certain generic platforms,
- * but for now these platforms are not used.
- *
* @see #sectionsTemplate, #sectionsExclude, #linkTemplate
*/
config Bool memoryExclude = false;
diff --git a/src/packages/xdc/productview/ProductView.xs b/src/packages/xdc/productview/ProductView.xs
index d586a05..90fa5ab 100644
--- a/src/packages/xdc/productview/ProductView.xs
+++ b/src/packages/xdc/productview/ProductView.xs
@@ -1,13 +1,13 @@
/* --COPYRIGHT--,EPL
- * Copyright (c) 2008-2016 Texas Instruments Incorporated
+ * Copyright (c) 2008 Texas Instruments and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Texas Instruments - initial implementation
- *
+ *
* --/COPYRIGHT--*/
var ProdQuery;
@@ -46,7 +46,7 @@
this.xdc_runtime_Defaults.elemName = "Defaults";
this.xdc_runtime_Defaults.moduleName = "xdc.runtime.Defaults";
this.xdc_runtime_Defaults.iconFileName = "icons/prj.ico";
-
+
this.xdc_runtime_System.elemName = "System";
this.xdc_runtime_System.moduleName = "xdc.runtime.System";
this.xdc_runtime_System.iconFileName = "icons/sys.ico";
@@ -74,7 +74,7 @@
this.xdc_runtime_Log.elemName = "Log";
this.xdc_runtime_Log.moduleName = "xdc.runtime.Log";
this.xdc_runtime_Log.iconFileName = "icons/log.ico";
-
+
this.xdc_runtime_Assert.elemName = "Assert";
this.xdc_runtime_Assert.moduleName = "xdc.runtime.Assert";
this.xdc_runtime_Assert.iconFileName = "icons/err.ico";
@@ -185,13 +185,13 @@
/* Groups */
- /*
+ /*
* System
- *
+ *
* we add the platform element here rather than in
* getProductDescriptor() because all XDCscript array assignments
- * COPY descriptors and adding to the middle of an array is
- * painful in XDCscript. So we first crate a JavaScript array,
+ * COPY descriptors and adding to the middle of an array is
+ * painful in XDCscript. So we first crate a JavaScript array,
* dynamically modify it as necessary and, as a last step, assign
* to the XDCscript map.
*/
@@ -206,20 +206,19 @@
];
/* add the platform module (if it has a Platform.xml description) */
- if (typeof Program != "undefined" && Program.platform != null
- && Program.platform.$module != null) {
+ if (Program.platform != null && Program.platform.$module != null) {
var file = Program.platform.$module.$package.packageBase
- + "/Platform.xml";
+ + "/Platform.xml";
if (java.io.File(file).exists()) {
- var IProductView = xdc.module("xdc.tools.IProductView");
- var pd = new IProductView.ProductElemDesc();
- pd.elemName = "Platform";
- pd.moduleName = Program.platform.$module.$name;
- pd.iconFileName = "icons/mem.ico";
+ var IProductView = xdc.module("xdc.tools.IProductView");
+ var pd = new IProductView.ProductElemDesc();
+ pd.elemName = "Platform";
+ pd.moduleName = Program.platform.$module.$name;
+ pd.iconFileName = "icons/mem.ico";
- /* insert Platform immediatly after Program */
- elemArray.splice(1, 0, pd);
- }
+ /* insert Platform immediatly after Program */
+ elemArray.splice(1, 0, pd);
+ }
}
this.systemGroup.elemName = "System";
this.systemGroup.moduleName = null;
@@ -231,14 +230,14 @@
this.diagnosticsGroup.moduleName = null;
this.diagnosticsGroup.iconFileName = "icons/sdb.ico";
this.diagnosticsGroup.elemArray = [
- this.xdc_runtime_Log,
+ this.xdc_runtime_Log,
this.loggersGroup,
this.xdc_runtime_Diags,
this.xdc_runtime_Assert,
this.xdc_runtime_Error,
this.xdc_runtime_Text,
this.xdc_runtime_Timestamp,
- this.timestampProvidersGroup
+ this.timestampProvidersGroup
];
/* Memory Management */
@@ -268,7 +267,7 @@
this.diagnosticsGroup,
this.memoryGroup,
this.synchronizationGroup
- ];
+ ];
}
/*
diff --git a/src/packages/xdc/rov/StringReader.java b/src/packages/xdc/rov/StringReader.java
index 495e24b..45d81ae 100644
--- a/src/packages/xdc/rov/StringReader.java
+++ b/src/packages/xdc/rov/StringReader.java
@@ -27,17 +27,21 @@
/*
* ======== findString ========
- * Retrieves a string from the given address, reading until it reaches a
- * null char or until it has read 'maxChars'.
+ * Retrieves a string from the given address, reading until it reaches a null
+ * char or until it has read 'maxChars'.
+ * StructureDecoder.nChars controls how many characters are read at a time. It
+ * would be an optimization to make nChars greater than 1, but currently the
+ * implementation does not support this--it would need to handle the case
+ * where a string is at the end of a data section, and the read goes past the
+ * end of the data section due to nChar.
*/
- public String findString(long addr, boolean addrCheck)
- {
+ public String findString(long addr, boolean addrCheck) {
/* String to return. */
String res = "";
/*
- * Read characters, nChars at a time, until we reach a null character
- * or maxChars.
+ * Read characters, nChars at a time, until we reach a null character or
+ * maxChars.
*/
for (long a = addr; a < addr + maxChars; a += nChars) {
@@ -79,8 +83,7 @@
* (non-Javadoc)
* @see xdc.rta.IOFReader#parse(java.lang.String)
*/
- public String parse(String arg0) throws IOException
- {
+ public String parse(String arg0) throws IOException {
return null;
}
@@ -89,12 +92,10 @@
* (non-Javadoc)
* @see xdc.rta.IOFReader#close()
*/
- public void close() throws IOException
- {
+ public void close() throws IOException {
}
- public static IOFReader getOFReaderByName(String className)
- throws Exception
+ public static IOFReader getOFReaderByName(String className) throws Exception
{
Class c = Class.forName(className);
return ((IOFReader) c.newInstance());
diff --git a/src/packages/xdc/runtime/Assert.c b/src/packages/xdc/runtime/Assert.c
index db3fb5e..648021b 100644
--- a/src/packages/xdc/runtime/Assert.c
+++ b/src/packages/xdc/runtime/Assert.c
@@ -28,7 +28,7 @@
Void Assert_raise(Types_ModuleId mod, CString file, Int line, Assert_Id id)
{
String sep = id ? ": " : "";
- CString msg = (id && Text_isLoaded) ?
+ String msg = (id && Text_isLoaded) ?
Text_ropeText((Text_RopeId)(id >> 16)) : "";
Error_raiseX(NULL, mod, file, line,
diff --git a/src/packages/xdc/runtime/Core-mem.c b/src/packages/xdc/runtime/Core-mem.c
index 5e45b78..1bf8bcc 100644
--- a/src/packages/xdc/runtime/Core-mem.c
+++ b/src/packages/xdc/runtime/Core-mem.c
@@ -1,5 +1,5 @@
/* --COPYRIGHT--,ESD
- * Copyright (c) 2008-2016 Texas Instruments Incorporated
+ * Copyright (c) 2008 Texas Instruments. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License
* v. 1.0 which accompanies this distribution. The Eclipse Public License is
@@ -29,7 +29,8 @@
* ======== Core_createObject ========
* Initialize instance object and instance creation parameter structure
*
- * This function is called for created instance objects and is responsible for:
+ * This function is called for both created and constructed instance
+ * objects and is responsible for:
* 1. allocating instance object memory (if necessary)
* 2. initializing the instance object fields (name and functions) and
* all other fields to 0
@@ -55,6 +56,8 @@
* Input parameters:
* od - pointer to a config generated object "descriptor"
* structure (in cfg/.c)
+ * curObj - pointer to object to initialize (NULL if create, non-NULL
+ * for construct: &pkg_Mod_Struct)
* argPrms - pointer to a client initialized pkg_Mod_Params structure
* argPrmsSize - sizeof(module Params structure)
*
@@ -62,15 +65,17 @@
* resPrms - pointer to an uninitialized pkg_Mod_Params structure to
* be initialized based on argPrms
*/
-Ptr Core_createObject(const Core_ObjDesc *od, Ptr resPrms,
- //490928 CPtr argPrms, Error_Block *eb)
- CPtr argPrms, Error_Block *eb)
+Ptr Core_createObject(const Core_ObjDesc *od, Ptr curObj, Ptr resPrms,
+ //490928 CPtr argPrms, SizeT argPrmsSize, Error_Block *eb)
+ const Ptr argPrms, SizeT argPrmsSize, Error_Block *eb)
{
Types_InstHdr *instHdr;
Types_PrmsHdr *prmsHdr;
- Ptr resObj;
IInstance_Params *instPrms;
IArg gateKey;
+ SizeT osz;
+
+ Ptr resObj = curObj;
/* initialize resPrms with the values from Mod_Object__PARAMS__C */
memcpy(resPrms, od->prmsInit, od->prmsSize);
@@ -88,21 +93,31 @@
instPrms = prmsHdr->instPrms;
- /* create object and add to list of dynamically created instances */
- instHdr = Memory_calloc(od->objHeap, od->objSize, od->objAlign, eb);
- if (!instHdr) {
- return (NULL);
+ if (curObj == NULL) {
+
+ /* create object and add to list of dynamically created instances */
+ instHdr = Memory_calloc(od->objHeap, od->objSize, od->objAlign, eb);
+ if (!instHdr) {
+ return (NULL);
+ }
+
+ resObj = instHdr + 1;
+
+ /* atomically insert instance on list of all runtime instances */
+ gateKey = Gate_enterSystem();
+ instHdr->link.next = od->modLink;
+ instHdr->link.prev = od->modLink->prev;
+ od->modLink->prev->next = &instHdr->link;
+ od->modLink->prev = &instHdr->link;
+ Gate_leaveSystem(gateKey);
}
-
- resObj = instHdr + 1;
-
- /* atomically insert instance on list of all runtime instances */
- gateKey = Gate_enterSystem();
- instHdr->link.next = od->modLink;
- instHdr->link.prev = od->modLink->prev;
- od->modLink->prev->next = &instHdr->link;
- od->modLink->prev = &instHdr->link;
- Gate_leaveSystem(gateKey);
+ else {
+ /* We need to ensure that the constructed object is zeroed to be
+ * consistent with created objects for which we call calloc.
+ */
+ osz = od->objSize - sizeof(Types_InstHdr);
+ memset(resObj, 0, osz);
+ }
/* initialize fxns (if the field is present) */
if (od->fxnTab != (Ptr)-1) {
@@ -111,48 +126,7 @@
/* initialize instance name (if this module supports named instances) */
if (od->objName) {
- *((CPtr *)((Char *)resObj + od->objName)) = instPrms->name;
- }
-
- return (resObj);
-}
-
-/*
- * ======== Core_allocObject ========
- * Allocate space for instance object and add it to the list of instances
- *
- * Input parameters:
- * od - pointer to a config generated object "descriptor"
- * structure (in cfg/.c)
- *
- * Output parameters:
- * resObj - pointer to an uninitialized instance
- */
-Ptr Core_allocObject(const Core_ObjDesc *od, Error_Block *eb)
-{
- Types_InstHdr *instHdr;
- Ptr resObj;
- IArg gateKey;
-
- /* create object and add to list of dynamically created instances */
- instHdr = Memory_calloc(od->objHeap, od->objSize, od->objAlign, eb);
- if (!instHdr) {
- return (NULL);
- }
-
- resObj = instHdr + 1;
-
- /* atomically insert instance on list of all runtime instances */
- gateKey = Gate_enterSystem();
- instHdr->link.next = od->modLink;
- instHdr->link.prev = od->modLink->prev;
- od->modLink->prev->next = &instHdr->link;
- od->modLink->prev = &instHdr->link;
- Gate_leaveSystem(gateKey);
-
- /* initialize fxns (if the field is present) */
- if (od->fxnTab != (Ptr)-1) {
- *((CPtr *)resObj) = od->fxnTab;
+ *((Ptr *)((Char *)resObj + od->objName)) = instPrms->name;
}
return (resObj);
@@ -202,31 +176,3 @@
Memory_free(od->objHeap, instHdr, od->objSize);
}
}
-
-/*
- * ======== Core_delistObject ========
- */
-Void Core_delistObject(const Core_ObjDesc *od, Ptr curObj)
-{
- Types_InstHdr *instHdr;
- IArg gateKey;
-
- if (curObj == NULL) {
- return; /* silently ignore NULL object references */
- }
-
- instHdr = ((Types_InstHdr *)curObj) - 1;
-
- gateKey = Gate_enterSystem();
- instHdr->link.prev->next = instHdr->link.next;
- instHdr->link.next->prev = instHdr->link.prev;
-
- /* Zeroing pointers in instHdr, so that anyone pointing at this
- * instance can notice that the instance is invalid (CQ10402).
- */
- instHdr->link.prev = NULL;
- instHdr->link.next = NULL;
- Gate_leaveSystem(gateKey);
-
- Memory_free(od->objHeap, instHdr, od->objSize);
-}
diff --git a/src/packages/xdc/runtime/Core-smem.c b/src/packages/xdc/runtime/Core-smem.c
index afb5161..d7bff56 100644
--- a/src/packages/xdc/runtime/Core-smem.c
+++ b/src/packages/xdc/runtime/Core-smem.c
@@ -48,14 +48,15 @@
* curObj - pointer to object to initialize (must be non-NULL
* for construct: &pkg_Mod_Struct)
* argPrms - pointer to a client initialized pkg_Mod_Params structure
+ * argPrmsSize - sizeof(module Params structure)
*
* Output parameters:
* resPrms - pointer to an uninitialized pkg_Mod_Params structure to
* be initialized based on argPrms
*/
Ptr Core_constructObject(const Core_ObjDesc *od, Ptr curObj, Ptr resPrms,
- //490928 CPtr argPrms, Error_Block *eb)
- CPtr argPrms, Error_Block *eb)
+ //490928 CPtr argPrms, SizeT argPrmsSize, Error_Block *eb)
+ const Ptr argPrms, SizeT argPrmsSize, Error_Block *eb)
{
Types_PrmsHdr *prmsHdr;
IInstance_Params *instPrms;
@@ -91,7 +92,7 @@
/* initialize instance name (if this module supports named instances) */
if (od->objName) {
- *((CPtr *)((Char *)resObj + od->objName)) = instPrms->name;
+ *((Ptr *)((Char *)resObj + od->objName)) = instPrms->name;
}
return (resObj);
diff --git a/src/packages/xdc/runtime/Core.xdc b/src/packages/xdc/runtime/Core.xdc
index 74641e7..44f4f3d 100644
--- a/src/packages/xdc/runtime/Core.xdc
+++ b/src/packages/xdc/runtime/Core.xdc
@@ -71,12 +71,6 @@
};
/*
- * ======== allocObject ========
- *
- */
- Ptr allocObject(const ObjDesc *od, Error.Block *eb);
-
- /*
* ======== assignLabel ========
* Fill-in a Text Label based on iname and whether instances have names
*
@@ -98,19 +92,19 @@
/*
* ======== createObject ========
- * Code invoked from Mod_create__S() and Proxy_create() functions
+ * Common code for all Mod_create() and Mod_construct()
*/
- Ptr createObject(const ObjDesc *od, Ptr resPrms,
- CPtr argPrms, Error.Block *eb);
- //490928 CPtr argPrms, Error.Block *eb);
+ Ptr createObject(const ObjDesc *od, Ptr curObj, Ptr resPrms,
+ const Ptr argPrms, SizeT argPrmsSize, Error.Block *eb);
+ //490928 CPtr argPrms, SizeT argPrmsSize, Error.Block *eb);
/*
* ======== constructObject ========
* Code for static-only Mod_construct()
*/
Ptr constructObject(const ObjDesc *od, Ptr curObj, Ptr resPrms,
- CPtr argPrms, Error.Block *eb);
- //490928 CPtr argPrms, Error.Block *eb);
+ const Ptr argPrms, SizeT argPrmsSize, Error.Block *eb);
+ //490928 CPtr argPrms, SizeT argPrmsSize, Error.Block *eb);
/*
* ======== deleteObject ========
@@ -120,12 +114,6 @@
Int istat, Bool consFlg);
/*
- * ======== delistObject ========
- * Called from Mod_create() to delist already destructed instances
- */
- Void delistObject(const ObjDesc *od, Ptr curObj);
-
- /*
* ======== destructObject ========
* Code for static-only Mod_destruct()
*/
diff --git a/src/packages/xdc/runtime/Error.c b/src/packages/xdc/runtime/Error.c
index 5a27640..e8cabf7 100644
--- a/src/packages/xdc/runtime/Error.c
+++ b/src/packages/xdc/runtime/Error.c
@@ -1,10 +1,10 @@
/* --COPYRIGHT--,ESD
- * Copyright (c) 2008-2016 Texas Instruments Incorporated
- * This program and the accompanying materials are made available under the
+ * Copyright (c) 2008 Texas Instruments. All rights reserved.
+ * This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License
* v. 1.0 which accompanies this distribution. The Eclipse Public License is
* available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse
- * Distribution License is available at
+ * Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
@@ -30,7 +30,7 @@
*/
Void Error_init(Error_Block *eb)
{
- if (eb && eb != &xdc_runtime_Error_IgnoreBlock) {
+ if (eb) {
memset(eb, 0, sizeof (Error_Block));
}
}
@@ -40,7 +40,6 @@
*/
Bool Error_check(Error_Block *eb)
{
- /* The condition eb->id != 0 rejects Error_IGNORE */
return (Error_policy == Error_UNWIND && eb != NULL && eb->id != 0);
}
@@ -71,7 +70,7 @@
/*
* ======== Error_getMsg ========
*/
-CString Error_getMsg(Error_Block *eb)
+String Error_getMsg(Error_Block *eb)
{
return (eb->msg);
}
@@ -89,7 +88,7 @@
*/
Void Error_print(Error_Block *eb)
{
- if (eb == NULL || eb->unused != 0) {
+ if (eb == NULL) {
return;
}
@@ -109,7 +108,7 @@
/*
* ======== Error_raiseX ========
*/
-Void Error_raiseX(Error_Block *eb, Types_ModuleId mod, CString file,
+Void Error_raiseX(Error_Block *eb, Types_ModuleId mod, CString file,
Int line, Error_Id id, IArg arg1, IArg arg2)
{
Error_policyFxn(eb, mod, file, line, id, arg1, arg2);
@@ -118,38 +117,36 @@
/*
* ======== Error_policyDefault ========
*/
-Void Error_policyDefault(Error_Block *eb, Types_ModuleId mod, CString file,
+Void Error_policyDefault(Error_Block *eb, Types_ModuleId mod, CString file,
Int line, Error_Id id, IArg arg1, IArg arg2)
{
Error_Block defErr;
IArg gateKey;
UInt16 oldCount;
- Bool errorAbort = FALSE;
- if (eb == NULL || eb->unused != 0) {
- errorAbort = (eb == NULL);
+ if (eb == NULL) {
eb = &defErr;
}
/* fill in the error block */
Error_setX(eb, mod, file, line, id, arg1, arg2);
-
- /*
+
+ /*
* Log the error, now that we've retrieved the error message.
*
* We call Log_put here instead of Log_write so that we can log the
- * caller's module id instead of the Error module's id.
+ * caller's module id instead of the Error module's id.
*
* In logging this event, we'll use the Error module's mask and logger. We
* don't have a way to reliably access the caller's diags mask and logger.
* The caller isn't guaranteed to have a mask on the target, even if they
* are performing logging.
*/
- if (Module__LOGDEF && Diags_query(Log_L_error)) {
+ if (Module__LOGDEF && Diags_query(Log_L_error)) {
Log_put8(Log_L_error, mod, (IArg) file, line,
(IArg) eb->msg, arg1, arg2, 0, 0, 0);
}
-
+
/* count nesting level of errors */
gateKey = Gate_enterSystem();
oldCount = module->count;
@@ -161,7 +158,7 @@
(Error_raiseHook)(eb);
}
- if (Error_policy == Error_TERMINATE || errorAbort) {
+ if (Error_policy == Error_TERMINATE || eb == &defErr) {
System_abort("xdc.runtime.Error.raise: terminating execution\n");
}
@@ -174,7 +171,7 @@
/*
* ======== Error_policySpin ========
*/
-Void Error_policySpin(Error_Block *eb, Types_ModuleId mod, CString file,
+Void Error_policySpin(Error_Block *eb, Types_ModuleId mod, CString file,
Int line, Error_Id id, IArg arg1, IArg arg2)
{
for(;;) {
@@ -183,7 +180,7 @@
/*
* ======== Error_setX ========
*/
-Void Error_setX(Error_Block *eb, Types_ModuleId mod, CString file,
+Void Error_setX(Error_Block *eb, Types_ModuleId mod, CString file,
Int line, Error_Id id, IArg arg1, IArg arg2)
{
Error_init(eb);
diff --git a/src/packages/xdc/runtime/Error.xdc b/src/packages/xdc/runtime/Error.xdc
index 4cd495a..e40817b 100644
--- a/src/packages/xdc/runtime/Error.xdc
+++ b/src/packages/xdc/runtime/Error.xdc
@@ -1,5 +1,5 @@
/* --COPYRIGHT--,ESD
- * Copyright (c) 2008-2106 Texas Instruments Incorporated
+ * Copyright (c) 2008 Texas Instruments. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License
* v. 1.0 which accompanies this distribution. The Eclipse Public License is
@@ -136,17 +136,17 @@
* <hr />
* @p
*
- * Example 3: The following C code shows that you may pass a special constant
- * `Error_ABORT` in place of an error block to a function requiring an error
- * block. In this case, if the function raises an error, the program is aborted
- * (via `{@link System#abort xdc_runtime_System_abort()}`), thus execution
+ * Example 3: The following C code shows that you may pass `NULL` to a
+ * function requiring an error block. In this case, if the function
+ * raises an error, the program is aborted (via
+ * `{@link System#abort xdc_runtime_System_abort()}`), thus execution
* control will never return to the caller.
*
* @p(code)
* #include <xdc/runtime/Error.h>
* #include <ti/sysbios/knl/Task.h>
*
- * tsk = Task_create(..., Error_ABORT);
+ * tsk = Task_create(..., NULL);
* ...will never get here if an error was raised in Task_create...
* @p
*
@@ -154,33 +154,10 @@
* <hr />
* @p
*
- * Example 4: The following C code shows that you may pass a special constant
- * `Error_IGNORE` in place of an error block to a function requiring an error
- * block. The purpose of this constant is to avoid allocating an error block on
- * stack in the use case where the caller is not checking the error block after
- * the call returns.
- * In this example, the caller only checks the returned value but not the error
- * block. If the function raises an error, the program will return to the
- * caller, assuming `Error_policy` is set to `{@link #Policy UNWIND}`.
- *
- * @p(code)
- * #include <xdc/runtime/Error.h>
- * #include <ti/sysbios/knl/Task.h>
- *
- * tsk = Task_create(..., Error_IGNORE);
- * if (tsk != NULL) {
- * ...
- * }
- * @p
- *
- * @p(html)
- * <hr />
- * @p
- *
- * Example 5: The following C code shows how to write a function that
+ * Example 4: The following C code shows how to write a function that
* is not part of a module and that takes an error block and raises
* the generic error type provided by the Error module. Note, if the
- * caller passes `Error_ABORT` for the error block or if the error policy is
+ * caller passes `NULL` for the error block or if the error policy is
* `{@link #Policy TERMINATE}`, then the call to
* `{@link #raise Error_raise()}` will call
* `{@link System#abort xdc_runtime_System_abort()}` and never return.
@@ -202,7 +179,6 @@
* @p
*/
@DirectCall
-@Template("./Error.xdt")
module Error {
@@ -264,7 +240,7 @@
* invariant, use the user definable `{@link #Desc Desc.code}` field.
*/
@Encoded typedef Desc Id;
-
+
/*!
* ======== HookFxn ========
* Function called whenever an error is raised
@@ -309,35 +285,12 @@
UInt16 unused; /* for backward compatibility (was code) */
Data data; /* arguments passed to raise() */
Id id; /* id passed to raise() */
- CString msg; /* msg associated with id */
+ String msg; /* msg associated with id */
Types.Site site; /* info about Error_raise call site */
+ IArg xtra[4]; /* future expansion */
};
/*!
- * ======== IGNORE ========
- * Special Error_Block used when the caller does not want to check
- * Error_Block
- *
- * This constant should be used when the caller does not check
- * `Error_Block` after the call returns, but wants the call to return even
- * in the case when an error is raised. `{@link #policy Error_policy}` is
- * still in effect and the application will still terminate when an error
- * is raised if `Error_policy` is not set to
- * `{@link #Policy Error_UNWIND}`.
- */
- const Block IGNORE;
-
- /*!
- * ======== ABORT ========
- * Special Error_Block that terminates the application in case of an error
- *
- * This constant has the same effect as passing `NULL` in place of an
- * `Error_Block`. If an error is raised when `Error_ABORT` is passed, the
- * application terminates regardless of `{@link #policy Error_policy}`.
- */
- const Block ABORT;
-
- /*!
* ======== PolicyFxn ========
* Error policy function signature
*
@@ -374,13 +327,13 @@
* `{@link raiseHook}`, this function is responsible for completely
* handling the error (including calling `{@link #raiseHook raiseHook}`
* with an appropriately initialized `{@link #Block Error_Block}`, if
- * `raiseHook` functionality is required).
+ * `raiseHook` functionality is required).
*
* The default value is a function which, in addition to calling
* `raiseHook` with an initialized `Error_Block` structure, logs the
- * error using this module's logger.
- *
- * Alternately, `{@link #policySpin}`, which simply loops
+ * error using this module's logger.
+ *
+ * Alternately, `{@link #policySpin}`, which simply loops
* infinitely, can be used to minimize target footprint. Note, this
* function does NOT call `raiseHook`.
*/
@@ -468,12 +421,12 @@
* protect against "double faults".
*/
config UInt16 maxDepth = 16;
-
+
/*!
* ======== check ========
* Return TRUE if an error was raised
*
- * @param(eb) pointer to an `Error_Block`, `Error_ABORT` or `Error_IGNORE`
+ * @param(eb) pointer to an `Error_Block` or `NULL`
*
* @a(returns)
* If `eb` is non-`NULL` and `{@link #policy Error.policy} == UNWIND` and
@@ -538,7 +491,7 @@
* @see #raise
* @see #Desc
*/
- CString getMsg(Block *eb);
+ String getMsg(Block *eb);
/*!
* ======== getSite ========
@@ -567,7 +520,7 @@
* @_nodoc
*/
@Macro UInt16 idToCode(Id id);
-
+
/*!
* ======== idToUid ========
* Extract the unique error id associated with an `Error_Id`
@@ -584,11 +537,11 @@
*
* To ensure reliable error detection, clients must call `init` for
* an `Error_Block` prior to any use.
- *
+ *
* If the same Error Block is used multiple times, only the last error
* raised is retained.
*
- * @param(eb) pointer to an `Error_Block`, `Error_ABORT` or `Error_IGNORE`
+ * @param(eb) pointer to an `Error_Block` or `NULL`
*
* If `eb` is `NULL` this function simply returns.
*/
@@ -609,10 +562,9 @@
* site of the `Error_raise()`, and `<err_msg>` is the error message
* rendered with the arguments associated with the error.
*
- * @param(eb) pointer to an `Error_Block`, `Error_ABORT` or `Error_IGNORE`
+ * @param(eb) pointer to an `Error_Block` or `NULL`
*
- * If `eb` is `Error_ABORT` or `Error_IGNORE`, this function simply
- * returns with no output.
+ * If `eb` is `NULL` this function simply returns with no output.
*
* @a(Warning)
* This function is not protected by a gate and, as a result,
@@ -623,7 +575,7 @@
* thread in the system ever calls this method.
*/
Void print(Block *eb);
-
+
/*!
* ======== policyDefault ========
* Default implementation of the policyFxn
@@ -644,8 +596,8 @@
* the `{@link #policyFxn}`. It just loops infinitely.
*
* @a(Warning)
- * This function does not call `{@link #raiseHook}` and never returns to
- * the caller. As a result, ANY error raised by the application will cause
+ * This function does not call `{@link #raiseHook}` and never returns to
+ * the caller. As a result, ANY error raised by the application will cause
* it to indefinitly hang.
*/
Void policySpin(Block *eb, Types.ModuleId mod, CString file, Int line,
@@ -660,26 +612,25 @@
* pointed to by `eb`.
*
* If `Error_raise` is called more than once on an `Error_Block` object,
- * the previous error information is overwritten; only the last error
+ * the previous error information is overwritten; only the last error
* is retained in the `Error_Block` object.
*
* In all cases, any configured `{@link #raiseHook Error.raiseHook}`
* function is called with a non-`NULL` pointer to a fully
* initialized `Error_Block` object.
*
- * @param(eb) pointer to an `Error_Block`, `Error_ABORT` or `Error_IGNORE`
+ * @param(eb) pointer to an `Error_Block` or `NULL`
*
- * If `eb` is `Error_ABORT` or
- * `{@link #policy Error.policy} == TERMINATE`,
+ * If `eb` is `NULL` or `{@link #policy Error.policy} == TERMINATE`,
* this function does not return to the caller; after calling any
* configured `{@link #raiseHook}`, `System_abort` is called with the
* string `"xdc.runtime.Error.raise: terminating execution\n"`.
*
* @param(id) the error to raise
*
- * This pointer identifies the class of error being raised; the error
- * class indicates how to interpret any subsequent arguments passed to
- * `{@link #raise}`.
+ * This pointer identifies the class of error being raised;
+ * the error class indicates how to interpret any subsequent
+ * arguments passed to `{@link #raise}`.
*
* @param(arg1) error's first argument
*
diff --git a/src/packages/xdc/runtime/Error.xdt b/src/packages/xdc/runtime/Error.xdt
deleted file mode 100644
index 333512e..0000000
--- a/src/packages/xdc/runtime/Error.xdt
+++ /dev/null
@@ -1,13 +0,0 @@
-xdc_runtime_Error_Block xdc_runtime_Error_IgnoreBlock = {
- ~0, /* unused */
- {
- {0, 0} /* data */
- },
- 0, /* id */
- 0, /* msg */
- {
- 0, /* mod */
- 0, /* file */
- 0 /* line */
- }
-};
diff --git a/src/packages/xdc/runtime/Error__epilogue.h b/src/packages/xdc/runtime/Error__epilogue.h
index 6f6ad01..827e133 100644
--- a/src/packages/xdc/runtime/Error__epilogue.h
+++ b/src/packages/xdc/runtime/Error__epilogue.h
@@ -34,8 +34,3 @@
*/
#define xdc_runtime_Error_idToUid(id) \
(xdc_UInt16)((id) >> 16)
-
-#define xdc_runtime_Error_ABORT NULL
-
-extern xdc_runtime_Error_Block xdc_runtime_Error_IgnoreBlock;
-#define xdc_runtime_Error_IGNORE (&xdc_runtime_Error_IgnoreBlock)
diff --git a/src/packages/xdc/runtime/IInstance.xdc b/src/packages/xdc/runtime/IInstance.xdc
index 1a70b54..bbb6727 100644
--- a/src/packages/xdc/runtime/IInstance.xdc
+++ b/src/packages/xdc/runtime/IInstance.xdc
@@ -82,5 +82,5 @@
* and methods that normally return an instance's name will return
* `NULL` instead.
*/
- config CString name = null;
+ config String name = null;
}
diff --git a/src/packages/xdc/runtime/IModule.xdc b/src/packages/xdc/runtime/IModule.xdc
index 5b5c7ea..e919953 100644
--- a/src/packages/xdc/runtime/IModule.xdc
+++ b/src/packages/xdc/runtime/IModule.xdc
@@ -139,7 +139,7 @@
* any chance of breaking existing modules.
*/
metaonly config Types.Common$ common$;
-
+
/*!
* ======== viewNameMap$ ========
* Specifies the ROV views for the module.
@@ -219,12 +219,22 @@
/*! @_nodoc */
@System config Types.LoggerFxn1 Module__loggerFxn1 = null;
/*! @_nodoc */
- @System config Types.LoggerFxn2 Module__loggerFxn2 = null;
+ @System config Types.LoggerFxn2 Module__loggerFxn2 = null;
/*! @_nodoc */
@System config Types.LoggerFxn4 Module__loggerFxn4 = null;
/*! @_nodoc */
@System config Types.LoggerFxn8 Module__loggerFxn8 = null;
+ /*! @_nodoc
+ * This parameter is not used, but we keep it for forward compatibility.
+ * If we can ever break the forward compatibility for a release, we
+ * should remove this parameter.
+ *
+ * Once we remove it, header files built with those tools would break
+ * older tools.
+ */
+ @System config Bool (*Module__startupDoneFxn)() = null;
+
/*! @_nodoc */
@System config Int Object__count = 0;
/*! @_nodoc */
@@ -234,7 +244,7 @@
/*! @_nodoc */
@System config Ptr Object__table = null;
- /*!
+ /*!
* ======== Handle__label ========
* Initialize a `Types.Label` from an instance handle
* @_nodoc
@@ -248,28 +258,27 @@
@System Bool Module__startupDone();
/*! @_nodoc
+ * __oa - address of object itself
+ * __osz - size of the object
* __aa - address of "required" create args structure
* __pa - address of instance parameter structure
* __psz - sizeof of parameter structure
* __eb - error block pointer
- *
- * Currently, we keep Object__create and Object__delete because these are
- * the functions used in virtual tables. All Object__create functions have
- * the same signature so we can use SysFxns2 to define a type for virtual
- * tables instead of using a different type for each module. we could
- * delete these two functions.
*/
- //490928 @System Ptr Object__create(CPtr __aa,
- @System Ptr Object__create(CPtr __aa, const UChar *__pa, SizeT __psz,
- Error.Block *__eb);
+ //490928 @System Ptr Object__create(Ptr __oa, SizeT __osz, CPtr __aa,
+ @System Ptr Object__create(Ptr __oa, SizeT __osz, Ptr __aa,
+ const UChar *__pa, SizeT __psz, Error.Block *__eb);
/*! @_nodoc */
@System Void Object__delete(Ptr instp);
/*! @_nodoc */
- @System Ptr Object__get(Ptr oarr, Int i);
+ @System Void Object__destruct(Ptr objp);
- /*!
+ /*! @_nodoc */
+ @System Ptr Object__get(Ptr oarr, Int i);
+
+ /*!
* ======== Object__first ========
* Return the first member of a list of dynamically created instances
* @_nodoc
@@ -284,7 +293,7 @@
*/
@System Ptr Object__first();
- /*!
+ /*!
* ======== Object__next ========
* Return the next instance from the list of dynamically created instances
* @_nodoc
@@ -305,5 +314,5 @@
/*! @_nodoc */
//490928 @System CPtr Proxy__delegate();
- @System CPtr Proxy__delegate();
+ @System Ptr Proxy__delegate();
}
diff --git a/src/packages/xdc/runtime/Log.c b/src/packages/xdc/runtime/Log.c
index ad0e240..8c40f3e 100644
--- a/src/packages/xdc/runtime/Log.c
+++ b/src/packages/xdc/runtime/Log.c
@@ -45,7 +45,7 @@
Void Log_doPrint(Log_EventRec *er)
{
Text_RopeId rope;
- CString fmt;
+ String fmt;
Bits32 hi, lo;
/* print serial number if there is one; 0 isn't a valid serial number */
diff --git a/src/packages/xdc/runtime/Text.c b/src/packages/xdc/runtime/Text.c
index f6df0b4..e8a38c6 100644
--- a/src/packages/xdc/runtime/Text.c
+++ b/src/packages/xdc/runtime/Text.c
@@ -240,7 +240,7 @@
* Internal calls are from visitRope2, and that function is invoked from
* visitRope only when charTab is on the target.
*/
-CString Text_ropeText(Text_RopeId rope)
+String Text_ropeText(Text_RopeId rope)
{
return (rope & 0x8000 ? NULL : Text_charTab + rope);
}
@@ -253,14 +253,14 @@
* The stack array must be large enough to hold the maximum number of
* nodes "in" rope.
*/
-Void Text_visitRope2(Text_RopeId rope, Fxn visFxn, Ptr visState, CString stack[])
+Void Text_visitRope2(Text_RopeId rope, Fxn visFxn, Ptr visState, String stack[])
{
Int tos = 0;
for (;;) {
- const Text_Node *node;
+ Text_Node *node;
UInt16 index;
- CString s = Text_ropeText(rope);
+ String s = Text_ropeText(rope);
if (s) {
stack[tos++] = s;
break;
@@ -272,7 +272,7 @@
}
do {
- CString s = stack[--tos];
+ String s = stack[--tos];
if (((Text_RopeVisitor)visFxn)(visState, s)) {
return;
}
diff --git a/src/packages/xdc/runtime/Text.xdc b/src/packages/xdc/runtime/Text.xdc
index e5bb911..17cf2d9 100644
--- a/src/packages/xdc/runtime/Text.xdc
+++ b/src/packages/xdc/runtime/Text.xdc
@@ -136,7 +136,7 @@
*
* @_nodoc
*/
- CString ropeText(RopeId rope);
+ String ropeText(RopeId rope);
/*!
* ======== matchRope ========
@@ -267,7 +267,7 @@
Types.RopeId right;
};
- typedef Bool (*RopeVisitor)(Ptr, CString);
+ typedef Bool (*RopeVisitor)(Ptr, String);
struct MatchVisState {
CString pat;
@@ -328,10 +328,10 @@
Bool printVisFxn(Ptr p, CString s);
Void visitRope(RopeId rope, Fxn visFxn, Ptr visState);
- Void visitRope2(RopeId rope, Fxn visFxn, Ptr visState, CString stack[]);
+ Void visitRope2(RopeId rope, Fxn visFxn, Ptr visState, String stack[]);
typedef Void (*VisitRopeFxn)(RopeId, Fxn, Ptr);
- typedef Void (*VisitRopeFxn2)(RopeId, Fxn, Ptr, CString[]);
+ typedef Void (*VisitRopeFxn2)(RopeId, Fxn, Ptr, String[]);
config VisitRopeFxn visitRopeFxn = visitRope;
diff --git a/src/packages/xdc/runtime/Text.xdt b/src/packages/xdc/runtime/Text.xdt
index 7758973..3a23549 100644
--- a/src/packages/xdc/runtime/Text.xdt
+++ b/src/packages/xdc/runtime/Text.xdt
@@ -22,7 +22,7 @@
xdc_Fxn visFxn, xdc_Ptr visState)
{
%if (this.isLoaded) {
- xdc_CString stack[`this.$capsule.maxDepth + 1`];
+ xdc_String stack[`this.$capsule.maxDepth + 1`];
xdc_runtime_Text_visitRope2__I(rope, visFxn, visState, stack);
%}
%else {
diff --git a/src/packages/xdc/runtime/Types.xdc b/src/packages/xdc/runtime/Types.xdc
index febaf27..81938bf 100644
--- a/src/packages/xdc/runtime/Types.xdc
+++ b/src/packages/xdc/runtime/Types.xdc
@@ -546,7 +546,19 @@
* Header for all module vtables
*/
struct Base {
- const Base *base; /* points to inherited interface base */
+ //490928 const Base *base; /* points to inherited interface base */
+ Base *base; /* points to inherited interface base */
+ }
+
+ /*
+ * ======== SysFxns ========
+ * Deprecated. Use SysFxns2 instead
+ */
+ struct SysFxns {
+ Ptr (*__create)(Ptr, SizeT, Ptr, const Ptr, SizeT, Error.Block*);
+ Void (*__delete)(Ptr);
+ Label *(*__label)(Ptr, Label *);
+ ModuleId __mid;
}
/*
@@ -562,13 +574,15 @@
* This function calls Core_createObject().
*
* Params:
+ * Ptr - pointer to inststance object
+ * SizeT - size of instance object
* CPtr - pointer to struct of required create args
* const UChar * - pointer to struct of default create parameters
* SizeT - size of default params structure
* Error_Block * - caller's error block pointer
*/
- Ptr (*__create)(CPtr, const UChar *, SizeT, Error.Block *);
- // 490928 Ptr (*__create)(CPtr, const UChar *, SizeT, Error.Block *);
+ Ptr (*__create)(Ptr, SizeT, Ptr, const UChar *, SizeT, Error.Block *);
+ // 490928 Ptr (*__create)(Ptr, SizeT, CPtr, const UChar *, SizeT, Error.Block *);
Void (*__delete)(Ptr);
Label *(*__label)(Ptr, Label *);
diff --git a/src/packages/xdc/runtime/knl/GateH.xdc b/src/packages/xdc/runtime/knl/GateH.xdc
index 54fdb3d..ab7f90c 100644
--- a/src/packages/xdc/runtime/knl/GateH.xdc
+++ b/src/packages/xdc/runtime/knl/GateH.xdc
@@ -27,7 +27,7 @@
* {@link GateProcess#create}. Then the application can use the generic
* APIs provided by this module.
*
- * The underlying gates are nesting in nature and users have to leave
+ * The underlying gates are nexting in nature and users have to leave
* the gate as many times as they entered it.
*/
@DirectCall
@@ -37,41 +37,10 @@
/*!
* Proxy used for optimization.
*
- * The GateH.Proxy config param my be used to optimize this module. If all
- * the instances supplied to GateH functions are created using the same
- * module (e.g. GateMutex), then setting this Proxy to that module and
- * disabling abstract instances will allow for better run-time
- * optimization.
- *
- * Caution: all instances used by GateH in a given executable must be
- * created by the same module in order to use this optimization technique.
- *
- * Configuration Script
- *
- * @p(code)
- * var GateH = xdc.useModule('xdc.runtime.knl.GateH');
- * GateH.Proxy = xdc.useModule('ti.sysbios.gates.GateMutex');
- * GateH.Proxy.abstractInstances$ = false;
- * @p
- *
- * Target Code
- *
- * @p(code)
- * #include <xdc/runtime/IGateProvider.h>
- * #include <xdc/runtime/knl/GateH.h>
- * #include <ti/sysbios/gates/GateMutex.h>
- *
- * GateMutex_Handle gate;
- * IGateProvider_Handle igate;
- * IArg key;
- *
- * gate = GateMutex_create(NULL, NULL);
- * igate = GateMutex_Handle_upCast(gate);
- *
- * key = GateH_enter(igate);
- * ...
- * GateH_leave(igate, key);
- * @p
+ * If ALL IGateProvider.Handles used by GateH are created using the same
+ * module (e.g GateProcess) then setting this Proxy to GateProcess and
+ * setting GateH.Proxy.abstractInstances$ = false, causes
+ * GateH APIs can have better performance.
*/
proxy Proxy inherits IGateProvider;
diff --git a/src/packages/xdc/services/global/Out.java b/src/packages/xdc/services/global/Out.java
index 478f79a..9821000 100644
--- a/src/packages/xdc/services/global/Out.java
+++ b/src/packages/xdc/services/global/Out.java
@@ -1,13 +1,13 @@
/* --COPYRIGHT--,EPL
- * Copyright (c) 2008-2017 Texas Instruments Incorporated
+ * Copyright (c) 2008 Texas Instruments and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Texas Instruments - initial implementation
- *
+ *
* --/COPYRIGHT--*/
/*
* ======== Out.java ========
@@ -35,7 +35,7 @@
protected int inc = 4;
private String tmpFileName = null;
OutputStream os;
-
+
/*
* ======== Out ========
*/
@@ -61,20 +61,22 @@
throws IOException
{
this.close();
-
+
// System.out.print("comparing "+fileName+" to "+tmpFileName+" ...: ");
-
+
File dst = new File(fileName);
File tmp = new File(tmpFileName);
-
+
/* compare tmpFileName contents to fileName contents and replace
* FileName if the contents differ
*/
if (compare(dst)) {
+ // System.out.println("same");
tmp.delete();
return;
}
-
+ // System.out.println("different");
+
dst.delete();
tmp.renameTo(dst);
}
@@ -93,7 +95,7 @@
if (other.length() != tmp.length()) {
return (false);
}
-
+
/* open both files */
FileInputStream ins1, ins2;
try {
@@ -109,7 +111,7 @@
ins1.close();
return (false);
}
-
+
/* compare byte by byte */
byte [] buf1 = new byte[1024];
byte [] buf2 = new byte[1024];
@@ -124,12 +126,12 @@
}
}
}
-
+
ins1.close();
ins2.close();
return (true);
}
-
+
public OutputStream getOutputStream() { return this.out; }
public void insert( File file )
@@ -157,7 +159,7 @@
public void indent( int n ) { col += inc * n; }
public void outdent( int n ) { col -= inc * n; }
-
+
public void printf( String fmt ) {
doPrint(fmt, "", "", "", "", "");
}
@@ -182,60 +184,10 @@
public void printf( String fmt, Object s0, Object s1, Object s2, Object s3 ) {
doPrint(fmt, s0, s1, s2, s3, "");
}
- public void printf( String fmt, Object s0, Object s1, Object s2, Object s3,
- Object s4) {
+ public void printf( String fmt, Object s0, Object s1, Object s2, Object s3, Object s4) {
doPrint(fmt, s0, s1, s2, s3, s4);
}
- /* All printf* methods support the concept of multiple output files, so
- * we want all users of this class to use these methods. The println methods
- * inherited from PrintStream are disabled.
- */
- public void printfln(String s) {
- this.printf(s + "\n");
- }
-
- @Override
- public void println() {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(String s) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(boolean b) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(char c) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(char[] ca) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(int i) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(long l) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(float f) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(double d) {
- throw new UnsupportedOperationException();
- }
- @Override
- public void println(Object o) {
- throw new UnsupportedOperationException();
- }
-
public void tab()
{
for (int i = 0; i < col; i++) {
diff --git a/src/packages/xdc/services/intern/cmd/Builder.java b/src/packages/xdc/services/intern/cmd/Builder.java
index 81e5d52..1c38631 100644
--- a/src/packages/xdc/services/intern/cmd/Builder.java
+++ b/src/packages/xdc/services/intern/cmd/Builder.java
@@ -1,13 +1,13 @@
/* --COPYRIGHT--,EPL
- * Copyright (c) 2008-2017 Texas Instruments Incorporated
+ * Copyright (c) 2008 Texas Instruments and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Texas Instruments - initial implementation
- *
+ *
* --/COPYRIGHT--*/
/*
* ======== Builder.java ========
@@ -39,9 +39,9 @@
public class Builder
{
- public static final int GREEN_VERS = 200; // spec
- public static final int RED_VERS = 200; // schema
- public static final int BLUE_VERS = 200; // body (target C/C++)
+ public static final int GREEN_VERS = 180; // spec
+ public static final int RED_VERS = 170; // schema
+ public static final int BLUE_VERS = 160; // body
public static final int CYAN_VERS = 150; // cdoc
public static final int FLAG_WARNINGS = 0x1;
@@ -66,7 +66,7 @@
* -s strictly enforce language rules:
* o mustn't remove readonly quality from inherited
* interface
- *
+ *
* -m make_out
* generate a GNU make makefile with the specified
* name containing rules for updating the generated
@@ -141,7 +141,7 @@
}
}
if (specFileName == null) { /* err: specFileName not specified */
- Err.exit(usage);
+ Err.exit(usage);
}
/* generate schema and all target files */
@@ -330,10 +330,10 @@
/*
Invoke xdc.services.intern.gen.Doc().gen.
- with a temporary file output stream.
- This step is required because
+ with a temporary file output stream.
+ This step is required because
the 'gen' method has the side effect
- of populating some fields of the spec. object.
+ of populating some fields of the spec. object.
The temporary file is deleted once the JVM exits.
*/
@@ -362,13 +362,13 @@
Out out = getStream(outName);
/* add package specification to sources */
- out.printfln("package.xdc");
+ out.println("package.xdc");
/* look for optional package implementation of IPackage */
String xs = "package.xs";
if ((new File(xs)).exists()) {
optFiles.add(xs);
- out.printfln(xs);
+ out.println(xs);
}
/* add all unit specs and optional implementation files */
@@ -378,13 +378,13 @@
continue;
}
- out.printfln(unit.getName() + ".xdc");
+ out.println(unit.getName() + ".xdc");
/* look for optional module/interface implementation files */
String src = unit.getName() + ".xs";
if ((new File(src)).exists()) {
optFiles.add(src);
- out.printfln(src);
+ out.println(src);
}
}
@@ -406,13 +406,13 @@
if (src.startsWith("./") || src.startsWith(".\\")) {
src = src.substring(2);
}
- out.printfln(src);
+ out.println(src);
}
}
/* add all generated files */
for (String s : list) {
- out.printfln(s);
+ out.println(s);
}
closeStream(out);
@@ -458,7 +458,7 @@
* g. removal of a generated file triggers regeneration for
* the following goals:
* 1. "all", "all,*", or nothing
- * 2. "release" or any specific release
+ * 2. "release" or any specific release
* 3. the removed file itself
* 4. ".interfaces"
*
@@ -477,9 +477,9 @@
Out out = getStream(outName);
/* output clean rules for all generated files */
- out.printfln("clean::");
+ out.println("clean::");
for (String fileName : genList) {
- out.printfln("\t$(RM) " + fileName);
+ out.println("\t$(RM) " + fileName);
}
out.print("\n");
@@ -546,15 +546,15 @@
/* output special "no rule" rules to force schema to be rebuilt
* in the case that an included .xs file is (re)moved
*/
- out.printfln(fileName + ":");
- out.printfln("package/package.xdc.inc: " + fileName);
+ out.println(fileName + ":");
+ out.println("package/package.xdc.inc: " + fileName);
}
out.print("\n");
/* output deps that trigger schema rebuild if a spec changes */
out.print("# schema update dependencies\n");
for (String fileName : locals) {
- out.printfln("package/package.xdc.inc: " + fileName);
+ out.println("package/package.xdc.inc: " + fileName);
}
List<String> ext = pkg.getOtherSpecs();
@@ -575,16 +575,16 @@
* fileName = pdir + "/package/package.xdc.inc";
* }
*/
- out.printfln("package/package.xdc.inc: " + fileName);
+ out.println("package/package.xdc.inc: " + fileName);
/* output special "no rule" rules to force schema to be
* rebuilt in the case that a schema file *outside* this
* package is moved; e.g., the package path changed.
*/
- out.printfln(fileName + ":");
+ out.println(fileName + ":");
/* set the vpath for this file so that changes to the absolute
* location of the spec do not trigger a rebuild.
*/
- out.printfln("vpath " + fileName + " $(XPKGVPATH)");
+ out.println("vpath " + fileName + " $(XPKGVPATH)");
}
out.print("\n");
@@ -610,9 +610,9 @@
* complaining that it does not know how to build the file.
*/
fname = _escapeFilename(auxDeps[i]);
- out.printfln(fname + ":");
+ out.println(fname + ":");
}
- out.printfln("package/package.xdc.inc: " + fname);
+ out.println("package/package.xdc.inc: " + fname);
}
out.print("endif\n");
@@ -624,8 +624,8 @@
for (String fileName : genList) {
if ((fileName.endsWith(".h") || fileName.endsWith(".c"))
&& !fileName.startsWith("package/package")) {
- out.printfln("package/package.xdc.inc: " + fileName);
- out.printfln(fileName + ":");
+ out.println("package/package.xdc.inc: " + fileName);
+ out.println(fileName + ":");
}
}
out.print("\n");
@@ -689,7 +689,7 @@
{
return getStream(fileName, null);
}
-
+
private static Out getStream(String fileName, Vector list)
{
try {
diff --git a/src/packages/xdc/services/intern/gen/Config.java b/src/packages/xdc/services/intern/gen/Config.java
index a37adea..010c90f 100644
--- a/src/packages/xdc/services/intern/gen/Config.java
+++ b/src/packages/xdc/services/intern/gen/Config.java
@@ -194,7 +194,7 @@
intmap.put(iunit.getQualName(), iunit);
iunit = iunit.getSuper();
}
- }
+ }
/* includes */
glob.genTitle("MODULE INCLUDES");
@@ -202,9 +202,6 @@
genInclude(m);
}
- /* top-level pragmas */
- genPragmas();
-
/* loop over all interfaces in the configuration to see if any of them
* was used but it's not in baseset. If that's the case we have to add
* their includes and add them to baseset, so we can generate their
@@ -678,10 +675,11 @@
*/
private void genCreateSig()
{
- glob.out.printf("%2Ptr %1Object__create__S (", glob.cname, "xdc_");
- glob.out.printf("%+\n%txdc_CPtr __aa,\n%tconst xdc_UChar *"
- + "__paramsPtr,\n%txdc_SizeT __psz,\n%t%1__eb%-)\n{\n%+",
- Glob.ERRBLK);
+ glob.out.printf("%2Ptr %1Object__create__S (%+\n%t%2Ptr __obj, \n"
+ + "%t%2SizeT __osz,", glob.cname, "xdc_");
+ glob.out.printf("\n%tconst xdc_Ptr __aa,\n%tconst %1__ParamsPtr "
+ + "__paramsPtr,\n%txdc_SizeT __psz,\n%t%2__eb%-)\n{\n%+",
+ glob.cname, Glob.ERRBLK);
}
/*
@@ -725,6 +723,27 @@
}
/*
+ * ======== genFixup ========
+ *
+ * XDCtools 3.00 and older tools declared the fourth parameter in
+ * create__S as xdc_Ptr, while the newer tools declare it as xdc_UChar*.
+ * We can remove this function when we don't need to support 3.00 and older
+ * packages, and process their header files.
+ */
+ private void genFixup(Value.Obj mod, Unit u)
+ {
+ String cname = glob.mkCname(u.getQualName());
+
+ glob.genTitleD("__ParamsPtr");
+ /* VERS was defined in 3.05 for the first time. */
+ glob.out.printf("#ifdef %1__VERS\n", cname);
+ glob.out.printf("%+%t#define %1__ParamsPtr xdc_UChar*\n%-", cname);
+ glob.out.printf("#else\n");
+ glob.out.printf("%+%t#define %1__ParamsPtr xdc_Ptr\n%-", cname);
+ glob.out.printf("#endif\n");
+ }
+
+ /*
* ======== genFlds ========
*
* This function goes through the fields of a structure represented by
@@ -1393,6 +1412,18 @@
genModDecls(mod, unit);
if (unit.isInst()) {
genInstDecls(mod, unit);
+ /* When building a separate file for a proxy module, the delegate's
+ * macro for ParamsPtr must be available. An important consequence
+ * of separate files for proxy modules is that delegates cannot be
+ * changed in the application config, if that config is using
+ * already compiled config C files for such modules.
+ */
+ if (fm.isCurrentModule(mod) && unit.isProxy()) {
+ Value.Obj delmod = ((Value.Obj)mod.getv("delegate$")).getOrig();
+ Unit delunit = unitSpec(delmod);
+ genFixup(delmod, delunit);
+ }
+ genFixup(mod, unit);
}
}
@@ -2048,24 +2079,6 @@
/*
* ======== genPragmas ========
- * Top-level pragmas
- */
- void genPragmas()
- {
- /* needed for Klockwork MISA checker (cast away const warning) */
- skip();
- glob.out.printf("/* suppress 'type qualifier is meaningless on cast type' warning */\n");
- glob.out.printf("#ifdef __ti__\n");
- glob.out.printf("#pragma diag_suppress 193\n");
- glob.out.printf("#endif\n");
- glob.out.printf("#ifdef __IAR_SYSTEMS_ICC__\n");
- glob.out.printf("#pragma diag_suppress=Pe191\n");
- glob.out.printf("#endif\n");
- }
-
- /*
- * ======== genPragmas ========
- * Module specific pragmas
*/
void genPragmas( Value.Obj mod, Value.Obj target )
{
@@ -2147,12 +2160,21 @@
boolean oldPackage = false;
ArrayList<String> removable = new ArrayList(
Arrays.asList(new String [] {"Handle__label", "Object__create",
- "Object__delete", "Object__first", "Object__get",
- "Object__next", "Object__init", "Params__init"}));
+ "Object__delete", "Object__first", "Object__destruct",
+ "Object__get", "Object__next", "Object__init",
+ "Params__init"}));
if (!unit.isInst() && unit.getDecl("Object__create") != null) {
oldPackage = true;
}
+ /* modules built before 3.25.00 do not use const for params
+ * so, their Params__init functions have a different signature.
+ * As soon as we no longer need backward compatibility with
+ * versions before 3.25.00, we can remove code "isBeforeConst"
+ * code.
+ */
+ boolean noConst = isBeforeConst(mod);
+
for (Decl.Fxn fxn : unit.getFxns()) {
if (fxn.isMeta() || fxn.attrBool(Attr.A_Macro)) {
continue;
@@ -2183,6 +2205,13 @@
}
String args = bos.toString();
+ if (noConst && fxn.getName().equals("Params__init")) {
+ /* if mod's Params__init uses an "old" non-const signature
+ * we need to remove the const here so we don't have
+ * inconsistent declarations in this file
+ */
+ args = args.replace(" const ", " ");
+ }
if (fxn.attrBool(Attr.A_DirectCall)) {
retTypesLib.add(fxn.getType().tsig());
@@ -2362,39 +2391,72 @@
glob.out.printf("%treturn %1Module__startupDone__S();\n}\n%-", dcname);
if (unit.isInst()) {
- glob.genTitleD("create");
- glob.out.printf("%1Handle %1create(", glob.cname);
- glob.genCreArgDecls(unit, Glob.Type$LCL, " ");
- glob.out.printf("const %1Params *__prms, %2 )\n{\n%+", glob.cname,
- Glob.ERRARG);
- glob.out.printf("%treturn (%1Handle)%2create(", glob.cname, dcname);
- if (unit.hasCreateArgs()) {
- for (Decl.Arg arg : unit.getCreator().getArgs()) {
- glob.out.printf("%1, ", arg.getName());
- }
- }
- glob.out.printf("(const %1Params *)__prms, __eb);\n}\n%-", dcname);
+ glob.genTitleD("Object__create__S");
+ genCreateSig();
+// glob.out.printf("xdc_Ptr %1Object__create__S( xdc_Ptr __obj, xdc_SizeT osz, const xdc_Ptr aa, ", glob.cname);
+// glob.out.printf("const %2__ParamsPtr __paramsPtr, xdc_SizeT sz, %1 eb ) \n{\n%+",
+// Glob.ERRBLK, glob.cname);
+ glob.out.printf("%treturn %1Object__create__S(__obj, __osz, __aa, ", dcname);
+ glob.out.printf("(const %1__ParamsPtr)__paramsPtr, sizeof(%2Params), "
+ + "__eb);\n}\n%-", dcname, icn);
- glob.genTitleD("delete");
- glob.out.printf("void %1delete(%1Handle *instp)\n{\n%+",
- glob.cname);
+ /* Object create() is added instead of static inline only for
+ * modules from packages built with 3.26. Older modules bring in
+ * static inline create() in their headers so if we generate
+ * create() here, it will cause duplicate references. This same
+ * logic also applies to construct(), delete() and destruct().
+ */
+ if (!isBeforeRom(mod)) {
+ glob.genTitleD("create");
+ glob.out.printf("%1Handle %1create(", glob.cname);
+ glob.genCreArgDecls(unit, Glob.Type$LCL, " ");
+ glob.out.printf("const %1Params *__prms, %2 )\n{\n%+",
+ glob.cname, Glob.ERRARG);
+ if (unit.hasCreateArgs()) {
+ glob.out.printf("%t%1Args__create __args;\n", glob.cname);
+ for (Decl.Arg arg : unit.getCreator().getArgs()) {
+ glob.out.printf("%t__args.%1 = %1;\n", arg.getName());
+ }
+ }
+ glob.out.printf("%treturn (%1Handle)%1Object__create__S(0, 0, ",
+ glob.cname);
+ glob.out.printf("%1, ", unit.hasCreateArgs() ? "&__args" : "0");
+ glob.out.printf("(const xdc_UChar*)__prms, sizeof(%1Params),"
+ + " __eb);\n}\n%-", glob.cname);
+ }
+
+ glob.genTitleD("Object__delete__S");
+ glob.out.printf("void %1Object__delete__S( xdc_Ptr instp ) \n{\n%+", glob.cname);
glob.out.printf("%t%1Object__delete__S(instp);\n}\n%-", dcname);
- glob.genTitleD("Params__init__S");
+ if (!isBeforeRom(mod)) {
+ glob.genTitleD("delete");
+ glob.out.printf("void %1delete(%1Handle *instp)\n{\n%+",
+ glob.cname);
+ glob.out.printf("%t%1Object__delete__S(instp);\n}\n%-",
+ glob.cname);
+ }
- String fmt = "void %1Params__init__S( xdc_Ptr dst, const void *src,"
- + " xdc_SizeT psz, xdc_SizeT isz )\n{\n%+";
+ glob.genTitleD("Params__init__S");
+ // Params__init (const xdc_Ptr)
+ /* In xdc-z* we changed the Params__init__S signature to be "const
+ * correct". To maintain compatibility with packages built before
+ * xdc-z*, we need to generate different function definitions
+ */
+ String fmt = "void %1Params__init__S( xdc_Ptr dst, const void *src, xdc_SizeT psz, xdc_SizeT isz )\n{\n%+";
+ if (isBeforeConst(mod)) {
+ fmt = "void %1Params__init__S( xdc_Ptr dst, xdc_Ptr src, xdc_SizeT psz, xdc_SizeT isz )\n{\n%+";
+ }
glob.out.printf(fmt, glob.cname);
String cast = isBeforeConst((Value.Obj)delmod) ? "(void *)" : "";
- glob.out.printf("%t%1Params__init__S(dst, %2src, psz, isz);\n}\n%-",
- dcname, cast);
+ glob.out.printf("%t%1Params__init__S(dst, %2src, psz, isz);\n}\n%-", dcname, cast);
glob.genTitleD("Handle__label__S");
String ls = "xdc_runtime_Types_Label";
- glob.out.printf("%1 *%2Handle__label__S(xdc_Ptr obj, %1 *lab)\n{\n%+", ls, glob.cname);
- glob.out.printf("%treturn %1Handle__label__S(obj, lab);\n}\n%-",
- dcname);
+ glob.out.printf("%1 *%2Handle__label__S(xdc_Ptr obj, %1 *lab)\n{\n%+",
+ ls, glob.cname);
+ glob.out.printf("%treturn %1Handle__label__S(obj, lab);\n}\n%-", dcname);
}
boolean isAbs = unit.isInst() && mod.geti("abstractInstances$") == 1;
@@ -2567,6 +2629,7 @@
glob.out.printf("#endif\n");
glob.out.printf("xdc_UInt8 * xdcRomStatePtr = (xdc_UInt8 *)"
+ "&ROM_stateStruct;\n");
+
}
/*
@@ -2685,83 +2748,7 @@
}
/*
- * ======== genCreateBody2 ========
- */
- private void genCreateBody2(Value.Obj mod, int useCase)
- {
- Unit unit = unitSpec(mod);
- boolean iInitErr = unit.attrBool(Attr.A_InstanceInitError);
- int pol = commonGeti(mod, "memoryPolicy");
-
- if (pol == STATIC_POLICY) {
- genError(unit, "create policy error");
- glob.out.printf("%treturn NULL;\n%-}\n");
- return;
- }
-
- String finSuffix = isBeforeRom(mod) ? "__F" : "__E";
- String fs = unit.attrBool(Attr.A_InstanceFinalize)
- ? ("(xdc_Fxn)" + glob.cname + "Instance_finalize" + finSuffix)
- : "NULL";
- String cs = "xdc_runtime_Core_";
- String los = "xdc_runtime_Log_";
-
- String newObj = "__newobj";
- String logCall = "%1L_create";
-
- glob.out.printf("%t%1Struct *__str;\n", glob.cname);
- skip();
-
- glob.out.printf("%t/* common instance initialization */\n");
- glob.out.printf("%t__str = %1allocObject__I(&%2Object__DESC__C,"
- + " __eb);\n", cs, glob.cname);
- glob.out.printf(
- "%tif (__str == NULL) {\n%+%treturn NULL;\n%-%t}\n\n");
-
- glob.out.printf("%t%1construct(__str, ", glob.cname);
- if (unit.hasCreateArgs()) {
- for (Decl.Arg arg : unit.getCreator().getArgs()) {
- glob.out.printf("%1, ", arg.getName());
- }
- }
- glob.out.printf("__paramsPtr%1);\n", iInitErr ? ", __eb" : "");
-
- skip();
- if ((mod.geti("$$dlgflag") == 1 || mod.geti("$$iobjflag") == 1)
- && iInitErr && (pol & DELETE_POLICY) != 0) {
- glob.genMultiComment("%t", "In case of an error, construct does not"
- + " delist or delete the object. We", " have to do it here.");
- glob.out.printf("%tif (xdc_runtime_Error_check(__eb)) {\n%+");
- glob.out.printf("%txdc_runtime_Core_delistObject__I(&%1"
- + "Object__DESC__C, __str);\n", glob.cname);
- glob.out.printf("%treturn NULL;\n");
- glob.out.printf("%-%t}\n\n");
- }
-
- int mask = commonGetv(mod, "logger") != null
- ? mod.geti("Module__diagsIncluded") : 0;
- if ((mask & L_LIFECYCLE) != 0) {
- if (commonGeti(mod, "namedInstance") == 1) {
- glob.out.printf(
- "%t%1write2(" + logCall + ", (xdc_IArg)__str, (xdc_IArg)"
- + "(((%2Object__*)__str)->__name));\n", los, glob.cname);
- }
- else {
- glob.out.printf("%t%1write2(" + logCall
- + ", (xdc_IArg)__str, 0);\n", los);
- }
- }
-
- glob.out.printf("%treturn (%1Handle)__str;\n", glob.cname);
- glob.out.printf("%-}\n");
- return;
- }
-
- /*
* ======== genCreateBody ========
- * use case 0 - old create__S invoked by inlined create
- * use case 1 - create - doesn't use this function anymore
- * use case 2 - construct
*/
private void genCreateBody(Value.Obj mod, int useCase)
{
@@ -2772,7 +2759,7 @@
if (pol == STATIC_POLICY
&& !(unit.attrBool(Attr.A_InstanceInitStatic) && useCase == 2)) {
genError(unit, "create policy error");
- if (useCase == 0) {
+ if (useCase != 2) {
glob.out.printf("%treturn NULL;\n");
}
glob.out.printf("%-}\n");
@@ -2786,24 +2773,33 @@
String cs = "xdc_runtime_Core_";
String los = "xdc_runtime_Log_";
- String newObj = (useCase == 0) ? "__newobj" : "(xdc_Ptr)__obj";
- String logCall = (useCase == 0) ? "%1L_create" : "%1L_construct";
-
- if ((mod.geti("$$dlgflag") == 1 || mod.geti("$$iobjflag") == 1)
- && unit.hasCreateArgs()) {
- if (useCase == 0) {
- //490928 add const to accomodate new create sig
- glob.out.printf("%tconst %1Args__create *__args = __aa;\n",
+ String newObj = "__newobj";
+ String consFlag = "(xdc_Bool)(__obj != NULL)";
+ String logCall = "__obj ? %1L_construct : %1L_create";
+ switch (useCase) {
+ case 1: // create
+ consFlag = "0";
+ logCall = "%1L_create";
+ break;
+ case 2: //construct
+ consFlag = "1";
+ newObj = "(xdc_Ptr)__obj";
+ logCall = "%1L_construct";
+ break;
+ default:
+ break;
+ }
+ if (useCase == 0) {
+ if ((mod.geti("$$dlgflag") == 1 || mod.geti("$$iobjflag") == 1)
+ && unit.hasCreateArgs()) {
+ glob.out.printf("%t%1Args__create *__args = __aa;\n",
glob.cname);
}
- else if (useCase == 1) {
- glob.out.printf("%t%1Args__create __args;\n", glob.cname);
- }
}
-
+
glob.out.printf("%t%1Params __prms;\n", glob.cname);
- if (useCase == 0) {
+ if (useCase != 2) {
glob.out.printf("%t%1Object *__newobj;\n", glob.cname);
}
@@ -2816,16 +2812,26 @@
skip();
glob.out.printf("%t/* common instance initialization */\n");
+
if (useCase == 2) {
glob.out.printf("%t%1constructObject__I(&%2Object__DESC__C, __obj, "
- //490928 + "&__prms, (xdc_CPtr)__paramsPtr, 0, %3);\n",
- + "&__prms, (xdc_CPtr)__paramsPtr, %3);\n", cs, glob.cname,
- iInitErr ? "__eb" : "NULL");
+ //490928 + "&__prms, (xdc_CPtr)__paramsPtr, sizeof(%2Params), %3);\n",
+ + "&__prms, (xdc_Ptr)__paramsPtr, sizeof(%2Params), %3);\n",
+ cs, glob.cname, iInitErr ? "__eb" : "NULL");
}
else if (useCase == 0) {
glob.out.printf("%t__newobj = %1createObject__I(&%2Object__DESC__C,"
- //490928 + " &__prms, (xdc_CPtr)__paramsPtr, 0, "
- + " &__prms, (xdc_CPtr)__paramsPtr, __eb);\n", cs, glob.cname);
+ //490928 + " __obj, &__prms, (xdc_CPtr)__paramsPtr, sizeof(%2Params), "
+ + " __obj, &__prms, (xdc_Ptr)__paramsPtr, sizeof(%2Params), "
+ + "__eb);\n", cs, glob.cname);
+ glob.out.printf(
+ "%tif (__newobj == NULL) {\n%+%treturn NULL;\n%-%t}\n\n");
+ }
+ else {
+ glob.out.printf("%t__newobj = %1createObject__I(&%2Object__DESC__C,"
+ //490928 + " 0, &__prms, (xdc_CPtr)__paramsPtr, sizeof(%2Params), "
+ + " 0, &__prms, (xdc_Ptr)__paramsPtr, sizeof(%2Params), "
+ + "__eb);\n", cs, glob.cname);
glob.out.printf(
"%tif (__newobj == NULL) {\n%+%treturn NULL;\n%-%t}\n\n");
}
@@ -2845,10 +2851,10 @@
glob.out.printf("%tif (xdc_runtime_Error_check(__eb)) {\n%+");
if ((pol & DELETE_POLICY) != 0) {
glob.out.printf("%txdc_runtime_Core_deleteObject__I(&%1"
- + "Object__DESC__C, %2, %3, iStat, 1);\n",
- glob.cname, newObj, fs);
+ + "Object__DESC__C, %2, %3, %4, %5);\n", glob.cname,
+ newObj, fs, "iStat", consFlag);
}
- if (useCase == 0) {
+ if (useCase != 2) {
glob.out.printf("%treturn NULL;\n");
}
glob.out.printf("%-%t}\n\n");
@@ -2859,17 +2865,18 @@
? mod.geti("Module__diagsIncluded") : 0;
if ((mask & L_LIFECYCLE) != 0) {
if (commonGeti(mod, "namedInstance") == 1) {
- glob.out.printf("%t%1write2(" + logCall + ", (xdc_IArg)%2,"
- + "(xdc_IArg)(((%3Object__*)%2)->__name));\n", los, newObj,
- glob.cname);
+ glob.out.printf(
+ "%t%1write2(" + logCall + ", (xdc_IArg)"
+ + "%2, (xdc_IArg)(((%3Object__*)%2)->__name));\n",
+ los, newObj, glob.cname);
}
else {
- glob.out.printf("%t%1write2(" + logCall + ", (xdc_IArg)%2, 0);"
+ glob.out.printf("%t%1write2(" + logCall + ", (xdc_IArg)%2, 0);"
+ "\n", los, newObj);
}
}
- if (useCase == 0) {
+ if (useCase != 2) {
glob.out.printf("%treturn __newobj;\n");
}
glob.out.printf("%-}\n");
@@ -2904,12 +2911,12 @@
&& mod.geti("abstractInstances$") == 1 ? "1" : "0");
// Proxy__delegate
//490928 glob.out.printf("xdc_CPtr %1Proxy__delegate__S( void )\n{\n%+%treturn ", glob.cname);
- glob.out.printf("xdc_CPtr %1Proxy__delegate__S( void )\n{\n%+%treturn ", glob.cname);
+ glob.out.printf("xdc_Ptr %1Proxy__delegate__S( void )\n{\n%+%treturn ", glob.cname);
Value delmod = mod.getv("delegate$");
String dcname = glob.mkCname(delmod.gets("$name"));
if (commonGeti(delmod, "fxntab") == 1) {
//490928 glob.out.printf("(xdc_CPtr)&%1Module__FXNS__C;", dcname);
- glob.out.printf("(const void *)&%1Module__FXNS__C;", dcname);
+ glob.out.printf("(void *)&%1Module__FXNS__C;", dcname);
}
else {
glob.out.printf("0;");
@@ -2994,14 +3001,6 @@
fmt = "%2Void %1Params__init__S( %2Ptr prms, %2Ptr src, %2SizeT psz, %2SizeT isz ) \n{\n%+";
}
glob.out.printf(fmt, glob.cname, "xdc_");
-
- /* If STATIC_POLICY is used and the module doesn't have a static-only
- * Instance_init() function, no Instance_init() function will be called
- * so prms will not be used. No need to call assignParams. Most likely,
- * create() or construct() will be invoked later and they will fail, but
- * we don't want to fail prematurely in case the user has some way of
- * detecting that these functions should not be called. (ECL349505)
- */
if (pol != STATIC_POLICY || unit.attrBool(Attr.A_InstanceInitStatic)) {
glob.out.printf("%t%2assignParams__I(prms, (xdc_CPtr)(src ? src : &%1Object__PARAMS__C), psz, isz);\n",
glob.cname, cs);
@@ -3014,17 +3013,7 @@
+ "\n%+", glob.cname);
glob.out.printf("%tif (oa) {\n%+%treturn ((%1Object__ *)oa) + i;\n%-%t}\n\n", glob.cname);
glob.out.printf("%tif (%1Object__count__C == 0) {\n%+%treturn NULL;\n%-%t}\n\n", glob.cname);
-
- /* MISRA hack. //490928
- * The const in the cast below triggers TI compiler warning #193:
- * type qualifier is meaningless on cast type
- * we can hide this via
- * #ifdef __ti__
- * #pragma diag_suppress 193
- * #endif
- */
- glob.out.printf("%t/* the bogus 'const' in the cast suppresses Klocwork MISRA complaints */\n");
- glob.out.printf("%treturn ((%1Object__ * const)%1Object__table__C) + i;\n",
+ glob.out.printf("%treturn ((%1Object__ *)%1Object__table__C) + i;\n",
glob.cname);
glob.out.printf("}\n%-");
@@ -3091,8 +3080,8 @@
/* Object create() is added instead of static inline only for modules
* from packages built with 3.26. Older modules bring in static inline
- * create() in their headers so if we generate create() here, it will
- * cause duplicate references. This same logic also applies to
+ * create() in their headers so if we generate create() here, it will
+ * cause duplicate references. This same logic also applies to
* construct(), delete() and destruct().
*/
if (!isBeforeRom(mod)) {
@@ -3101,7 +3090,7 @@
glob.genCreArgDecls(unit, Glob.Type$LCL, " ");
glob.out.printf("const %1Params *__paramsPtr, %2 )\n{\n%+",
glob.cname, Glob.ERRARG);
- genCreateBody2(mod, 1);
+ genCreateBody(mod, 1);
// end of create
// Object construct
@@ -3115,22 +3104,28 @@
// end of construct
}
+ // Object__destruct__S
+ /* allow destruct in all cases */
+ glob.genTitleD("Object__destruct__S");
+ glob.out.printf("xdc_Void %1Object__destruct__S( xdc_Ptr obj ) \n{\n%+", glob.cname);
+ if ((mask & L_LIFECYCLE) != 0) {
+ glob.out.printf("%t%1write1(%1L_destruct, (xdc_IArg)obj);\n", los);
+ }
+ /* using Core_delete verses Core_destruct is a code verses time
+ * tradeoff. Maybe we should always just use destruct?
+ */
+ glob.out.printf("%t%1%2Object__I(&%3Object__DESC__C, obj, %4, %5, TRUE);\n",
+ cs,
+ (pol == DELETE_POLICY) ? "delete" : "destruct",
+ glob.cname, fs, iInitErr ? "0" : "-1");
+ glob.out.printf("%-}\n");
+
if (!isBeforeRom(mod)) {
// destruct
glob.genTitleD("destruct");
glob.out.printf("void %1destruct(%1Struct *obj)\n{\n%+",
glob.cname);
- if ((mask & L_LIFECYCLE) != 0) {
- glob.out.printf("%t%1write1(%1L_destruct, (xdc_IArg)obj);\n",
- los);
- }
- /* using Core_delete verses Core_destruct is a code verses time
- * tradeoff. Maybe we should always just use destruct?
- */
- glob.out.printf("%t%1%2Object__I(&%3Object__DESC__C, obj, %4, %5,"
- + "TRUE);\n", cs, (pol == DELETE_POLICY) ? "delete" : "destruct",
- glob.cname, fs, iInitErr ? "0" : "-1");
- glob.out.printf("%-}\n");
+ glob.out.printf("%t%1Object__destruct__S(obj);\n}\n%-", glob.cname);
}
if (pol == DELETE_POLICY) {
@@ -3188,14 +3183,11 @@
return;
}
glob.genTitle(unit.getQualName() + " VIRTUAL FUNCTIONS");
- /* __create in SysFxns2 has a signature of create__S. That signature
- * is common for all create__S functions so we can have one type
- * definition for that common part of the virtual table that includes
- * create() and delete(). To get rid of create__S, we would have to
- * generate Fxns types differently to accommodate different create()
- * signatures for different modules. That is not difficult to do, so if
- * we can stop using create__S for proxies, we could then get rid of
- * create__S functions completely.
+ /* Currently, __create in SysFxns2 has a signature of create__S. It has
+ * to be that way as long as we have to support pre-3.26 interfaces,
+ * where IMod.create functions were static inline and were calling
+ * __create with the signature of create__S. Once we don't support
+ * pre-3.26 packages, SysFxns2 can change and call create.
*/
glob.genTitleD("create");
glob.out.printf("%1Handle %1create( %1Module __mod", glob.cname);
@@ -3208,7 +3200,7 @@
glob.out.printf("%t__args.%1 = %1;\n", arg.getName());
}
}
- glob.out.printf("%treturn (%1Handle) __mod->__sysp->__create(",
+ glob.out.printf("%treturn (%1Handle) __mod->__sysp->__create(0, 0, ",
glob.cname);
glob.out.printf("%1, ", unit.hasCreateArgs() ? "&__args" : "0");
glob.out.printf("(const xdc_UChar*)__prms, sizeof (%1Params), __eb);\n}\n%-", glob.cname);
@@ -3741,10 +3733,8 @@
return "{0, 0}";
}
else {
- //490928 - remove unnecessary cast for config vectors
- // String cts = varr.getCtype();
- // return "{" + len + ", ((const " + cts + "*)" + as + ")}";
- return "{" + len + ", (" + as + ")}";
+ String cts = varr.getCtype();
+ return "{" + len + ", ((" + cts + "*)" + as + ")}";
}
}
else if (cast != null){
@@ -3765,7 +3755,7 @@
return oval(proto, elmval);
}
- private String valToStr(xdc.services.intern.xsr.Enum enmval) // Proto.Enm
+ private String valToStr(xdc.services.intern.xsr.Enum enmval) // Proto.Enm
{
return enmval.getName().replace('.', '_');
}
diff --git a/src/packages/xdc/services/intern/gen/Glob.java b/src/packages/xdc/services/intern/gen/Glob.java
index 99a0aed..a3c351b 100644
--- a/src/packages/xdc/services/intern/gen/Glob.java
+++ b/src/packages/xdc/services/intern/gen/Glob.java
@@ -180,35 +180,16 @@
// genArrType
void genArrType( Type type, String id )
{
- genArrType(type, id, true, "");
- }
-
- // genArrType
- //490928 add new "const" array type
- void genArrType( Type type, String id, String qual )
- {
- genArrType(type, id, true, qual);
+ genArrType(type, id, true);
}
// genArrType
void genArrType( Type type, String id, boolean top )
{
- genArrType(type, id, top, "");
- }
-
- // genArrType
- //490928 add new "const" array type
- void genArrType( Type type, String id, boolean top, String qual )
- {
- //debug
- //if (debug != 0 || !qual.equals("")) debug++;
- //String stn = shortName(type.toString());
- //indent();
- //System.out.println("genArrType(" + stn + ", " + id + ", " + top + ")");
if (!(type instanceof Type.Array)) {
if (type.tcode().endsWith("O")) {
String tcn = mkCname(type.tspec().getRef().getScope());
- this.out.printf("%1Instance_State %2", tcn, id);
+ out.printf("%1Instance_State %2", tcn, id);
}
else {
this.genType(type, Type$TYP, id);
@@ -229,12 +210,10 @@
}
else if (tarr.isVec()) {
this.out.printf("struct { int length; ");
- //490928 vector elem arrays are always const
- genArrType(tarr.getBase(), "const " + (par ? "(*elem)" : "*elem"), true);
+ genArrType(tarr.getBase(), par ? "(*elem)" : "*elem", true);
this.out.printf("; } %1", id);
}
else {
- this.out.printf(qual);
genArrType(tarr.getBase(), "", false);
this.out.printf(par ? "(*%1)" : "*%1", id);
if (top) {
@@ -280,7 +259,8 @@
}
else if (mode == CDLMODE) {
String qn = this.mkCname(iu.getQualName());
- this.out.printf("&%1Interface__BASE__C", qn);
+ //490928 this.out.printf("&%1Interface__BASE__C", qn);
+ this.out.printf("(void *)&%1Interface__BASE__C", qn);
}
}
@@ -377,13 +357,6 @@
this.out.printf("))\n");
*/
}
- /* If a constant does not have an initializer, nothing is generated.
- * We also don't generate an error here, which is a little bit of a
- * loophole that allows us in a spec file to declare a constant of
- * any type without an initializer and then declare and define it
- * any way we want in a custom header file. We can even change the
- * type.
- */
break;
case CPPMODE:
this.out.printf("%tstatic const ");
@@ -1038,13 +1011,13 @@
* are alone on the last line.
* For single-line comments 'genTitleD' can be used.
*/
- void genMultiComment(String prefix, String... lines) {
+ void genMultiComment(String... lines) {
String pre = "/* ";
for (String line: lines) {
- this.out.printf(prefix + "%1" + line + "\n", pre);
+ this.out.printf("%1" + line + "\n", pre);
pre = " * ";
}
- this.out.printf(prefix + " */\n");
+ this.out.printf(" */\n\n");
}
// genSections
@@ -1260,8 +1233,7 @@
{
if (t.isVec()) {
this.out.print("struct { int length; ");
- //490928 vector arrays are always const
- this.genType(t.getBase(), Type$TYP, " const *elem");
+ this.genType(t.getBase(), Type$TYP, "*elem");
this.out.print("; } ");
Type.Declarator td = (Type.Declarator)t.term();
this.out.print(this.cname + td.getId());
diff --git a/src/packages/xdc/services/intern/gen/Header.java b/src/packages/xdc/services/intern/gen/Header.java
index 3cebd87..be3d5d0 100644
--- a/src/packages/xdc/services/intern/gen/Header.java
+++ b/src/packages/xdc/services/intern/gen/Header.java
@@ -296,23 +296,11 @@
glob.out.printf(";\n");
if (tarr != null && tarr.isVec() && tarr.getBase() instanceof Type.Array) {
- //490928 vector object's elem is always const
- glob.out.printf("%ttypedef struct { int length; __T%1_%2 const* elem; } __ARRAY%1_%2;\n", iobj, cn);
- glob.out.printf("%ttypedef struct { int length; __T%1_%2 const* elem; } __CARRAY%1_%2;\n", iobj, cn);
+ glob.out.printf("%ttypedef struct { int length; __T%1_%2* elem; } __ARRAY%1_%2;\n", iobj, cn);
}
else {
- //490928 vector arrays are always const
- String qual = "";
- if (tarr != null && tarr.isVec()) {
- qual = "const ";
- }
glob.out.printf("%ttypedef ");
- glob.genArrType(type, "__ARRAY" + iobj + "_" + cn, qual);
- glob.out.printf(";\n");
-
- //490928 add new "const" array type (for big.c const arrays)
- glob.out.printf("%ttypedef ");
- glob.genArrType(type, "__CARRAY" + iobj + "_" + cn, "const ");
+ glob.genArrType(type, "__ARRAY" + iobj + "_" + cn);
glob.out.printf(";\n");
}
}
@@ -576,48 +564,6 @@
}
}
- if (unit.isInst()) {
- String creName = glob.cname + "create";
- glob.genTitleD("create");
- glob.out.printf("%txdc__CODESECT(%1, \"%1\")\n", creName);
- glob.out.printf("%t__extern ");
- glob.out.printf("%1Handle %1create(", glob.cname);
- glob.genCreArgDecls(unit, Glob.Type$LCL, " ");
- glob.out.printf("const %1Params *__prms, %2 );\n", glob.cname,
- Glob.ERRARG);
-
- /* Proxies don't need construct and destruct functions. When
- * constructing instances, a user has to supply a structure of the
- * right size, which means he needs to know the delegate, and in
- * that case might as well call the delegate's construct.
- */
- if (!unit.isProxy()) {
- String conName = glob.cname + "construct";
- glob.genTitleD("construct");
- glob.out.printf("%txdc__CODESECT(%1, \"%1\")\n", conName);
- glob.out.printf("%t__extern ");
- glob.out.printf("void %1construct(", glob.cname);
- glob.out.printf(" %1Struct *__obj", glob.cname);
- glob.genCreArgDecls(unit, Glob.Type$LCL, ", ");
- glob.out.printf("const %1Params *__prms%2 );\n", glob.cname,
- glob.errArg(unit));
- }
-
- String delName = glob.cname + "delete";
- glob.genTitleD("delete");
- glob.out.printf("%txdc__CODESECT(%1, \"%1\")\n", delName);
- glob.out.printf("%t__extern ");
- glob.out.printf("void %1delete(%1Handle *instp);\n", glob.cname);
-
- if (!unit.isProxy()) {
- String desName = glob.cname + "destruct";
- glob.genTitleD("destruct");
- glob.out.printf("%txdc__CODESECT(%1, \"%1\")\n", desName);
- glob.out.printf("%t__extern ");
- glob.out.printf("void %1destruct(%1Struct *obj);\n", glob.cname);
- }
- }
-
for (Decl.Fxn fxn : unit.getFxns()) {
if (fxn.isMeta()) {
continue;
@@ -627,24 +573,66 @@
String suf;
if (fxn.isSys()) {
- if (unit.isProxy() && (fxn.getName() == "Object__create"
- || fxn.getName() == "Object__delete"
- || fxn.getName() == "Object__destruct")) {
- /* construct was never declared as a system function in
- * IModule.h
- */
- continue;
- }
+ /* Even though we generate create/construct/delete/deconstruct
+ * without __S, we still needed __S versions for compatibility
+ * with packages built with earlier tools, and also the
+ * implementation of the functions with the suffix may invoke
+ * __S functions.
+ */
glob.genTitleD(fxn.getName() + "__S");
glob.out.printf("%txdc__CODESECT(%1__S, \"%1__S\")\n", fn);
glob.out.printf("%t__extern ");
genFxnDcl(unit, fxn, fn + "__S", true);
+
+ /* create, construct, delete and destruct are now special
+ * cases. We declare them as normal, extern functions and
+ * generate their bodies, including calls *__S functions, in
+ * the config C file.
+ */
+ if (unit.isInst() && fxn.getName().equals("Object__create")) {
+ String creName = glob.cname + "create";
+ glob.genTitleD("create");
+ glob.out.printf("%txdc__CODESECT(%1, \"%1\")\n", creName);
+ glob.out.printf("%t__extern ");
+ glob.out.printf("%1Handle %1create(", glob.cname);
+ glob.genCreArgDecls(unit, Glob.Type$LCL, " ");
+ glob.out.printf("const %1Params *__prms, %2 );\n",
+ glob.cname, Glob.ERRARG);
+ if (!unit.isProxy()) {
+ String conName = glob.cname + "construct";
+ glob.genTitleD("construct");
+ glob.out.printf("%txdc__CODESECT(%1, \"%1\")\n", conName);
+ glob.out.printf("%t__extern ");
+ glob.out.printf("void %1construct(", glob.cname);
+ glob.out.printf(" %1Struct *__obj", glob.cname);
+ glob.genCreArgDecls(unit, Glob.Type$LCL, ", ");
+ glob.out.printf("const %1Params *__prms%2 );\n",
+ glob.cname, glob.errArg(unit));
+ }
+ }
+
+ if (unit.isInst() && fxn.getName().equals("Object__delete")) {
+ String delName = glob.cname + "delete";
+ glob.genTitleD("delete");
+ glob.out.printf("%txdc__CODESECT(%1, \"%1\")\n", delName);
+ glob.out.printf("%t__extern ");
+ glob.out.printf("void %1delete(%1Handle *instp);\n",
+ glob.cname);
+ }
+ if (unit.isInst() && !unit.isProxy()
+ && fxn.getName().equals("Object__destruct")) {
+ String desName = glob.cname + "destruct";
+ glob.genTitleD("destruct");
+ glob.out.printf("%txdc__CODESECT(%1, \"%1\")\n", desName);
+ glob.out.printf("%t__extern ");
+ glob.out.printf("void %1destruct(%1Struct *obj);\n",
+ glob.cname);
+ }
}
else if (unit.isProxy()) {
suf = "__E";
glob.genTitleD(fxn.getName() + suf);
- glob.out.printf("#define %1%2 %1%2%3\n", glob.cname,
- fxn.getName(), suf);
+ glob.out.printf("#define %1%2 %1%2%3\n", glob.cname, fxn.getName(), suf);
glob.out.printf("%txdc__CODESECT(%1%2, \"%1\")\n", fn, suf);
glob.out.printf("%t__extern ");
genFxnDcl(unit, fxn, fn + suf, true);
@@ -748,8 +736,7 @@
if (commentNeeded) {
String[] commentA = new String[]{};
- glob.genMultiComment("", comment.toArray(commentA));
- skip();
+ glob.genMultiComment(comment.toArray(commentA));
commentNeeded = false;
}
glob.genTitleD(fxn.getName() + "_{FxnT,fxnP}");
@@ -869,7 +856,8 @@
{
glob.genTitleD("Fxns__");
glob.out.printf("%tstruct %1Fxns__ {\n%+", glob.cname);
- glob.out.printf("%tconst xdc_runtime_Types_Base* __base;\n");
+ //490928 glob.out.printf("%tconst xdc_runtime_Types_Base* __base;\n");
+ glob.out.printf("%txdc_runtime_Types_Base* __base;\n");
glob.out.printf("%tconst xdc_runtime_Types_SysFxns2* __sysp;\n");
for (Decl.Fxn fxn : unit.getAllFxns()) {
@@ -1069,10 +1057,7 @@
glob.out.printf("%ttypedef ");
if (glob.isArr(cfg.getTypeCode())) {
- //490928 - change config arrays to __CARRAY<dim>
- int dims = glob.dims(cfg.getTypeCode());
- glob.out.printf("__CARRAY%3_%1 %2", cfgn, cfgt,
- new Integer(dims));
+ glob.out.printf("__TA_%1 %2", cfgn, cfgt);
}
else {
glob.genType(cfg.getType(), Glob.Type$TYP, cfgt);
diff --git a/src/packages/xdc/services/spec/BrowserSession.java b/src/packages/xdc/services/spec/BrowserSession.java
index 17e8386..bd834a4 100644
--- a/src/packages/xdc/services/spec/BrowserSession.java
+++ b/src/packages/xdc/services/spec/BrowserSession.java
@@ -112,26 +112,22 @@
}
else {
String path = "/" + qn.replace('.', '/');
- /* Environment is publicly exposed through xdc.$$private.Env. We
- * have to synchronize in case someone changed the path since the
- * constructor was called.
- */
- this.dirs = this.getEnv().getPath();
for (int i = 0; i < this.dirs.length; i++) {
if ((pkg = this.loadPkg(dirs[i] + path, qn)) != null) {
break;
}
}
}
+
return pkg;
}
-
+
// isCurrentPkg
public boolean isCurrentPkg(Pkg pkg)
{
return this.isCurrentPkg(pkg.getBaseDir(), pkg.getName());
}
-
+
// isCurrentPkg
public boolean isCurrentPkg(String cpath, String qn)
{
@@ -163,14 +159,14 @@
}
File file = null;
-
+
if (new File(cpath + "/package/" + ".vers_g" + this.getVers()).exists()) {
file = new File(cpath + "/package/" + qn + ".ccs");
}
-
+
/* if the spec vers doesn't match or the serialized spec is missing */
if (file == null || !file.exists()) {
- //System.out.println(" Re-building " + cpath + "/package.xdc");
+// System.out.println(" Re-building " + cpath + "/package.xdc");
CacheElem cacheElem = new CacheElem(qn, cpath, "spec", this.getVers());
if (cacheElem.isTemp()) {
pkg = this.parser.compile(cpath + "/package.xdc");
@@ -186,16 +182,16 @@
file = new File(curElemDir, qn + ".ccs");
cacheElem.release();
}
- //System.out.println(" Re-build done (" + cpath + ")");
+// System.out.println(" Re-build done (" + cpath + ")");
}
-
+
if (pkg == null && file != null && file.exists()) {
FileInputStream fis = null;
BufferedInputStream bis = null;
ObjectInputStream ois = null;
try {
/* read the package spec -- may throw an exception */
- //System.out.println(" reading pkg from " + file);
+// System.out.println(" reading pkg from " + file);
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
ois = new Persist.Input(qn, bis, this);
@@ -233,7 +229,7 @@
this.enterPackage(qn, pkg);
pkg.setBaseDir(cpath);
}
-
+
return pkg;
}
@@ -281,7 +277,7 @@
/* return with the package name, or null if not found */
return pkgName;
}
-
+
/**
* Load the named unit's spec object by searching the package path.
* @param name Package-qualified name of the module or interface.
@@ -299,7 +295,7 @@
/* separate the unit name from the package name */
String pkgName = name.substring(0, dotIdx);
String unitName = name.substring(dotIdx+1);
-
+
/* load the package */
Pkg pkg = findPkg(pkgName);
if (pkg == null) {
diff --git a/src/packages/xdc/tools/cdoc/Out.xs b/src/packages/xdc/tools/cdoc/Out.xs
index 5c12c8e..ca7cb99 100644
--- a/src/packages/xdc/tools/cdoc/Out.xs
+++ b/src/packages/xdc/tools/cdoc/Out.xs
@@ -1,13 +1,13 @@
/* --COPYRIGHT--,EPL
- * Copyright (c) 2008-2017 Texas Instruments Incorporated
+ * Copyright (c) 2008 Texas Instruments and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Texas Instruments - initial implementation
- *
+ *
* --/COPYRIGHT--*/
/*
* ======== Stream ========
@@ -51,6 +51,6 @@
*/
Stream.prototype.println = function( s )
{
- this.outstr.printfln(s);
+ this.outstr.println(s);
};
diff --git a/src/packages/xdc/utils.js b/src/packages/xdc/utils.js
index 4d9156d..282b951 100644
--- a/src/packages/xdc/utils.js
+++ b/src/packages/xdc/utils.js
@@ -97,9 +97,8 @@
level = 0;
}
- var groupsArr;
if (!groups) {
- groupsArr = ["all"];
+ var groupsArr = ["all"];
}
else if (typeof(groups) == "string") {
groupsArr = [groups, "all"];