Skip to content

Commit

Permalink
Merge pull request #17 from sanbee/hotfix_fullval
Browse files Browse the repository at this point in the history
Hotfix fullval for a bug in clgetFullValp()
  • Loading branch information
preshanth authored Aug 23, 2024
2 parents 9ca92d6 + 59ff7d7 commit 67310ab
Show file tree
Hide file tree
Showing 15 changed files with 65 additions and 10 deletions.
1 change: 1 addition & 0 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ set(header_list
clshelldefs.h
clsh.h
clstring.h
clparseVal.h
ErrorObj.h
rl_interface.h
setAutoDefaults.h
Expand Down
2 changes: 1 addition & 1 deletion code/cl.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int dowarranty(char *);
#ifdef __cplusplus
int loadDefaults(int complement=1);
#endif
int clparseVal(Symbol *, int *, double *);
//int clparseVal(Symbol *, int *, double *);
#ifdef __cplusplus
void reportParseError(const Symbol& S, const int& N);
int PrintVals(FILE *f,Symbol *S,unsigned int newline=1);
Expand Down
2 changes: 2 additions & 0 deletions code/cldbggetBVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <cllib.h>
#include <shell.h>
#include <support.h>
#include <clparseVal.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
2 changes: 2 additions & 0 deletions code/cldbggetFVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <shell.h>
#include <cllib.h>
#include <support.h>
#include <clparseVal.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
1 change: 1 addition & 0 deletions code/cldbggetIVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <cllib.h>
#include <shell.h>
#include <support.h>
#include <clparseVal.h>
#ifdef __cplusplus
extern "C" {
#endif
Expand Down
1 change: 1 addition & 0 deletions code/cldbggetNBVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/* $Id$ */
#include <cllib.h>
#include <sstream>
#include <clparseVal.h>

#ifdef __cplusplus
/* extern "C" { */
Expand Down
2 changes: 1 addition & 1 deletion code/cldbggetNFVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/* $Id: cldbggetNFVal.c,v 2.0 1998/11/11 07:13:00 sanjay Exp $ */
#include <cllib.h>
#include <sstream>

#include <clparseVal.h>
#ifdef __cplusplus
extern "C" {
#endif
Expand Down
1 change: 1 addition & 0 deletions code/cldbggetNIVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/* $Id: cldbggetNIVal.c,v 2.0 1998/11/11 07:13:00 sanjay Exp $ */
#include <cllib.h>
#include <sstream>
#include <clparseVal.h>
#ifdef __cplusplus
/* extern "C" { */
/* #endif */
Expand Down
5 changes: 3 additions & 2 deletions code/clgetBaseCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@
#include <shell.h>
#include <support.h>
#include <setAutoDefaults.h>
#include <clparseVal.h>
#include <type_traits>
#include <cl.h>

template <class T>
Symbol* clgetBaseCode(const string& Name, T& val, int& n, SMap &smap=SMap(), bool dbg=false)
{
Symbol *S;
string type_str="";
uint type_int=0;
string type_str="Mixed";
uint type_int=CL_MIXEDTYPE;
//
// Set type string and type integer value based on the type of T
//
Expand Down
24 changes: 20 additions & 4 deletions code/clgetFullVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <cllib.h>
#include <support.h>
#include <setAutoDefaults.h>
#include <clparseVal.h>
#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -70,22 +71,38 @@ extern "C" {
#ifdef __cplusplus
int clgetFullValp(const string& Name, string& val)
{
int n,i;
Symbol *S;

HANDLE_EXCEPTIONS(
S=SearchQSymb((char*)Name.c_str(),"Mixed[]");
if (S != NULL)
{
SETBIT(S->Attributes,CL_MIXEDTYPE);
S->Class=CL_APPLNCLASS;
//if (dbg) S->Class=CL_DBGCLASS;

VString vstr={val};
setAutoDefaults<std::string>(S,vstr,true);
setAutoDefaults<std::string>(S,vstr);//,true);

val = vecStr2Str(S->Val);
//val = vecStr2Str(S->Val);
}
)

int N = 1;
clparseVal(S,&N,val); // The function with val type string does not link. Don't know why.
// if (S!=NULL)
// {
// if (N <= S->NVals)
// {
// val = trim(S->Val[N-1]);
// return val.size();
// }
// else
// return CL_FAIL;
// }

return S->Val.size();

// // setAutoSDefaults(S,val,1);
// if ((n=clgetNVals((char *)Name.c_str()))>0)
// {
Expand All @@ -107,6 +124,5 @@ int clgetFullValp(const string& Name, string& val)
// val = val + tmp;
// }
// }
return S->Val.size();
}
#endif
1 change: 1 addition & 0 deletions code/clgetNBVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <support.h>
#include <sstream>
#include <clgetBaseCode.h>
#include <clparseVal.h>
#ifdef __cplusplus
extern "C" {
#endif
Expand Down
1 change: 1 addition & 0 deletions code/clhashdefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define CL_STRINGTYPE 128
#define CL_CMDLINETYPE 256
#define CL_BOOLTYPE 512
#define CL_MIXEDTYPE 1024

#define CL_ARG_NONE 1
#define CL_ARG_FILENAME 2
Expand Down
2 changes: 2 additions & 0 deletions code/clparseVal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ int clparseVal(Symbol *S, int *Which, string& val)
return CL_FAIL;

}


int clparseVal(Symbol *S, int *Which, double *d)
{
unsigned int N = _ABS(*Which),n;
Expand Down
25 changes: 25 additions & 0 deletions code/clparseVal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2000-2021, 2022 S. Bhatnagar (bhatnagar dot sanjay at gmail dot com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef CLPARSEVAL_H
#define CLPARSEVAL_H
#include <cl.h>

int clparseVal(Symbol *S, int *Which, double* val);
int clparseVal(Symbol *S, int *which, string& val);
#endif
5 changes: 3 additions & 2 deletions code/tstcpp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ void UI(bool restart, int argc, char **argv)

// Set the application to be non-interactive by default.
// The setting can be changed via the help=prompt keyword.
clSetPrompt(false);
// clSetPrompt(false);
clSetPrompt(true);

if (!restart)
{
Expand All @@ -41,7 +42,7 @@ void UI(bool restart, int argc, char **argv)
clRetry();
try
{
clCmdLineFirst();
//clCmdLineFirst();
{
SMap watchPoints; VString exposedKeys;
InitMap(watchPoints,exposedKeys);
Expand Down

0 comments on commit 67310ab

Please sign in to comment.