Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Frida
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
Frida
Commits
8a8938da
Commit
8a8938da
authored
14 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
gf works with new readln interface
parent
28d2fc68
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pub/src/dualplot.cpp
+3
-3
3 additions, 3 deletions
pub/src/dualplot.cpp
pub/src/mystd.cpp
+20
-10
20 additions, 10 deletions
pub/src/mystd.cpp
pub/src/mystd.h
+1
-1
1 addition, 1 deletion
pub/src/mystd.h
with
24 additions
and
14 deletions
pub/src/dualplot.cpp
+
3
−
3
View file @
8a8938da
...
@@ -282,9 +282,9 @@ void CPlot::writePostscript( string ps_outdir, string ps_head, string ps_dict )
...
@@ -282,9 +282,9 @@ void CPlot::writePostscript( string ps_outdir, string ps_head, string ps_dict )
while
(
1
)
{
while
(
1
)
{
if
(
ps_fnum
>=
999
)
if
(
ps_fnum
>=
999
)
throw
string
(
"graph file number overflow"
);
throw
string
(
"graph file number overflow"
);
outf
=
mystd
::
glob_one_fil
e
(
outf
=
mystd
::
wordexp_uniqu
e
(
ps_outdir
+
str
(
format
(
"l%d
.
"
)
%
++
ps_fnum
)
,
ps_outdir
+
str
(
format
(
"l%d"
)
%
++
ps_fnum
)
+
"."
+
ps_dict
==
""
?
"psa"
:
"ps"
);
(
ps_dict
==
""
?
"psa"
:
"ps"
)
);
if
(
!
(
pssav
=
fopen
(
outf
.
c_str
(),
"r"
)
)
)
if
(
!
(
pssav
=
fopen
(
outf
.
c_str
(),
"r"
)
)
)
break
;
// legal exit
break
;
// legal exit
fclose
(
pssav
);
fclose
(
pssav
);
...
...
This diff is collapsed.
Click to expand it.
pub/src/mystd.cpp
+
20
−
10
View file @
8a8938da
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include
<math.h>
#include
<math.h>
#include
<sys/time.h>
#include
<sys/time.h>
#include
<glob.h>
#include
<glob.h>
#include
<wordexp.h>
#include
<iostream>
#include
<iostream>
#include
<boost/format.hpp>
#include
<boost/format.hpp>
...
@@ -442,6 +443,21 @@ void mystd::fname_divide( const string& fname,
...
@@ -442,6 +443,21 @@ void mystd::fname_divide( const string& fname,
}
}
}
}
//! Bash expansion of file name.
string
mystd
::
wordexp_unique
(
const
string
&
s
)
{
wordexp_t
p
;
if
(
wordexp
(
s
.
c_str
(),
&
p
,
0
)
)
throw
"cannot expand "
+
s
;
if
(
p
.
we_wordc
!=
1
)
throw
"expansion of "
+
s
+
" not unique"
;
string
ret
=
p
.
we_wordv
[
0
];
wordfree
(
&
p
);
return
ret
;
}
int
mystd
::
glob_file_list
(
const
string
&
text
,
const
string
&
ext
,
int
mystd
::
glob_file_list
(
const
string
&
text
,
const
string
&
ext
,
vector
<
string
>
*
flong
,
vector
<
string
>
*
fshort
)
vector
<
string
>
*
flong
,
vector
<
string
>
*
fshort
)
// input:
// input:
...
@@ -477,16 +493,10 @@ int mystd::glob_file_list( const string& text, const string& ext,
...
@@ -477,16 +493,10 @@ int mystd::glob_file_list( const string& text, const string& ext,
return
flong
->
size
();
return
flong
->
size
();
}
}
string
mystd
::
glob_one_file
(
const
string
&
text
,
const
string
&
ext
)
{
//! Read one line from file.
vector
<
string
>
flong
,
fshort
;
int
ret
=
glob_file_list
(
text
,
ext
,
&
flong
,
&
fshort
);
// OBSOLETE: replace by simpler version from read-plus
if
(
ret
<
1
)
throw
"invalid file name "
+
text
;
else
if
(
ret
>
1
)
throw
"file name "
+
text
+
" not unique"
;
return
flong
[
0
];
}
int
mystd
::
freadln
(
FILE
*
fd
,
string
*
s
)
int
mystd
::
freadln
(
FILE
*
fd
,
string
*
s
)
{
{
...
...
This diff is collapsed.
Click to expand it.
pub/src/mystd.h
+
1
−
1
View file @
8a8938da
...
@@ -56,7 +56,7 @@ namespace mystd {
...
@@ -56,7 +56,7 @@ namespace mystd {
string
*
fshort
,
string
*
fext
);
string
*
fshort
,
string
*
fext
);
int
glob_file_list
(
const
string
&
text
,
const
string
&
ext
,
int
glob_file_list
(
const
string
&
text
,
const
string
&
ext
,
vector
<
string
>
*
flong
,
vector
<
string
>
*
fshort
=
0
);
vector
<
string
>
*
flong
,
vector
<
string
>
*
fshort
=
0
);
string
glob_one_fil
e
(
const
string
&
text
,
const
string
&
ext
=
""
);
string
wordexp_uniqu
e
(
const
string
&
s
);
int
freadln
(
FILE
*
fd
,
string
*
s
);
int
freadln
(
FILE
*
fd
,
string
*
s
);
// integration
// integration
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment