Commit d593bf38 authored by Ansgar Burchardt's avatar Ansgar Burchardt

Merge branch 'cleanup-21' into 'master'

More cleanup

See merge request !73
parents 58f0bbb6 f93b5e20
......@@ -781,8 +781,8 @@ Problem_Configure (INT argc, char **argv)
for (i = 0; i < argc; i++)
if ((argv[i][0] == 'p') && (argv[i][1] == ' '))
if ((sscanf (argv[i], expandfmt (CONCAT3 ("p %", NAMELENSTR, "[ -~]")),
ProblemName) != 1) || (strlen (ProblemName) == 0))
if (sscanf(argv[i], expandfmt ("p %" NAMELENSTR "[ -~]"), ProblemName) != 1
|| strlen(ProblemName) == 0)
continue;
theDomain = currBVP->Domain;
......
......@@ -1659,21 +1659,8 @@ struct elementvector {
};
struct matrixvalues {
/** \brief Fields for enironment list variable */
NS_PREFIX ENVVAR v;
/** \brief Prepare eval values */
PreprocessingProcPtr PreprocessProc;
/** \brief Pointer to corresponding function */
MatrixEvalProcPtr EvalProc;
};
typedef struct elementvalues EVALUES ;
typedef struct elementvector EVECTOR ;
typedef struct matrixvalues MVALUES ;
/****************************************************************************/
/* */
......@@ -3186,26 +3173,20 @@ INT SaveCnomGridAndValues (MULTIGRID *theMG, char *FileName,
NODE *InsertInnerNode (GRID *theGrid, const DOUBLE *pos);
NODE *InsertBoundaryNode (GRID *theGrid, BNDP *bndp);
INT DeleteNodeWithID (GRID *theGrid, INT id);
INT DeleteNode (GRID *theGrid, NODE *theNode);
ELEMENT *InsertElementFromIDs (GRID *theGrid, INT n, INT *idList, INT *bnds_flag);
ELEMENT *InsertElement (GRID *theGrid, INT n, NODE **NodeList, ELEMENT **ElemList, INT *NbgSdList, INT *bnds_flag);
INT InsertMesh (MULTIGRID *theMG, MESH *theMesh);
INT DeleteElementWithID (MULTIGRID *theMG, INT id);
INT DeleteElement (MULTIGRID *theMG, ELEMENT *theElement);
/* refinement */
/** \todo !!! should be moved to rm.h [Thimo] */
INT EstimateHere (const ELEMENT *theElement);
INT MarkForRefinement (ELEMENT *theElement, enum RefinementRule rule, INT data);
INT MarkForRefinementX (ELEMENT *theElement,
INT fl, INT tl, enum RefinementRule rule, INT data);
INT GetRefinementMark (ELEMENT *theElement, INT *rule, void *data);
INT GetRefinementMarkType (ELEMENT *theElement);
INT AdaptMultiGrid (MULTIGRID *theMG, INT flag, INT seq, INT mgtest);
INT TestRefineInfo (MULTIGRID *theMG);
INT SetRefineInfo (MULTIGRID *theMG);
INT ClearMarksOnLevel (GRID *theGrid, INT ClearType);
NODE *GetFineNodeOnEdge (const ELEMENT *theElement, INT side);
......
......@@ -2581,19 +2581,6 @@ INT NS_DIM_PREFIX MarkForRefinement (ELEMENT *theElement, enum RefinementRule ru
return(GM_OK);
}
INT NS_DIM_PREFIX MarkForRefinementX (ELEMENT *e, INT fl, INT tl, enum RefinementRule rule, INT data)
{
ELEMENT *t = ELEMENT_TO_MARK(e);
assert(ECLASS(t)==RED_CLASS);
if (rule==RED && LEVEL(t)<tl) return(MarkForRefinement(e,rule,data));
if (rule==COARSE && LEVEL(t)>fl) return(MarkForRefinement(e,rule,data));
return(GM_ERROR);
}
/****************************************************************************/
/** \brief Return true when element can be tagged for refinement
......@@ -2617,39 +2604,6 @@ INT NS_DIM_PREFIX EstimateHere (const ELEMENT *theElement)
}
/****************************************************************************/
/** \brief Clear refinement on level
\param theGrid - level
\param ClearType - 0: clear all, 1: clear refinements, -1: clear coarsenings
This function clears refinement on level
\return <ul>
<li> GM_OK - ok </li>
<li> GM_ERROR - error </li>
</ul>
*/
/****************************************************************************/
INT NS_DIM_PREFIX ClearMarksOnLevel (GRID *theGrid, INT ClearType)
{
ELEMENT *theElement;
INT MarkType;
for (theElement=FIRSTELEMENT(theGrid); theElement!=NULL; theElement=SUCCE(theElement))
if (EstimateHere(theElement))
{
MarkType = GetRefinementMarkType(theElement);
if (ClearType*MarkType>=0)
if (MarkForRefinement (theElement,NO_REFINEMENT,0)==GM_ERROR)
return(GM_ERROR);
}
return (GM_OK);
}
/****************************************************************************/
/** \brief Return mark of rule for a specific pattern
......
......@@ -4693,157 +4693,6 @@ INT NS_DIM_PREFIX DeleteNode (GRID *theGrid, NODE *theNode)
return(GM_OK);
}
/****************************************************************************/
/** \brief Delete the node with id
* @param theGrid - grid structure
* @param id - id of node to delete
This function deletes the node with id `id`.
@return <ul>
<li> GM_OK if ok </li>
<li> GM_ERROR when error occured. </li>
</ul> */
/****************************************************************************/
INT NS_DIM_PREFIX DeleteNodeWithID (GRID *theGrid, INT id)
{
NODE *theNode;
/* find node */
for (theNode=FIRSTNODE(theGrid); theNode!=NULL; theNode=SUCCN(theNode))
if (ID(theNode)==id) break;
if (theNode==NULL)
{
PrintErrorMessage('E',"DeleteNodeWithID","node not found");
RETURN(GM_ERROR);
}
return (DeleteNode(theGrid,theNode));
}
/****************************************************************************/
/** \brief Find the new father element
* @param theVertex -
This function finds the new father element of the given vertex.
It assumes that the new father is one of the neighbors of the
old father element.
@return <ul>
<li> pointer to an element </li>
<li> NULL if none or no correct father is found or vertex is level 0 </li>
</ul> */
/****************************************************************************/
ELEMENT * NS_DIM_PREFIX FindFather (VERTEX *theVertex)
{
ELEMENT *theElement;
INT i;
theElement = VFATHER(theVertex);
if (theElement == NULL)
return(NULL);
if (OBJT(theElement)==BEOBJ && MOVED(theVertex)) return(theElement);
if (PointInElement(CVECT(theVertex),theElement))
return(theElement);
for (i=0; i<SIDES_OF_ELEM(theElement); i++)
if (PointInElement(CVECT(theVertex),NBELEM(theElement,i)))
return(NBELEM(theElement,i));
if (i == SIDES_OF_ELEM(theElement))
if (OBJT(theVertex) == BVOBJ)
return(theElement);
return(NULL);
}
/****************************************************************************/
/** \brief Search the boundary sides and recreate the corresponding BNDS
* @param theMG - multigrid structure
* @param theNode - node with new BNDP
This function searches the boundary sides located at 'theNode' and recreate
the corresponding BNDSs of these sides.
It assumes that 'theNode' and the neighbour boundary nodes are in the same patch.
@return <ul>
<li> GM_OK if ok </li>
<li> GM_ERROR when error occured. </li>
</ul> */
/****************************************************************************/
static INT RecreateBNDSofNode (MULTIGRID *theMG, NODE *theNode)
{
ELEMENT *theElement, *sonElem, *NBElem;
ELEMENT *SonList[MAX_SONS];
BNDS *bnds;
BNDP *sidebndp[MAX_CORNERS_OF_SIDE];
INT m,i,j,k,l;
/* first scan father element of theNode */
theElement = VFATHER(MYVERTEX(theNode));
GetAllSons(theElement, SonList);
for (i=0; i<NSONS(theElement); i++)
{
/* search side in son element with theNode as a corner */
sonElem = SonList[i];
if (OBJT(sonElem)!=BEOBJ) continue;
for (j=0; j<SIDES_OF_ELEM(sonElem); j++)
for (k=0; k<CORNERS_OF_SIDE(sonElem,j); k++)
if (CORNER(sonElem,CORNER_OF_SIDE(sonElem,j,k))==theNode)
{
bnds = ELEM_BNDS(sonElem,j);
if (bnds==NULL) continue;
if (BNDS_Dispose(MGHEAP(theMG),bnds))
return(GM_ERROR);
/* create BNDS from BNDPs of this element side */
for (l=0; l<CORNERS_OF_SIDE(sonElem,j); l++)
sidebndp[l] = V_BNDP(MYVERTEX(CORNER(sonElem,CORNER_OF_SIDE(sonElem,j,l))));
bnds = BNDP_CreateBndS(MGHEAP(theMG),sidebndp,CORNERS_OF_SIDE(sonElem,j));
SET_BNDS(sonElem,j,bnds);
}
}
if (NTYPE(theNode)==MID_NODE) return(GM_OK);
/* scan all neighbour elements of the father element */
for (m=0; m<SIDES_OF_ELEM(theElement); m++)
{
NBElem = NBELEM(theElement,m);
if (NBElem==NULL) continue;
if (OBJT(NBElem)!=BEOBJ) continue;
GetAllSons(NBElem, SonList);
for (i=0; i<NSONS(NBElem); i++)
{
/* search side in son element with theNode as a corner */
sonElem = SonList[i];
if (OBJT(sonElem)!=BEOBJ) continue;
for (j=0; j<SIDES_OF_ELEM(sonElem); j++)
for (k=0; k<CORNERS_OF_SIDE(sonElem,j); k++)
if (CORNER(sonElem,CORNER_OF_SIDE(sonElem,j,k))==theNode)
{
bnds = ELEM_BNDS(sonElem,j);
if (bnds==NULL) continue;
if (BNDS_Dispose(MGHEAP(theMG),bnds))
return(GM_ERROR);
/* create BNDS from BNDPs of this element side */
for (l=0; l<CORNERS_OF_SIDE(sonElem,j); l++)
sidebndp[l] = V_BNDP(MYVERTEX(CORNER(sonElem,CORNER_OF_SIDE(sonElem,j,l))));
bnds = BNDP_CreateBndS(MGHEAP(theMG),sidebndp,CORNERS_OF_SIDE(sonElem,j));
SET_BNDS(sonElem,j,bnds);
}
}
}
return(GM_OK);
}
#ifdef __TWODIM__
......@@ -5695,74 +5544,6 @@ ELEMENT * NS_DIM_PREFIX InsertElement (GRID *theGrid, INT n, NODE **Node, ELEMEN
return(theElement);
}
/****************************************************************************/
/** \brief Insert element with node ids
* @param theGrid - grid structure
* @param n - number of nodes in node id list
* @param idList - ids of the nodes
This function inserts an element with nodes that have the ids
given in `idList`, on level 0.
@return <ul>
<li> pointer to an element if ok </li>
<li> NULL when error occured. </li>
</ul> */
/****************************************************************************/
ELEMENT * NS_DIM_PREFIX InsertElementFromIDs (GRID *theGrid, INT n, INT *idList, INT *bnds_flag)
{
MULTIGRID *theMG;
NODE *Node[MAX_CORNERS_OF_ELEM],*theNode;
INT i,j,found;
/* check level */
theMG = MYMG(theGrid);
if ((CURRENTLEVEL(theMG)!=0)||(TOPLEVEL(theMG)!=0))
{
PrintErrorMessage('E',"InsertElementFromIDs","only a multigrid with exactly one level can be edited");
return(NULL);
}
/* check data */
for (i=0; i<n; i++)
for (j=i+1; j<n; j++)
if (idList[i]==idList[j])
{
PrintErrorMessage('E',"InsertElementFromIDs",
"nodes must be pairwise different");
return(NULL);
}
/* init data */
for (i=0; i<n; i++)
Node[i] = NULL;
/* find nodes */
found = 0;
for (theNode=FIRSTNODE(theGrid); theNode!=NULL; theNode=SUCCN(theNode))
{
for (i=0; i<n; i++)
{
if ((Node[i]==NULL)&&(ID(theNode)==idList[i]))
{
Node[i] = theNode;
found++;
}
}
if (found==n) break;
}
if (found!=n)
{
PrintErrorMessage('E',"InsertElementFromIDs",
"could not find all nodes");
return(NULL);
}
return (InsertElement(GRID_ON_LEVEL(theMG,0),n,Node,NULL,NULL,bnds_flag));
}
/****************************************************************************/
/** \brief Delete an element
......@@ -5816,49 +5597,6 @@ INT NS_DIM_PREFIX DeleteElement (MULTIGRID *theMG, ELEMENT *theElement) /* 3D VE
}
/****************************************************************************/
/** \todo Please doc me!
DeleteElementWithID -
SYNOPSIS:
INT DeleteElementWithID (MULTIGRID *theMG, INT id);
* @param theMG
* @param id
DESCRIPTION:
@return
INT
*/
/****************************************************************************/
INT NS_DIM_PREFIX DeleteElementWithID (MULTIGRID *theMG, INT id)
{
GRID *theGrid;
ELEMENT *theElement;
/* check level */
if ((CURRENTLEVEL(theMG)!=0)||(TOPLEVEL(theMG)!=0))
{
PrintErrorMessage('E',"DeleteElementWithId","only a multigrid with exactly one level can be edited");
RETURN(GM_ERROR);
}
theGrid = GRID_ON_LEVEL(theMG,0);
/* find element */
for (theElement=FIRSTELEMENT(theGrid); theElement!=NULL; theElement=SUCCE(theElement))
if (ID(theElement)==id) break;
if (theElement==NULL)
{
PrintErrorMessage('E',"DeleteElementWithId","element not found");
RETURN(GM_ERROR);
}
return (DeleteElement(theMG,theElement));
}
/****************************************************************************/
/** \brief Insert a mesh described by the domain
......
......@@ -123,7 +123,6 @@ INT DisposeTopLevel (MULTIGRID *theMG);
INT DisposeNode (GRID *theGrid, NODE *theNode);
/* miscellaneous */
ELEMENT *FindFather (VERTEX *vptr);
INT FindNeighborElement (const ELEMENT *theElement, INT Side, ELEMENT **theNeighbor, INT *NeighborSide);
bool PointInElement (const DOUBLE*, const ELEMENT *theElement);
INT PointOnSide (const DOUBLE *global, const ELEMENT *theElement, INT side);
......
......@@ -70,9 +70,6 @@ using namespace PPIF;
/* numerics module */
#include "np/initnumerics.h"
/* user interface module */
#include "ui/initui.h"
/* own header */
#include "initug.h"
......@@ -251,17 +248,6 @@ INT NS_DIM_PREFIX InitUg (int *argcp, char ***argvp)
return (1);
}
/* init the ui module */
if ((err = InitUi (argcp[0], argvp[0])) != 0)
{
printf
("ERROR in InitUg while InitUi (line %d): called routine line %d\n",
(int) HiWrd (err), (int) LoWrd (err));
printf ("aborting ug\n");
return (1);
}
return (0);
}
......@@ -285,18 +271,6 @@ ExitUg (void)
{
INT err;
/* exit ui module */
PRINTDEBUG (init, 1, ("%d: ExitUi()...\n", me))
if ((err = ExitUi ()) != 0)
{
printf
("ERROR in ExitUg while ExitUi (line %d): called routine line %d\n",
(int) HiWrd (err), (int) LoWrd (err));
printf ("aborting ug\n");
return (1);
}
/* exit gm module */
PRINTDEBUG (init, 1, ("%d: ExitGm()...\n", me))
if ((err = ExitGm ()) != 0)
......
......@@ -142,8 +142,8 @@ INT NS_PREFIX GetLocalizedDefaultValue (const char *filename, const char *name,
while (curr!=NULL && *curr!=0)
{
if (sscanf(curr,
expandfmt(CONCAT5(" %",NAMELENSTR,"[0-9a-zA-Z_] %",
BUFFLENSTR,"[ -~]")), Name,value) ==2)
expandfmt(" %" NAMELENSTR "[0-9a-zA-Z_] %" BUFFLENSTR "[ -~]"),
Name, value) == 2)
{
if (strcmp(Name,name)==0) return(0);
}
......@@ -167,8 +167,8 @@ INT NS_PREFIX GetLocalizedDefaultValue (const char *filename, const char *name,
while (fgets(buffer,255,defaultsFile)!=NULL)
{
if (sscanf(buffer,
expandfmt(CONCAT5(" %",NAMELENSTR,"[0-9a-zA-Z_] %",
BUFFLENSTR,"[ -~]")),Name,value) ==2)
expandfmt(" %" NAMELENSTR "[0-9a-zA-Z_] %" BUFFLENSTR "[ -~]"),
Name, value) == 2)
{
if (strcmp(Name,name)==0) {
fclose(defaultsFile);
......
......@@ -73,14 +73,6 @@ START_UG_NAMESPACE
#define MIN(x,y) (((x)<(y)) ? (x) : (y))
#define MAX(x,y) (((x)>(y)) ? (x) : (y))
#define POW2(i) (1<<(i))
#define ABSDIFF(a,b) (fabs((a)-(b)))
#define SIGNUM(x) (((x)>0) ? 1 : ((x)<0) ? -1 : 0)
#define FSIGNUM(x) (((x)>SMALL_F) ? 1 : ((x)<-SMALL_F) ? -1 : 0)
#define DSIGNUM(x) (((x)>SMALL_D) ? 1 : ((x)<-SMALL_D) ? -1 : 0)
#define EVEN(i) (!(i%2))
#define ODD(i) ((i%2))
#define SWAP(a,b,temp) {(temp) = (a); (a) = (b); (b) = (temp);}
#define QUOT(i,j) ((double)(i))/((double)(j))
#define SET_FLAG(flag,bitpattern) (flag |= (bitpattern))
#define CLEAR_FLAG(flag,bitpattern) (flag &= ~(bitpattern))
......@@ -92,14 +84,6 @@ START_UG_NAMESPACE
#define SetHiWrd(aLong,n) aLong = (((n)&0xFFFF)<<16)|((aLong)&0xFFFF)
#define SetLoWrd(aLong,n) aLong = ((n)&0xFFFF)|((aLong)&0xFFFF0000)
/* concatenation macros with one level of indirection to allow argument expansion */
#define CONCAT3(a,b,c) CONCAT3_AUX(a,b,c)
#define CONCAT3_AUX(a,b,c) a b c
#define CONCAT4(a,b,c,d) CONCAT4_AUX(a,b,c,d)
#define CONCAT4_AUX(a,b,c,d) a b c d
#define CONCAT5(a,b,c,d,e) CONCAT5_AUX(a,b,c,d,e)
#define CONCAT5_AUX(a,b,c,d,e) a b c d e
/* concatenation macros for preprocessor */
#define XCAT(a,b) a ## b
#define XCAT3(a,b,c) a ## b ## c
......@@ -120,17 +104,6 @@ START_UG_NAMESPACE
#endif
#define OFF 0
#define BOOL_2_YN(b) ((b) ? "YES" : "NO")
#define BOOL_2_TF(b) ((b) ? "true" : "false")
#define BOOL_2_NF(b) ((b) ? "ON" : "OFF")
/* switching by strings */
#define STR_SWITCH(str) if (1) {const char *StrPtr=str; if (0) StrPtr=str; /* dummy 'if' to admit 'else if' for cases */
#define STR_CASE(opt) else if (strncmp(StrPtr,opt,strlen(opt))==0) {
#define STR_BREAK }
#define STR_DEFAULT else {
#define STR_SWITCH_END }
/****************************************************************************/
/* */
/* definition of exported global variables */
......
......@@ -226,8 +226,8 @@ INT NS_PREFIX ReadArgvChar (const char *name, char *buffer, INT argc, char **arg
for (i=0; i<argc; i++)
if (argv[i][0]==name[0]) {
if (sscanf(argv[i],
expandfmt(CONCAT5("%",OPTIONLENSTR,"[a-zA-Z0-9_] %",
VALUELENSTR,"[ -~]")),option,value)!=2)
expandfmt("%" OPTIONLENSTR "[a-zA-Z0-9_] %" VALUELENSTR "[ -~]"),
option, value) != 2)
continue;
if (strcmp(option,name) == 0) {
strcpy(buffer,value);
......
......@@ -302,86 +302,4 @@ REFERENCES:
Structures for Regular Local Mesh Refinement. In: Scientific Computing,
IMACS, North-Holland, Amsterdam, 1983.
\section commands User commands for the UG shell script
Commands are used on the shell or in a script to perform ug functions
and to pass parameters, e. g.
.n 'clear x $a $v 0'
resets 'x' on a specified value. The parameters are separated by '$'.
Here, the first parameter follows after the command name,
the option '$a' performs this command on all levels and '$v'
specifies the value.
All ug commands can be found in 'commands.c'. On the shell,
'help \<command\>' will give information on the command,
'checkhelp' prints a list of all commands where the help entry is
missing.
\subsection howto How to Create User Commands
To include a new command to `ug3` one has to provide a
Command function. The Command function has a fixed form.
The fixed form in detail is described in the example below.
The only purpose of the command function is to read the parameters
and to call the corresponding ug functions.
A command function has as arguments only the variables
'INT arg' and 'char **argv' to pass the parameters.
The command function has to give back
'return' values, that means error codes, in a mode typical to `ug3`.
The possible and expected 'return' values are 'OKCODE',
'PARAMERRCODE' and 'CMDERRORCODE'.
Finally, the user has to enter the command function in an initialization
process.
There the user has to include the new command with the 'CreateCommand'
function.
\subsection Example
As guided example the embedding of the 'MakeStructCommand' is
demonstrated step by step.
\verbatim
static INT MakeStructCommand (INT argc, char **argv)
{
INT res;
char name[LONGSTRSIZE];
NO_OPTION_CHECK(argc,argv);
res = sscanf(argv[0],expandfmt(CONCAT3(" ms %",LONGSTRLENSTR,
"[0-9:.a-zA-Z_]")),name);
if (res!=1)
{
PrintErrorMessage('E', "MakeStructCommand", "could not read name of struct");
return(PARAMERRORCODE);
}
if (MakeStruct(name)!=0)
return (CMDERRORCODE);
else
return (OKCODE);
}
\endverbatim
\subsection Initialization
All commands have to be built with 'CreateCommand'. All ug commands
are inizialized in 'commands.c', the problem specific commands
can be created in the corresponding 'pclib'.
\verbatim
INT InitCommands ()
{
if (CreateCommand("ms",MakeStructCommand)==NULL) return (__LINE__);
...
return(0);
}
\endverbatim
In this case, the name of the command is `ms`.
\sa
'interpreter', 'unixcommands'
*/
\ No newline at end of file
......@@ -2497,7 +2497,7 @@ INT NS_DIM_PREFIX CreateFormatCmd (INT argc, char **argv)
int n,depth;
/* scan name of format */
if ((sscanf(argv[0],expandfmt(CONCAT3(" newformat %",NAMELENSTR,"[ -~]")),formatname)!=1) || (strlen(formatname)==0)) {
if (sscanf(argv[0],expandfmt(" newformat %" NAMELENSTR "[ -~]"), formatname) != 1 || strlen(formatname) == 0) {
PrintErrorMessage('E',"newformat","no format name specified");
REP_ERR_RETURN (1);
}
......
......@@ -224,7 +224,7 @@ VECDATA_DESC * NS_DIM_PREFIX ReadArgvVecDescX (MULTIGRID *theMG, const char *nam
if (ReadArgvChar(name,value,argc,argv))
return(NULL);
res = sscanf(value,expandfmt(CONCAT5("%",NAMELENSTR,"[a-zA-Z0-9_] / %",NAMELENSTR,"[a-zA-Z0-9_]")),vdname,tname);
res = sscanf(value,expandfmt("%" NAMELENSTR "[a-zA-Z0-9_] / %" NAMELENSTR "[a-zA-Z0-9_]"),vdname,tname);
vd = GetVecDataDescByName(theMG,vdname);
if (vd == NULL && CreateIfNonExistent)
{
......@@ -363,7 +363,7 @@ VEC_TEMPLATE * NS_DIM_PREFIX ReadArgvVecTemplate (const FORMAT *fmt, const char
if (ReadArgvChar(name,value,argc,argv))
return(NULL);
if (sscanf(value,expandfmt(CONCAT3("%",NAMELENSTR,"[a-zA-Z0-9_]")),vtname)!=1)
if (sscanf(value, expandfmt("%" NAMELENSTR "[a-zA-Z0-9_]"), vtname) != 1)
return(NULL);
return(GetVectorTemplate(fmt,vtname));
......@@ -410,7 +410,7 @@ VEC_TEMPLATE * NS_DIM_PREFIX ReadArgvVecTemplateSub (const FORMAT *fmt, const ch
if (ReadArgvChar(name,value,argc,argv))
return(NULL);
res = sscanf(value,expandfmt(CONCAT5("%",NAMELENSTR,"[a-zA-Z0-9_] %",NAMELENSTR,"[a-zA-Z0-9_]")),vtname,subname);
res = sscanf(value,expandfmt("%" NAMELENSTR "[a-zA-Z0-9_] %" NAMELENSTR "[a-zA-Z0-9_]"),vtname,subname);
if (res<1)
return (NULL);
......@@ -476,7 +476,7 @@ MAT_TEMPLATE * NS_DIM_PREFIX ReadArgvMatTemplateSub (const FORMAT *fmt, const ch
if (ReadArgvChar(name,value,argc,argv))
return (NULL);
res = sscanf(value,expandfmt(CONCAT5("%",NAMELENSTR,"[a-zA-Z0-9_] %",NAMELENSTR,"[a-zA-Z0-9_]")),mtname,subname);
res = sscanf(value,expandfmt("%" NAMELENSTR "[a-zA-Z0-9_] %" NAMELENSTR "[a-zA-Z0-9_]"),mtname,subname);
if (res<1)
return (NULL);
......@@ -567,9 +567,8 @@ MATDATA_DESC * NS_DIM_PREFIX ReadArgvMatDescX (MULTIGRID *theMG, const char *nam
if (ReadArgvChar(name,value,argc,argv))
return (NULL);
res = sscanf(value,expandfmt(CONCAT5("%",NAMELENSTR,
"[a-zA-Z0-9_] / %",
NAMELENSTR,"[a-zA-Z0-9_]")),
res = sscanf(value,
expandfmt("%" NAMELENSTR "[a-zA-Z0-9_] / %" NAMELENSTR "[a-zA-Z0-9_]"),
mdname,tname);
md = GetMatDataDescByName(theMG,mdname);
if (md==NULL && CreateIfNonExistent)
......@@ -1182,7 +1181,7 @@ INT NS_DIM_PREFIX sc_read (VEC_SCALAR x, const FORMAT *fmt, const VECDATA_DESC *
/* find input string */
found = false;
for (i=0; i<argc; i++)
if (sscanf(argv[i],expandfmt(CONCAT5("%",OPTIONLENSTR,"[a-zA-Z0-9_] %",VALUELENSTR,"[ -~]")),option,value)==2)
if (sscanf(argv[i],expandfmt("%" OPTIONLENSTR "[a-zA-Z0-9_] %" VALUELENSTR "[ -~]"),option,value)==2)
if (strcmp(option,name) == 0)
{
found = true;
......
Please don't remove!
Please don't remove!
set(SOURCES initui.cc cmdline.cc
commands.cc
)
install(FILES cmdint.h cmdline.h commands.h
install(FILES commands.h
DESTINATION ${CMAKE_INSTALL_PKGINCLUDEDIR})
ug_add_dim_libs(ugui OBJECT SOURCES ${SOURCES})
ug_add_dim_libs(ugui OBJECT SOURCES commands.cc)
#ifndef __CMDINT__
#define __CMDINT__
#include "cmdline.h"
#define cmdintbufsize 32000
#endif
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
/****************************************************************************/
/* */
/* File: cmdline.c */
/* */
/* Purpose: command structure and execution */
/* */
/* Author: Peter Bastian */
/* Institut fuer Computeranwendungen III */
/* Universitaet Stuttgart */
/* Pfaffenwaldring 27 */
/* 70569 Stuttgart */
/* email: ug@ica3.uni-stuttgart.de */
/* */
/* History: 17.12.94 begin, ug version 3.0 */
/* */
<