Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lab5-metaprogramming-and-debugging-lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Daniel Olsson
lab5-metaprogramming-and-debugging-lab
Commits
0e7430c8
Commit
0e7430c8
authored
5 years ago
by
Daniel Olsson
Browse files
Options
Downloads
Patches
Plain Diff
Finished the lab with the line number changes
parent
059cf5f6
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
debugging/fileutil.cpp
+3
-3
3 additions, 3 deletions
debugging/fileutil.cpp
debugging/workitems.c
+1
-3
1 addition, 3 deletions
debugging/workitems.c
julia/dowhile.jl
+13
-18
13 additions, 18 deletions
julia/dowhile.jl
with
17 additions
and
24 deletions
debugging/fileutil.cpp
+
3
−
3
View file @
0e7430c8
...
...
@@ -20,8 +20,8 @@ using namespace std;
int
main
(
int
argc
,
char
**
argv
)
{
int
cur
=
0
;
char
*
lines
[
35000
];
char
line
[
70
0
];
char
*
lines
[
16536
];
char
line
[
8
0
];
// Fix num lines, num columns, strdup-1
FILE
*
fin
=
fopen
(
"bible.txt"
,
"r"
);
if
(
fin
==
NULL
){
...
...
@@ -30,7 +30,7 @@ int main(int argc, char **argv)
}
while
(
!
feof
(
fin
))
{
getline
(
line
,
fin
);
lines
[
cur
]
=
(
char
*
)
malloc
(
strlen
(
line
)
+
1
);
lines
[
cur
]
=
(
char
*
)
malloc
(
strlen
(
line
)
+
1
);
strcpy
(
lines
[
cur
],
line
);
cur
++
;
}
...
...
This diff is collapsed.
Click to expand it.
debugging/workitems.c
+
1
−
3
View file @
0e7430c8
...
...
@@ -24,7 +24,6 @@ static void* launchThread(void *in)
while
(
1
)
{
pthread_mutex_lock
(
&
lock
);
n
=
data
->
current
++
;
//printf("%d\n",data->current);
if
(
n
>=
data
->
len
){
pthread_mutex_unlock
(
&
lock
);
break
;
...
...
@@ -32,7 +31,6 @@ static void* launchThread(void *in)
data
->
fn
(
&
data
->
data
[
n
]);
pthread_mutex_unlock
(
&
lock
);
}
//rintf("Jag är ute\n" );
return
NULL
;
}
...
...
@@ -79,7 +77,7 @@ int main(int argc, char **argv)
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
vals
[
i
]
=
i
*
1
.
5
;
}
launchParallel
(
8
/* Increase this if no error occurs */
,
vals
,
100
,
mul2
);
launchParallel
(
4
/* Increase this if no error occurs */
,
vals
,
100
,
mul2
);
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
if
(
vals
[
i
]
!=
1
.
5
*
2
*
i
)
{
...
...
This diff is collapsed.
Click to expand it.
julia/dowhile.jl
+
13
−
18
View file @
0e7430c8
function
adjustLines
(
res
,
macrofile
,
invokedFile
,
invokedLine
)
sz
=
size
(
res
.
args
)
dump
(
res
)
temp
=
copy
(
res
)
for
i
=
1
:
sz
[
1
]
if
isa
(
temp
.
args
[
i
],
LineNumberNode
)
if
(
String
(
temp
.
args
[
i
]
.
file
)
==
macrofile
)
file
=
temp
.
args
[
i
]
.
line
=
invokedLine
if
(
typeof
(
res
)
==
Expr
)
#Loop thorugh all args
for
i
=
1
:
size
(
res
.
args
)[
1
]
#Check if is a LineNumberNode
if
(
typeof
(
res
.
args
[
i
])
==
LineNumberNode
)
#Check if it is the macrofile and then change the file and line
#otherwise do nothing
if
(
String
(
res
.
args
[
i
]
.
file
)
==
String
(
macrofile
))
res
.
args
[
i
]
=
LineNumberNode
(
invokedLine
,
invokedFile
)
end
#Recusive expression if res.args[i] is a Expr
elseif
(
typeof
(
res
)
==
Expr
)
res
.
args
[
i
]
=
adjustLines
(
res
.
args
[
i
],
macrofile
,
invokedFile
,
invokedLine
)
end
#println(i)
#println(res.args[i].file)
else
#println(i)
#println("Nej")
end
#println(i)
#println(res.args[i].args)
end
return
res
end
...
...
@@ -24,8 +22,6 @@ macro doWhile(block, cond)
# println("__source__ ", __source__)
#println("cond ", cond)
#println("block ", block)
res
=
quote
#error("TODO: Your code here")
$
(
esc
(
block
))
...
...
@@ -34,7 +30,6 @@ macro doWhile(block, cond)
end
end
res
=
adjustLines
(
res
,
@__FILE__
(),
__source__
.
file
,
__source__
.
line
)
println
(
"Here is the whole"
)
println
(
res
)
# Should not print any lines referencing dowhile.jl
res
end
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