profiling
@@ -7,7 +7,7 @@ set exeName=slime.exe
|
|||||||
taskkill /F /IM %exeName% > NUL 2> NUL
|
taskkill /F /IM %exeName% > NUL 2> NUL
|
||||||
|
|
||||||
echo ---------- Compiling ----------
|
echo ---------- Compiling ----------
|
||||||
call ..\timecmd cl ^
|
call cl ^
|
||||||
../src/main.cpp^
|
../src/main.cpp^
|
||||||
/I../3rd/ ^
|
/I../3rd/ ^
|
||||||
/D_PROFILING /D_DEBUG ^
|
/D_PROFILING /D_DEBUG ^
|
||||||
@@ -25,7 +25,7 @@ if %errorlevel% == 0 (
|
|||||||
echo.
|
echo.
|
||||||
echo ---- Running Tests ----
|
echo ---- Running Tests ----
|
||||||
echo.
|
echo.
|
||||||
call timecmd slime.exe --run-tests
|
call slime.exe --run-tests
|
||||||
) else (
|
) else (
|
||||||
echo.
|
echo.
|
||||||
echo Fuckin' ell
|
echo Fuckin' ell
|
||||||
|
|||||||
@@ -1,149 +0,0 @@
|
|||||||
nconst,character,start,end
|
|
||||||
nm0221046,Actor2,53000,237000
|
|
||||||
nm0330687,Actor1,53000,237000
|
|
||||||
nm0569501,Narrator,64000,237000
|
|
||||||
nm0932891,Actor3,72000,237000
|
|
||||||
nm3068638,Actor1 - Age 12,81000,237000
|
|
||||||
nm2788212,Actor2 - Age 12,97000,237000
|
|
||||||
nm1631269,Actor4,240000,424000
|
|
||||||
nm0034309,Actor5,258000,424000
|
|
||||||
nm1131557,Actor6,258000,424000
|
|
||||||
nm0330687,Actor1,273000,424000
|
|
||||||
nm0221046,Actor2,305000,424000
|
|
||||||
nm0034309,Actor5,425000,558000
|
|
||||||
nm0329622,Office Worker,427000,558000
|
|
||||||
nm0330687,Actor1,427000,558000
|
|
||||||
nm0932891,Actor3,427000,558000
|
|
||||||
nm0381763,Actor7,433000,558000
|
|
||||||
nm0803331,Usher,433000,558000
|
|
||||||
nm0163988,Actor8,443000,558000
|
|
||||||
nm0221046,Actor2,449000,558000
|
|
||||||
nm0569501,Narrator,472000,558000
|
|
||||||
nm0221046,Actor2,560000,647000
|
|
||||||
nm0034309,Actor5,561000,647000
|
|
||||||
nm0330687,Actor1,564000,647000
|
|
||||||
nm0163988,Actor8,650000,813000
|
|
||||||
nm0735538,Employee #1,650000,813000
|
|
||||||
nm0330687,Actor1,652000,813000
|
|
||||||
nm0006970,Actor9,654000,813000
|
|
||||||
nm0803331,Usher,656000,813000
|
|
||||||
nm0221046,Actor2,660000,813000
|
|
||||||
nm0034309,Actor5,661000,813000
|
|
||||||
nm0932891,Actor3,699000,813000
|
|
||||||
nm0330687,Actor1,815000,1013000
|
|
||||||
nm1131557,Actor6,815000,1013000
|
|
||||||
nm0221046,Actor2,821000,1013000
|
|
||||||
nm1631269,Actor4,865000,1013000
|
|
||||||
nm0034309,Actor5,888000,1013000
|
|
||||||
nm0034309,Actor5,1014000,1119000
|
|
||||||
nm0330687,Actor1,1014000,1119000
|
|
||||||
nm0221046,Actor2,1048000,1119000
|
|
||||||
nm0330687,Actor1,1119000,1348000
|
|
||||||
nm0034309,Actor5,1126000,1348000
|
|
||||||
nm0221046,Actor2,1126000,1348000
|
|
||||||
nm0006970,Actor9,1279000,1348000
|
|
||||||
nm0330687,Actor1,1348000,1469000
|
|
||||||
nm0221046,Actor2,1348000,1469000
|
|
||||||
nm0034309,Actor5,1348000,1469000
|
|
||||||
nm0221046/trivia,nt0447626,1377000,1469000
|
|
||||||
nm0330687,Actor1,1470000,1619000
|
|
||||||
nm0221046,Actor2,1471000,1619000
|
|
||||||
nm1131557,Actor6,1547000,1619000
|
|
||||||
nm0330687,Actor1,1622000,1839000
|
|
||||||
nm0221046,Actor2,1627000,1839000
|
|
||||||
nm2124215,Actor10,1752000,1839000
|
|
||||||
nm0330687,Actor1,1839000,2006000
|
|
||||||
nm0221046,Actor2,1839000,2006000
|
|
||||||
nm0000148,Self,1910000,2006000
|
|
||||||
nm0330687,Actor1,2008000,2066000
|
|
||||||
nm0163988,Actor8,2019000,2066000
|
|
||||||
nm1304328,New Secretary,2019000,2066000
|
|
||||||
nm0034309,Actor5,2025000,2066000
|
|
||||||
nm0221046,Actor2,2052000,2066000
|
|
||||||
nm0034309,Actor5,2068000,2293000
|
|
||||||
nm0221046,Actor2,2068000,2293000
|
|
||||||
nm0330687,Actor1,2074000,2293000
|
|
||||||
nm0221046,Actor2,2295000,2482000
|
|
||||||
nm0330687,Actor1,2295000,2482000
|
|
||||||
nm0569501,Narrator,2315000,2482000
|
|
||||||
nm1131557,Actor6,2433000,2482000
|
|
||||||
nm0034309,Actor5,2437000,2482000
|
|
||||||
nm0330687,Actor1,2483000,2626000
|
|
||||||
nm1631269,Actor4,2483000,2626000
|
|
||||||
nm0330687/trivia,nt0127470,2539000,2626000
|
|
||||||
nm0221046,Actor2,2557000,2626000
|
|
||||||
nm0221046,Actor2,2630000,2853000
|
|
||||||
nm0330687,Actor1,2630000,2853000
|
|
||||||
nm1071303,Douche,2656000,2853000
|
|
||||||
nm3300012,Girl on the Stairs,2835000,2853000
|
|
||||||
nm0330687,Actor1,2853000,2984000
|
|
||||||
nm0221046,Actor2,2861000,2984000
|
|
||||||
nm0221046/trivia,nt0085270,2908000,2984000
|
|
||||||
nm0221046,Actor2,2985000,3072000
|
|
||||||
nm0330687,Actor1,2987000,3072000
|
|
||||||
nm2622767,Actor11,3050000,3072000
|
|
||||||
nm0330687,Actor1,3072000,3143000
|
|
||||||
nm0221046,Actor2,3073000,3143000
|
|
||||||
nm0221046,Actor2,3148000,3278000
|
|
||||||
nm0330687,Actor1,3148000,3278000
|
|
||||||
nm0897096,Actor12,3194000,3278000
|
|
||||||
nm0533467,Actor13,3209000,3278000
|
|
||||||
nm3505105,Actor14,3249000,3278000
|
|
||||||
nm1304328,New Secretary,3279000,3406000
|
|
||||||
nm0330687,Actor1,3282000,3406000
|
|
||||||
nm0163988,Actor8,3289000,3406000
|
|
||||||
nm0330687,Actor1,3410000,3625000
|
|
||||||
nm0034309,Actor5,3413000,3625000
|
|
||||||
nm0932891,Actor3,3414000,3625000
|
|
||||||
nm0735538,Employee #1,3438000,3625000
|
|
||||||
nm0006970,Actor9,3443000,3625000
|
|
||||||
nm0381763,Actor7,3443000,3625000
|
|
||||||
nm0281068,Actor15,3446000,3625000
|
|
||||||
nm0221046,Actor2,3450000,3625000
|
|
||||||
nm0715377,Bus Driver,3483000,3625000
|
|
||||||
nm1036340,Actor16,3488000,3625000
|
|
||||||
nm0330687,Actor1,3629000,3841000
|
|
||||||
nm0034309,Actor5,3642000,3841000
|
|
||||||
nm0221046,Actor2,3677000,3841000
|
|
||||||
nm0006970,Actor9,3827000,3841000
|
|
||||||
nm2306384,Minister,3827000,3841000
|
|
||||||
nm3505110,Actor9's New Husband,3827000,3841000
|
|
||||||
nm0221046,Actor2,3841000,3984000
|
|
||||||
nm0006970,Actor9,3847000,3984000
|
|
||||||
nm3505110,Actor9's New Husband,3847000,3984000
|
|
||||||
nm0330687,Actor1,3851000,3984000
|
|
||||||
nm3505106,Wedding Singer,3892000,3984000
|
|
||||||
nm1131557,Actor6,3984000,4054000
|
|
||||||
nm0034309,Actor5,3999000,4054000
|
|
||||||
nm0163988,Actor8,4009000,4054000
|
|
||||||
nm0330687,Actor1,4045000,4054000
|
|
||||||
nm0330687,Actor1,4054000,4249000
|
|
||||||
nm0569501,Narrator,4066000,4249000
|
|
||||||
nm0221046,Actor2,4089000,4249000
|
|
||||||
nm1656122,Partygoer,4134000,4249000
|
|
||||||
nm1497668,Rooftop Guy #1,4168000,4249000
|
|
||||||
nm3107009,Another Partygoer,4194000,4249000
|
|
||||||
nm0330687,Actor1,4254000,4305000
|
|
||||||
nm0330687,Actor1,4305000,4514000
|
|
||||||
nm0034309,Actor5,4305000,4514000
|
|
||||||
nm0381763,Actor7,4310000,4514000
|
|
||||||
nm0281068,Actor10,4328000,4514000
|
|
||||||
nm0803331,Usher,4328000,4514000
|
|
||||||
nm0163988,Actor8,4334000,4514000
|
|
||||||
nm0329622,Office Worker,4334000,4514000
|
|
||||||
nm0330687/trivia,nt0127468,4362000,4514000
|
|
||||||
nm0330687,Actor1,4516000,4740000
|
|
||||||
nm1631269,Actor4,4520000,4740000
|
|
||||||
nm1631269/trivia,nt0787786,4533000,4740000
|
|
||||||
nm0221046,Actor2,4583000,4740000
|
|
||||||
nm1071303,Douche,4593000,4740000
|
|
||||||
nm0000163,Ben,4620000,4740000
|
|
||||||
nm0001684,Elaine,4620000,4740000
|
|
||||||
nm0330687,Actor1,4743000,4882000
|
|
||||||
nm0330687/trivia,nt0920755,4751000,4882000
|
|
||||||
nm0221046,Actor2,4851000,4882000
|
|
||||||
nm0330687,Actor1,4885000,5228000
|
|
||||||
nm0221046,Actor2,4907000,5228000
|
|
||||||
nm0330687,Actor1,5230000,5426000
|
|
||||||
nm0569501,Narrator,5240000,5426000
|
|
||||||
nm1310368,Girl at interview,5263000,5426000
|
|
||||||
|
@@ -1,27 +0,0 @@
|
|||||||
import plotly.figure_factory as ff
|
|
||||||
|
|
||||||
df = [
|
|
||||||
{"Task": "call depth 4", "Start": 9321, "Finish": 9326},
|
|
||||||
{"Task": "call depth 3", "Start": 9288, "Finish": 9311},
|
|
||||||
{"Task": "call depth 2", "Start": 9126, "Finish": 9141},
|
|
||||||
{"Task": "call depth 1", "Start": 9088, "Finish": 9099},
|
|
||||||
{"Task": "call depth 0", "Start": 9076, "Finish": 9337},
|
|
||||||
{"Task": "call depth 1", "Start": 9109, "Finish": 9179},
|
|
||||||
{"Task": "call depth 1", "Start": 9194, "Finish": 9334},
|
|
||||||
{"Task": "call depth 2", "Start": 9206, "Finish": 9231},
|
|
||||||
{"Task": "call depth 2", "Start": 9237, "Finish": 9269},
|
|
||||||
{"Task": "call depth 2", "Start": 9274, "Finish": 9331},
|
|
||||||
{"Task": "call depth 3", "Start": 9255, "Finish": 9266},
|
|
||||||
{"Task": "call depth 3", "Start": 9279, "Finish": 9284},
|
|
||||||
{"Task": "call depth 4", "Start": 9299, "Finish": 9309},
|
|
||||||
{"Task": "call depth 3", "Start": 9316, "Finish": 9329},
|
|
||||||
]
|
|
||||||
|
|
||||||
fig = ff.create_gantt(df, group_tasks=True, bar_width=0.4, width=1700, height=720)
|
|
||||||
|
|
||||||
fig["data"][0].update(text="apply_arguments_to_function", hoverinfo="text+x+y")
|
|
||||||
fig["data"][1].update(text="apply_arguments_to_function", hoverinfo="text+x+y")
|
|
||||||
fig["data"][2].update(text="apply_arguments_to_function", hoverinfo="text+x+y")
|
|
||||||
|
|
||||||
|
|
||||||
fig.show()
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import json
|
||||||
|
import csv
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
print("No file was provided")
|
||||||
|
else:
|
||||||
|
trace_events = []
|
||||||
|
call_stack = []
|
||||||
|
with open(sys.argv[1], "r") as in_file:
|
||||||
|
csv_reader = csv.reader(in_file, delimiter=',')
|
||||||
|
for line in csv_reader:
|
||||||
|
if line[0] == "->":
|
||||||
|
call_stack.append(line)
|
||||||
|
elif line[0] == "<-":
|
||||||
|
call = call_stack.pop()
|
||||||
|
trace_events.append({
|
||||||
|
"pid": 1,
|
||||||
|
"tid": 1,
|
||||||
|
"ts" : int(call[1]),
|
||||||
|
"dur": int(line[1])-int(call[1]),
|
||||||
|
"ph" : "X",
|
||||||
|
"name": call[2],
|
||||||
|
"args": {
|
||||||
|
"file": f"({call[3]}:{call[4]})"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
print("invalid syntax")
|
||||||
|
break
|
||||||
|
with open("out.json", "w") as out_file:
|
||||||
|
out_file.write(json.dumps({"traceEvents": trace_events}, indent=4))
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
import pandas as pd
|
|
||||||
import plotly.graph_objs as go
|
|
||||||
|
|
||||||
call_depths = [0]
|
|
||||||
datas = []
|
|
||||||
|
|
||||||
def ensure_big_enough(list, idx, el):
|
|
||||||
l = len(list)
|
|
||||||
if (idx >= l):
|
|
||||||
list.extend([el]*(idx-l+1))
|
|
||||||
|
|
||||||
def incr_call_depth(thread):
|
|
||||||
ensure_big_enough(call_depths, thread, 0)
|
|
||||||
call_depths[thread] += 1
|
|
||||||
|
|
||||||
def append_to_datas(thread, data):
|
|
||||||
ensure_big_enough(datas, thread, [])
|
|
||||||
datas[thread].append(data)
|
|
||||||
|
|
||||||
with open("../src/profiler_reports/04.10.2019-13.29.21-140737348403048-profiler.report", "r") as file:
|
|
||||||
for line in file:
|
|
||||||
infos = line.split()
|
|
||||||
if infos[1] == "->":
|
|
||||||
incr_call_depth(thread)
|
|
||||||
append_to_datas(thread, {
|
|
||||||
"task": f"[T{thread}] - {'{:03d}'.format(call_depths[thread])}",
|
|
||||||
"start": int(infos[5]),
|
|
||||||
"end": None
|
|
||||||
})
|
|
||||||
elif infos[1] == "<-":
|
|
||||||
call_depths[thread] -= 1
|
|
||||||
for set in datas[thread][::-1]:
|
|
||||||
if set["end"] == None:
|
|
||||||
set["end"] = int(infos[2])
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print("couldn't find task that finished")
|
|
||||||
break
|
|
||||||
|
|
||||||
else:
|
|
||||||
print("neither -> nor <-")
|
|
||||||
|
|
||||||
|
|
||||||
fig = go.Figure(
|
|
||||||
layout = {
|
|
||||||
'barmode': 'stack',
|
|
||||||
"dragmode" : "pan",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
flat_datas= [item for sublist in datas for item in sublist]
|
|
||||||
# i = 1
|
|
||||||
# df = flat_datas[:20]
|
|
||||||
# for call in df:
|
|
||||||
# name = call["task"]
|
|
||||||
# start = call["start"]
|
|
||||||
# end = call["end"]
|
|
||||||
# duration = end,start
|
|
||||||
# fig.add_bar(x=(i,duration),
|
|
||||||
# y=(i,name),
|
|
||||||
# base=(i,start),
|
|
||||||
# orientation='h',
|
|
||||||
# showlegend=False,
|
|
||||||
# name=name,
|
|
||||||
# hovertext=f"yes",
|
|
||||||
# text=""
|
|
||||||
# )
|
|
||||||
# i += 1
|
|
||||||
|
|
||||||
df = pd.DataFrame(flat_datas[:20])
|
|
||||||
df['duration'] = df['end'] - df['start']
|
|
||||||
|
|
||||||
for stackdepth, stackdepth_df in df.groupby('task'):
|
|
||||||
params = {"x": stackdepth_df.duration,
|
|
||||||
"y": stackdepth_df.task,
|
|
||||||
"name": stackdepth,
|
|
||||||
"base": stackdepth_df.start
|
|
||||||
}
|
|
||||||
print(params)
|
|
||||||
fig.add_bar(**params,
|
|
||||||
orientation='h',
|
|
||||||
showlegend=False,
|
|
||||||
hovertext=f"yes",
|
|
||||||
text=""
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
fig.show(config={'scrollZoom': True})
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#lang racket
|
|
||||||
(require racket/gui mrlib/snip-canvas plot)
|
|
||||||
|
|
||||||
(define ((make-current-value-renderer fn) snip event x y)
|
|
||||||
(define overlays
|
|
||||||
(and x y (eq? (send event get-event-type) 'motion)
|
|
||||||
(list (vrule x #:style 'long-dash)
|
|
||||||
(point-label (vector x (fn x)) #:anchor 'auto))))
|
|
||||||
(send snip set-overlay-renderers overlays))
|
|
||||||
|
|
||||||
(define (make-plot-snip width height)
|
|
||||||
(define snip (plot-snip (function sin)
|
|
||||||
#:x-min 0 #:x-max (* 2 pi) #:y-min -1.5 #:y-max 1.5
|
|
||||||
#:width width #:height height))
|
|
||||||
(send snip set-mouse-event-callback (make-current-value-renderer sin))
|
|
||||||
snip)
|
|
||||||
|
|
||||||
(define toplevel (new frame% [label "Plot"] [width 500] [height 200]))
|
|
||||||
(define canvas (new snip-canvas% [parent toplevel] [make-snip make-plot-snip]))
|
|
||||||
(send toplevel show #t)
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 13 KiB |
@@ -1,173 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8-unix -*-
|
|
||||||
|
|
||||||
import datetime
|
|
||||||
import gantt
|
|
||||||
|
|
||||||
# Change font default
|
|
||||||
gantt.define_font_attributes(fill='black',
|
|
||||||
stroke='black',
|
|
||||||
stroke_width=0,
|
|
||||||
font_family="Verdana")
|
|
||||||
|
|
||||||
# Add vacations for everyone
|
|
||||||
gantt.add_vacations(datetime.date(2014, 12, 25))
|
|
||||||
gantt.add_vacations(datetime.date(2015, 1, 1))
|
|
||||||
gantt.add_vacations(datetime.date(2015, 1, 13))
|
|
||||||
|
|
||||||
# Create two resources
|
|
||||||
rANO = gantt.Resource('ANO')
|
|
||||||
rJLS = gantt.Resource('JLS')
|
|
||||||
|
|
||||||
# Add vacations for one lucky resource
|
|
||||||
rANO.add_vacations(
|
|
||||||
dfrom=datetime.date(2014, 12, 29),
|
|
||||||
dto=datetime.date(2015, 1, 4)
|
|
||||||
)
|
|
||||||
rANO.add_vacations(
|
|
||||||
dfrom=datetime.date(2015, 1, 6),
|
|
||||||
dto=datetime.date(2015, 1, 8)
|
|
||||||
)
|
|
||||||
|
|
||||||
# Test if this resource is avalaible for some dates
|
|
||||||
print(rANO.is_available(datetime.date(2015, 1, 5)))
|
|
||||||
print(rANO.is_available(datetime.date(2015, 1, 8)))
|
|
||||||
print(rANO.is_available(datetime.date(2015, 1, 6)))
|
|
||||||
print(rANO.is_available(datetime.date(2015, 1, 2)))
|
|
||||||
print(rANO.is_available(datetime.date(2015, 1, 1)))
|
|
||||||
|
|
||||||
|
|
||||||
# Create some tasks
|
|
||||||
t1 = gantt.Task(name='tache1',
|
|
||||||
start=datetime.date(2014, 12, 25),
|
|
||||||
duration=4,
|
|
||||||
percent_done=44,
|
|
||||||
resources=[rANO],
|
|
||||||
color="#FF8080")
|
|
||||||
t2 = gantt.Task(name='tache2',
|
|
||||||
start=datetime.date(2014, 12, 28),
|
|
||||||
duration=6,
|
|
||||||
resources=[rJLS])
|
|
||||||
t7 = gantt.Task(name='tache7',
|
|
||||||
start=datetime.date(2014, 12, 28),
|
|
||||||
duration=5,
|
|
||||||
percent_done=50)
|
|
||||||
t3 = gantt.Task(name='tache3',
|
|
||||||
start=datetime.date(2014, 12, 25),
|
|
||||||
duration=4,
|
|
||||||
depends_of=[t1, t7, t2],
|
|
||||||
resources=[rJLS])
|
|
||||||
t4 = gantt.Task(name='tache4',
|
|
||||||
start=datetime.date(2015, 1, 1),
|
|
||||||
duration=4,
|
|
||||||
depends_of=t1,
|
|
||||||
resources=[rJLS])
|
|
||||||
t5 = gantt.Task(name='tache5',
|
|
||||||
start=datetime.date(2014, 12, 23),
|
|
||||||
duration=3)
|
|
||||||
t6 = gantt.Task(name='tache6',
|
|
||||||
start=datetime.date(2014, 12, 25),
|
|
||||||
duration=4,
|
|
||||||
depends_of=t7,
|
|
||||||
resources=[rANO])
|
|
||||||
t8 = gantt.Task(name='tache8',
|
|
||||||
start=datetime.date(2014, 12, 25),
|
|
||||||
duration=4,
|
|
||||||
depends_of=t7,
|
|
||||||
resources=[rANO, rJLS])
|
|
||||||
|
|
||||||
|
|
||||||
# Create a project
|
|
||||||
p1 = gantt.Project(name='Projet 1')
|
|
||||||
|
|
||||||
# Add tasks to this project
|
|
||||||
p1.add_task(t1)
|
|
||||||
p1.add_task(t7)
|
|
||||||
p1.add_task(t2)
|
|
||||||
p1.add_task(t3)
|
|
||||||
p1.add_task(t5)
|
|
||||||
p1.add_task(t8)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Create another project
|
|
||||||
p2 = gantt.Project(name='Projet 2', color='#FFFF40')
|
|
||||||
|
|
||||||
# Add tasks to this project
|
|
||||||
p2.add_task(t2)
|
|
||||||
p2.add_task(t4)
|
|
||||||
|
|
||||||
|
|
||||||
# Create another project
|
|
||||||
p = gantt.Project(name='Gantt')
|
|
||||||
# wich contains the first two projects
|
|
||||||
# and a single task
|
|
||||||
p.add_task(p1)
|
|
||||||
p.add_task(p2)
|
|
||||||
p.add_task(t6)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Test cases for milestones
|
|
||||||
# Create another project
|
|
||||||
ptcm = gantt.Project(name='Test case for milestones')
|
|
||||||
|
|
||||||
tcm11 = gantt.Task(name='tcm11',
|
|
||||||
start=datetime.date(2014, 12, 25),
|
|
||||||
duration=4)
|
|
||||||
tcm12 = gantt.Task(name='tcm12',
|
|
||||||
start=datetime.date(2014, 12, 26),
|
|
||||||
duration=5)
|
|
||||||
ms1 = gantt.Milestone(name=' ',
|
|
||||||
depends_of=[tcm11, tcm12])
|
|
||||||
tcm21 = gantt.Task(name='tcm21',
|
|
||||||
start=datetime.date(2014, 12, 30),
|
|
||||||
duration=4,
|
|
||||||
depends_of=[ms1])
|
|
||||||
tcm22 = gantt.Task(name='tcm22',
|
|
||||||
start=datetime.date(2014, 12, 30),
|
|
||||||
duration=6,
|
|
||||||
depends_of=[ms1])
|
|
||||||
ms2 = gantt.Milestone(name='MS2',
|
|
||||||
depends_of=[ms1, tcm21, tcm22])
|
|
||||||
tcm31 = gantt.Task(name='tcm31',
|
|
||||||
start=datetime.date(2014, 12, 30),
|
|
||||||
duration=6,
|
|
||||||
depends_of=[ms2])
|
|
||||||
ms3 = gantt.Milestone(name='MS3', depends_of=[ms1])
|
|
||||||
|
|
||||||
|
|
||||||
ptcm.add_task(tcm11)
|
|
||||||
ptcm.add_task(tcm12)
|
|
||||||
ptcm.add_task(ms1)
|
|
||||||
ptcm.add_task(tcm21)
|
|
||||||
ptcm.add_task(tcm22)
|
|
||||||
ptcm.add_task(ms2)
|
|
||||||
ptcm.add_task(tcm31)
|
|
||||||
ptcm.add_task(ms3)
|
|
||||||
|
|
||||||
|
|
||||||
p.add_task(ptcm)
|
|
||||||
|
|
||||||
##########################$ MAKE DRAW ###############
|
|
||||||
p.make_svg_for_tasks(filename='test_full.svg',
|
|
||||||
today=datetime.date(2014, 12, 31),
|
|
||||||
start=datetime.date(2014, 8, 22),
|
|
||||||
end=datetime.date(2015, 1, 14))
|
|
||||||
p.make_svg_for_tasks(filename='test_full2.svg',
|
|
||||||
today=datetime.date(2014, 12, 31))
|
|
||||||
p.make_svg_for_tasks(filename='test.svg',
|
|
||||||
today=datetime.date(2014, 12, 31),
|
|
||||||
start=datetime.date(2015, 1, 3),
|
|
||||||
end=datetime.date(2015, 1, 6))
|
|
||||||
p1.make_svg_for_tasks(filename='test_p1.svg',
|
|
||||||
today=datetime.date(2014, 12, 31))
|
|
||||||
p2.make_svg_for_tasks(filename='test_p2.svg',
|
|
||||||
today=datetime.date(2014, 12, 31))
|
|
||||||
p.make_svg_for_resources(filename='test_resources.svg',
|
|
||||||
today=datetime.date(2014, 12, 31),
|
|
||||||
resources=[rANO, rJLS])
|
|
||||||
p.make_svg_for_tasks(filename='test_weekly.svg',
|
|
||||||
today=datetime.date(2014, 12, 31),
|
|
||||||
scale=gantt.DRAW_WITH_WEEKLY_SCALE)
|
|
||||||
##########################$ /MAKE DRAW ###############
|
|
||||||
|
Before Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 21 KiB |
@@ -46,6 +46,7 @@ proc add_to_load_path(const char* path) -> void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc built_in_load(String* file_name) -> Lisp_Object* {
|
proc built_in_load(String* file_name) -> Lisp_Object* {
|
||||||
|
profile_this();
|
||||||
char* file_content;
|
char* file_content;
|
||||||
char fullpath[4096];
|
char fullpath[4096];
|
||||||
sprintf(fullpath, "%s", Memory::get_c_str(file_name));
|
sprintf(fullpath, "%s", Memory::get_c_str(file_name));
|
||||||
@@ -89,6 +90,7 @@ proc built_in_load(String* file_name) -> Lisp_Object* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc built_in_import(String* file_name) -> Lisp_Object* {
|
proc built_in_import(String* file_name) -> Lisp_Object* {
|
||||||
|
profile_this();
|
||||||
Environment* new_env;
|
Environment* new_env;
|
||||||
|
|
||||||
new_env = Memory::file_to_env_map.get_object(Memory::get_c_str(file_name));
|
new_env = Memory::file_to_env_map.get_object(Memory::get_c_str(file_name));
|
||||||
@@ -114,12 +116,15 @@ proc built_in_import(String* file_name) -> Lisp_Object* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc load_built_ins_into_environment() -> void* {
|
proc load_built_ins_into_environment() -> void* {
|
||||||
|
profile_this();
|
||||||
String* file_name_built_ins = Memory::create_string(__FILE__);
|
String* file_name_built_ins = Memory::create_string(__FILE__);
|
||||||
|
|
||||||
define((helper), "") {
|
define((helper), "") {
|
||||||
|
profile_with_name("(helper)");
|
||||||
return Memory::create_lisp_object_number(101);
|
return Memory::create_lisp_object_number(101);
|
||||||
};
|
};
|
||||||
define((test (:k (helper))), "") {
|
define((test (:k (helper))), "") {
|
||||||
|
profile_with_name("(test)");
|
||||||
fetch(k);
|
fetch(k);
|
||||||
return k;
|
return k;
|
||||||
};
|
};
|
||||||
@@ -127,6 +132,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
"Takes 0 or more arguments and returns =t= if all arguments are equal "
|
"Takes 0 or more arguments and returns =t= if all arguments are equal "
|
||||||
"and =()= otherwise.")
|
"and =()= otherwise.")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(=)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
|
|
||||||
if (args == Memory::nil)
|
if (args == Memory::nil)
|
||||||
@@ -143,6 +149,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
define((> . args), "TODO")
|
define((> . args), "TODO")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(>)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
double last_number = strtod("Inf", NULL);
|
double last_number = strtod("Inf", NULL);
|
||||||
|
|
||||||
@@ -157,6 +164,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
define((>= . args), "TODO")
|
define((>= . args), "TODO")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(>=)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
double last_number = strtod("Inf", NULL);
|
double last_number = strtod("Inf", NULL);
|
||||||
|
|
||||||
@@ -171,6 +179,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
define((< . args), "TODO")
|
define((< . args), "TODO")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(<)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
double last_number = strtod("-Inf", NULL);
|
double last_number = strtod("-Inf", NULL);
|
||||||
|
|
||||||
@@ -185,6 +194,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
define((<= . args), "TODO")
|
define((<= . args), "TODO")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(<=)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
double last_number = strtod("-Inf", NULL);
|
double last_number = strtod("-Inf", NULL);
|
||||||
|
|
||||||
@@ -199,6 +209,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
define((+ . args), "TODO")
|
define((+ . args), "TODO")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(+)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
double sum = 0;
|
double sum = 0;
|
||||||
|
|
||||||
@@ -211,6 +222,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
define((- . args), "TODO")
|
define((- . args), "TODO")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(-)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
if (args == Memory::nil)
|
if (args == Memory::nil)
|
||||||
return Memory::create_lisp_object_number(0);
|
return Memory::create_lisp_object_number(0);
|
||||||
@@ -232,6 +244,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
define((* . args), "TODO")
|
define((* . args), "TODO")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(*)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
if (args == Memory::nil) {
|
if (args == Memory::nil) {
|
||||||
return Memory::create_lisp_object_number(1);
|
return Memory::create_lisp_object_number(1);
|
||||||
@@ -248,6 +261,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
define((/ . args), "TODO")
|
define((/ . args), "TODO")
|
||||||
{
|
{
|
||||||
|
profile_with_name("(/)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
|
|
||||||
if (args == Memory::nil) {
|
if (args == Memory::nil) {
|
||||||
@@ -266,6 +280,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::create_lisp_object_number(quotient);
|
return Memory::create_lisp_object_number(quotient);
|
||||||
};
|
};
|
||||||
define((** a b), "TODO") {
|
define((** a b), "TODO") {
|
||||||
|
profile_with_name("(**)");
|
||||||
fetch(a, b);
|
fetch(a, b);
|
||||||
try assert_type(a, Lisp_Object_Type::Number);
|
try assert_type(a, Lisp_Object_Type::Number);
|
||||||
try assert_type(b, Lisp_Object_Type::Number);
|
try assert_type(b, Lisp_Object_Type::Number);
|
||||||
@@ -273,6 +288,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
b->value.number));
|
b->value.number));
|
||||||
};
|
};
|
||||||
define((% a b), "TODO") {
|
define((% a b), "TODO") {
|
||||||
|
profile_with_name("(%)");
|
||||||
fetch(a, b);
|
fetch(a, b);
|
||||||
try assert_type(a, Lisp_Object_Type::Number);
|
try assert_type(a, Lisp_Object_Type::Number);
|
||||||
try assert_type(b, Lisp_Object_Type::Number);
|
try assert_type(b, Lisp_Object_Type::Number);
|
||||||
@@ -280,6 +296,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
(int)b->value.number);
|
(int)b->value.number);
|
||||||
};
|
};
|
||||||
define((get-random-between a b), "TODO") {
|
define((get-random-between a b), "TODO") {
|
||||||
|
profile_with_name("(get-random-between)");
|
||||||
fetch(a, b);
|
fetch(a, b);
|
||||||
try assert_type(a, Lisp_Object_Type::Number);
|
try assert_type(a, Lisp_Object_Type::Number);
|
||||||
try assert_type(b, Lisp_Object_Type::Number);
|
try assert_type(b, Lisp_Object_Type::Number);
|
||||||
@@ -293,6 +310,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::create_lisp_object_number(x);
|
return Memory::create_lisp_object_number(x);
|
||||||
};
|
};
|
||||||
define_special((bound? var), "TODO") {
|
define_special((bound? var), "TODO") {
|
||||||
|
profile_with_name("(bound?)");
|
||||||
fetch(var);
|
fetch(var);
|
||||||
try assert_type(var, Lisp_Object_Type::Symbol);
|
try assert_type(var, Lisp_Object_Type::Symbol);
|
||||||
|
|
||||||
@@ -305,6 +323,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define((assert test), "TODO") {
|
define((assert test), "TODO") {
|
||||||
|
profile_with_name("(assert)");
|
||||||
fetch(test);
|
fetch(test);
|
||||||
|
|
||||||
if (is_truthy(test))
|
if (is_truthy(test))
|
||||||
@@ -314,6 +333,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
};
|
||||||
define_special((define-syntax form (:doc "") . body), "TODO") {
|
define_special((define-syntax form (:doc "") . body), "TODO") {
|
||||||
|
profile_with_name("(define-syntax)");
|
||||||
fetch(form, doc, body);
|
fetch(form, doc, body);
|
||||||
|
|
||||||
try assert_type(doc, Lisp_Object_Type::String);
|
try assert_type(doc, Lisp_Object_Type::String);
|
||||||
@@ -350,6 +370,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define_special((define definee (:doc "") . body), "TODO") {
|
define_special((define definee (:doc "") . body), "TODO") {
|
||||||
|
profile_with_name("(define)");
|
||||||
fetch(definee, doc, body);
|
fetch(definee, doc, body);
|
||||||
|
|
||||||
// print_hm(get_current_environment()->hm);
|
// print_hm(get_current_environment()->hm);
|
||||||
@@ -405,6 +426,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define((mutate target source), "TODO") {
|
define((mutate target source), "TODO") {
|
||||||
|
profile_with_name("(mutate)");
|
||||||
fetch(target, source);
|
fetch(target, source);
|
||||||
|
|
||||||
if (target == Memory::nil ||
|
if (target == Memory::nil ||
|
||||||
@@ -427,11 +449,13 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return target;
|
return target;
|
||||||
};
|
};
|
||||||
define((vector-length v), "TODO") {
|
define((vector-length v), "TODO") {
|
||||||
|
profile_with_name("(vector-length)");
|
||||||
fetch(v);
|
fetch(v);
|
||||||
try assert_type(v, Lisp_Object_Type::Vector);
|
try assert_type(v, Lisp_Object_Type::Vector);
|
||||||
return Memory::create_lisp_object_number((double)v->value.vector.length);
|
return Memory::create_lisp_object_number((double)v->value.vector.length);
|
||||||
};
|
};
|
||||||
define((vector-ref vec idx), "TODO") {
|
define((vector-ref vec idx), "TODO") {
|
||||||
|
profile_with_name("(vector-ref)");
|
||||||
fetch(vec, idx);
|
fetch(vec, idx);
|
||||||
|
|
||||||
try assert_type(vec, Lisp_Object_Type::Vector);
|
try assert_type(vec, Lisp_Object_Type::Vector);
|
||||||
@@ -445,6 +469,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return vec->value.vector.data+int_idx;
|
return vec->value.vector.data+int_idx;
|
||||||
};
|
};
|
||||||
define((vector-set! vec idx val), "TODO") {
|
define((vector-set! vec idx val), "TODO") {
|
||||||
|
profile_with_name("(vector-set!)");
|
||||||
fetch(vec, idx, val);
|
fetch(vec, idx, val);
|
||||||
|
|
||||||
try assert_type(vec, Lisp_Object_Type::Vector);
|
try assert_type(vec, Lisp_Object_Type::Vector);
|
||||||
@@ -460,6 +485,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
define_special((set! sym val), "TODO") {
|
define_special((set! sym val), "TODO") {
|
||||||
|
profile_with_name("(set!)");
|
||||||
fetch(sym, val);
|
fetch(sym, val);
|
||||||
|
|
||||||
try assert_type(sym, Lisp_Object_Type::Symbol);
|
try assert_type(sym, Lisp_Object_Type::Symbol);
|
||||||
@@ -473,14 +499,13 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
|
|
||||||
|
|
||||||
push_environment(target_env);
|
push_environment(target_env);
|
||||||
{
|
define_symbol(sym, val);
|
||||||
define_symbol(sym, val);
|
|
||||||
}
|
|
||||||
pop_environment();
|
pop_environment();
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
};
|
};
|
||||||
define((set-car! target source), "TODO") {
|
define((set-car! target source), "TODO") {
|
||||||
|
profile_with_name("(set-car!)");
|
||||||
fetch(target, source);
|
fetch(target, source);
|
||||||
|
|
||||||
try assert_type(target, Lisp_Object_Type::Pair);
|
try assert_type(target, Lisp_Object_Type::Pair);
|
||||||
@@ -489,6 +514,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return source;
|
return source;
|
||||||
};
|
};
|
||||||
define((set-cdr! target source), "TODO") {
|
define((set-cdr! target source), "TODO") {
|
||||||
|
profile_with_name("(set-cdr!)");
|
||||||
fetch(target, source);
|
fetch(target, source);
|
||||||
|
|
||||||
try assert_type(target, Lisp_Object_Type::Pair);
|
try assert_type(target, Lisp_Object_Type::Pair);
|
||||||
@@ -497,6 +523,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return source;
|
return source;
|
||||||
};
|
};
|
||||||
define_special((if test then_part else_part), "TODO") {
|
define_special((if test then_part else_part), "TODO") {
|
||||||
|
profile_with_name("(if)");
|
||||||
fetch(test, then_part, else_part);
|
fetch(test, then_part, else_part);
|
||||||
|
|
||||||
bool truthy;
|
bool truthy;
|
||||||
@@ -511,10 +538,12 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
define_special((quote datum), "TODO") {
|
define_special((quote datum), "TODO") {
|
||||||
|
profile_with_name("(quote)");
|
||||||
fetch(datum);
|
fetch(datum);
|
||||||
return datum;
|
return datum;
|
||||||
};
|
};
|
||||||
define_special((quasiquote expr), "TODO") {
|
define_special((quasiquote expr), "TODO") {
|
||||||
|
profile_with_name("(quasiquote)");
|
||||||
fetch(expr);
|
fetch(expr);
|
||||||
Lisp_Object* quasiquote_sym = Memory::get_or_create_lisp_object_symbol("quasiquote");
|
Lisp_Object* quasiquote_sym = Memory::get_or_create_lisp_object_symbol("quasiquote");
|
||||||
Lisp_Object* unquote_sym = Memory::get_or_create_lisp_object_symbol("unquote");
|
Lisp_Object* unquote_sym = Memory::get_or_create_lisp_object_symbol("unquote");
|
||||||
@@ -615,6 +644,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return expr;
|
return expr;
|
||||||
};
|
};
|
||||||
define_special((and . args), "TODO") {
|
define_special((and . args), "TODO") {
|
||||||
|
profile_with_name("(and)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
bool result = true;
|
bool result = true;
|
||||||
in_caller_env {
|
in_caller_env {
|
||||||
@@ -627,6 +657,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::t;
|
return Memory::t;
|
||||||
};
|
};
|
||||||
define_special((or . args), "TODO") {
|
define_special((or . args), "TODO") {
|
||||||
|
profile_with_name("(or)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
in_caller_env {
|
in_caller_env {
|
||||||
@@ -639,6 +670,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define_special((not test), "TODO") {
|
define_special((not test), "TODO") {
|
||||||
|
profile_with_name("(not)");
|
||||||
fetch(test);
|
fetch(test);
|
||||||
bool truthy;
|
bool truthy;
|
||||||
in_caller_env {
|
in_caller_env {
|
||||||
@@ -673,6 +705,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
|
|
||||||
// // });
|
// // });
|
||||||
define_special((lambda args . body), "TODO") {
|
define_special((lambda args . body), "TODO") {
|
||||||
|
profile_with_name("(lambda)");
|
||||||
fetch(args, body);
|
fetch(args, body);
|
||||||
|
|
||||||
// creating new lisp object and setting type
|
// creating new lisp object and setting type
|
||||||
@@ -688,6 +721,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return func;
|
return func;
|
||||||
};
|
};
|
||||||
define((apply fun args), "TODO") {
|
define((apply fun args), "TODO") {
|
||||||
|
profile_with_name("(apply)");
|
||||||
fetch(fun, args);
|
fetch(fun, args);
|
||||||
Lisp_Object* result;
|
Lisp_Object* result;
|
||||||
|
|
||||||
@@ -696,6 +730,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
define((eval expr), "TODO") {
|
define((eval expr), "TODO") {
|
||||||
|
profile_with_name("(eval)");
|
||||||
fetch(expr);
|
fetch(expr);
|
||||||
Lisp_Object* result;
|
Lisp_Object* result;
|
||||||
|
|
||||||
@@ -706,6 +741,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
define_special((begin . args), "TODO") {
|
define_special((begin . args), "TODO") {
|
||||||
|
profile_with_name("(begin)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
Lisp_Object* result = Memory::nil;
|
Lisp_Object* result = Memory::nil;
|
||||||
in_caller_env {
|
in_caller_env {
|
||||||
@@ -716,10 +752,12 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
define((list . args), "TODO") {
|
define((list . args), "TODO") {
|
||||||
|
profile_with_name("(list)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
return args;
|
return args;
|
||||||
};
|
};
|
||||||
define((hash-map . args), "TODO") {
|
define((hash-map . args), "TODO") {
|
||||||
|
profile_with_name("(hash-map)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
Lisp_Object* ret;
|
Lisp_Object* ret;
|
||||||
try ret = Memory::create_lisp_object_hash_map();
|
try ret = Memory::create_lisp_object_hash_map();
|
||||||
@@ -732,6 +770,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
define((hash-map-get hm key), "TODO") {
|
define((hash-map-get hm key), "TODO") {
|
||||||
|
profile_with_name("(hash-map-get)");
|
||||||
fetch(hm, key);
|
fetch(hm, key);
|
||||||
try assert_type(hm, Lisp_Object_Type::HashMap);
|
try assert_type(hm, Lisp_Object_Type::HashMap);
|
||||||
|
|
||||||
@@ -742,18 +781,21 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
define((hash-map-set! hm key value), "TODO") {
|
define((hash-map-set! hm key value), "TODO") {
|
||||||
|
profile_with_name("(hash-map-set!)");
|
||||||
fetch(hm, key, value);
|
fetch(hm, key, value);
|
||||||
try assert_type(hm, Lisp_Object_Type::HashMap);
|
try assert_type(hm, Lisp_Object_Type::HashMap);
|
||||||
hm->value.hashMap->set_object(key, value);
|
hm->value.hashMap->set_object(key, value);
|
||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define((hash-map-delete! hm key), "TODO") {
|
define((hash-map-delete! hm key), "TODO") {
|
||||||
|
profile_with_name("(hash-map-delete!)");
|
||||||
fetch(hm, key);
|
fetch(hm, key);
|
||||||
try assert_type(hm, Lisp_Object_Type::HashMap);
|
try assert_type(hm, Lisp_Object_Type::HashMap);
|
||||||
hm->value.hashMap->delete_object(key);
|
hm->value.hashMap->delete_object(key);
|
||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define((vector . args), "TODO") {
|
define((vector . args), "TODO") {
|
||||||
|
profile_with_name("(vector)");
|
||||||
fetch(args);
|
fetch(args);
|
||||||
Lisp_Object* ret;
|
Lisp_Object* ret;
|
||||||
int length = list_length(args);
|
int length = list_length(args);
|
||||||
@@ -761,6 +803,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
define((pair car cdr), "TODO") {
|
define((pair car cdr), "TODO") {
|
||||||
|
profile_with_name("(pair)");
|
||||||
fetch(car, cdr);
|
fetch(car, cdr);
|
||||||
|
|
||||||
Lisp_Object* ret;
|
Lisp_Object* ret;
|
||||||
@@ -768,6 +811,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
define((first seq), "TODO") {
|
define((first seq), "TODO") {
|
||||||
|
profile_with_name("(first)");
|
||||||
fetch(seq);
|
fetch(seq);
|
||||||
if (seq == Memory::nil)
|
if (seq == Memory::nil)
|
||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
@@ -775,6 +819,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return seq->value.pair.first;
|
return seq->value.pair.first;
|
||||||
};
|
};
|
||||||
define((rest seq), "TODO") {
|
define((rest seq), "TODO") {
|
||||||
|
profile_with_name("(rest)");
|
||||||
fetch(seq);
|
fetch(seq);
|
||||||
if (seq == Memory::nil)
|
if (seq == Memory::nil)
|
||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
@@ -782,17 +827,20 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return seq->value.pair.rest;
|
return seq->value.pair.rest;
|
||||||
};
|
};
|
||||||
define((set-type! node new_type), "TODO") {
|
define((set-type! node new_type), "TODO") {
|
||||||
|
profile_with_name("(set-type!)");
|
||||||
fetch(node, new_type);
|
fetch(node, new_type);
|
||||||
try assert_type(new_type, Lisp_Object_Type::Keyword);
|
try assert_type(new_type, Lisp_Object_Type::Keyword);
|
||||||
node->userType = new_type;
|
node->userType = new_type;
|
||||||
return node;
|
return node;
|
||||||
};
|
};
|
||||||
define((delete-type! n), "TODO") {
|
define((delete-type! n), "TODO") {
|
||||||
|
profile_with_name("(delete-type!)");
|
||||||
fetch(n);
|
fetch(n);
|
||||||
n->userType = nullptr;
|
n->userType = nullptr;
|
||||||
return Memory::t;
|
return Memory::t;
|
||||||
};
|
};
|
||||||
define((type n), "TODO") {
|
define((type n), "TODO") {
|
||||||
|
profile_with_name("(type)");
|
||||||
fetch(n);
|
fetch(n);
|
||||||
|
|
||||||
if (n->userType) {
|
if (n->userType) {
|
||||||
@@ -828,6 +876,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::get_or_create_lisp_object_keyword("unknown");
|
return Memory::get_or_create_lisp_object_keyword("unknown");
|
||||||
};
|
};
|
||||||
define((mem-reset), "TODO") {
|
define((mem-reset), "TODO") {
|
||||||
|
profile_with_name("(mem-reset)");
|
||||||
Memory::reset();
|
Memory::reset();
|
||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
@@ -837,6 +886,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
// object. Otherwise (define k :doc "hallo" :keyword) would modify
|
// object. Otherwise (define k :doc "hallo" :keyword) would modify
|
||||||
// the global keyword
|
// the global keyword
|
||||||
define_special((info n), "TODO") {
|
define_special((info n), "TODO") {
|
||||||
|
profile_with_name("(info)");
|
||||||
fetch(n);
|
fetch(n);
|
||||||
|
|
||||||
print(n);
|
print(n);
|
||||||
@@ -908,6 +958,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define((show n), "TODO") {
|
define((show n), "TODO") {
|
||||||
|
profile_with_name("(show)");
|
||||||
fetch(n);
|
fetch(n);
|
||||||
try assert_type(n, Lisp_Object_Type::Function);
|
try assert_type(n, Lisp_Object_Type::Function);
|
||||||
|
|
||||||
@@ -920,11 +971,13 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define((addr-of var), "TODO") {
|
define((addr-of var), "TODO") {
|
||||||
|
profile_with_name("(addr-of-var)");
|
||||||
fetch(var);
|
fetch(var);
|
||||||
return Memory::create_lisp_object_number(
|
return Memory::create_lisp_object_number(
|
||||||
(float)((u64)&(var)));
|
(float)((u64)&(var)));
|
||||||
};
|
};
|
||||||
define((generate-docs file_name), "TODO") {
|
define((generate-docs file_name), "TODO") {
|
||||||
|
profile_with_name("(generate-docs)");
|
||||||
fetch(file_name);
|
fetch(file_name);
|
||||||
try assert_type(file_name, Lisp_Object_Type::String);
|
try assert_type(file_name, Lisp_Object_Type::String);
|
||||||
in_caller_env {
|
in_caller_env {
|
||||||
@@ -933,6 +986,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::t;
|
return Memory::t;
|
||||||
};
|
};
|
||||||
define((print (:sep " ") (:end "\n") . things), "TODO") {
|
define((print (:sep " ") (:end "\n") . things), "TODO") {
|
||||||
|
profile_with_name("(print)");
|
||||||
fetch(sep, end, things);
|
fetch(sep, end, things);
|
||||||
|
|
||||||
if (things != Memory::nil) {
|
if (things != Memory::nil) {
|
||||||
@@ -948,6 +1002,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define((read (:prompt ">")), "TODO") {
|
define((read (:prompt ">")), "TODO") {
|
||||||
|
profile_with_name("(read)");
|
||||||
fetch(prompt);
|
fetch(prompt);
|
||||||
print(prompt);
|
print(prompt);
|
||||||
|
|
||||||
@@ -960,21 +1015,25 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::create_lisp_object_string(strLine);
|
return Memory::create_lisp_object_string(strLine);
|
||||||
};
|
};
|
||||||
define((exit (:code 0)), "TODO") {
|
define((exit (:code 0)), "TODO") {
|
||||||
|
profile_with_name("(exit)");
|
||||||
fetch(code);
|
fetch(code);
|
||||||
try assert_type(code, Lisp_Object_Type::Number);
|
try assert_type(code, Lisp_Object_Type::Number);
|
||||||
exit((int)code->value.number);
|
exit((int)code->value.number);
|
||||||
};
|
};
|
||||||
define((break), "TODO") {
|
define((break), "TODO") {
|
||||||
|
profile_with_name("(break)");
|
||||||
in_caller_env {
|
in_caller_env {
|
||||||
print_environment(get_current_environment());
|
print_environment(get_current_environment());
|
||||||
}
|
}
|
||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define((memstat), "TODO") {
|
define((memstat), "TODO") {
|
||||||
|
profile_with_name("(memstat)");
|
||||||
Memory::print_status();
|
Memory::print_status();
|
||||||
return Memory::nil;
|
return Memory::nil;
|
||||||
};
|
};
|
||||||
define_special((mytry try_part catch_part), "TODO") {
|
define_special((mytry try_part catch_part), "TODO") {
|
||||||
|
profile_with_name("(mytry)");
|
||||||
fetch(try_part, catch_part);
|
fetch(try_part, catch_part);
|
||||||
|
|
||||||
Lisp_Object* result;
|
Lisp_Object* result;
|
||||||
@@ -993,6 +1052,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
define((load file), "TODO") {
|
define((load file), "TODO") {
|
||||||
|
profile_with_name("(load)");
|
||||||
fetch(file);
|
fetch(file);
|
||||||
try assert_type(file, Lisp_Object_Type::String);
|
try assert_type(file, Lisp_Object_Type::String);
|
||||||
|
|
||||||
@@ -1003,6 +1063,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
define((import f), "TODO") {
|
define((import f), "TODO") {
|
||||||
|
profile_with_name("(import)");
|
||||||
fetch(f);
|
fetch(f);
|
||||||
try assert_type(f, Lisp_Object_Type::String);
|
try assert_type(f, Lisp_Object_Type::String);
|
||||||
|
|
||||||
@@ -1014,12 +1075,14 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return Memory::t;
|
return Memory::t;
|
||||||
};
|
};
|
||||||
define((copy obj), "TODO") {
|
define((copy obj), "TODO") {
|
||||||
|
profile_with_name("(copy)");
|
||||||
fetch(obj);
|
fetch(obj);
|
||||||
// TODO(Felix): if we are copying string nodes, then
|
// TODO(Felix): if we are copying string nodes, then
|
||||||
// shouldn't the string itself also get copied??
|
// shouldn't the string itself also get copied??
|
||||||
return Memory::copy_lisp_object(obj);
|
return Memory::copy_lisp_object(obj);
|
||||||
};
|
};
|
||||||
define((error type message), "TODO") {
|
define((error type message), "TODO") {
|
||||||
|
profile_with_name("(error)");
|
||||||
fetch(type, message);
|
fetch(type, message);
|
||||||
// TODO(Felix): make the error function useful
|
// TODO(Felix): make the error function useful
|
||||||
try assert_type(type, Lisp_Object_Type::Keyword);
|
try assert_type(type, Lisp_Object_Type::Keyword);
|
||||||
@@ -1034,11 +1097,13 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
};
|
||||||
define((symbol->keyword sym), "TODO") {
|
define((symbol->keyword sym), "TODO") {
|
||||||
|
profile_with_name("(symbol->keyword)");
|
||||||
fetch(sym);
|
fetch(sym);
|
||||||
try assert_type(sym, Lisp_Object_Type::Symbol);
|
try assert_type(sym, Lisp_Object_Type::Symbol);
|
||||||
return Memory::get_or_create_lisp_object_keyword(sym->value.symbol);
|
return Memory::get_or_create_lisp_object_keyword(sym->value.symbol);
|
||||||
};
|
};
|
||||||
define((string->symbol str), "TODO") {
|
define((string->symbol str), "TODO") {
|
||||||
|
profile_with_name("(string->symbol)");
|
||||||
fetch(str);
|
fetch(str);
|
||||||
// TODO(Felix): do some sanity checks on the string. For
|
// TODO(Felix): do some sanity checks on the string. For
|
||||||
// example, numbers are not valid symbols.
|
// example, numbers are not valid symbols.
|
||||||
@@ -1048,6 +1113,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
Memory::duplicate_string(str->value.string));
|
Memory::duplicate_string(str->value.string));
|
||||||
};
|
};
|
||||||
define((symbol->string sym), "TODO") {
|
define((symbol->string sym), "TODO") {
|
||||||
|
profile_with_name("(symbol->string)");
|
||||||
fetch(sym);
|
fetch(sym);
|
||||||
|
|
||||||
try assert_type(sym, Lisp_Object_Type::Symbol);
|
try assert_type(sym, Lisp_Object_Type::Symbol);
|
||||||
@@ -1055,6 +1121,7 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
Memory::duplicate_string(sym->value.symbol));
|
Memory::duplicate_string(sym->value.symbol));
|
||||||
};
|
};
|
||||||
define((concat-strings . strings), "TODO") {
|
define((concat-strings . strings), "TODO") {
|
||||||
|
profile_with_name("(concat-strings)");
|
||||||
fetch(strings);
|
fetch(strings);
|
||||||
|
|
||||||
int resulting_string_len = 0;
|
int resulting_string_len = 0;
|
||||||
@@ -1076,3 +1143,4 @@ proc load_built_ins_into_environment() -> void* {
|
|||||||
};
|
};
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ proc create_extended_environment_for_function_application(
|
|||||||
Lisp_Object* function,
|
Lisp_Object* function,
|
||||||
bool should_evaluate) -> Environment*
|
bool should_evaluate) -> Environment*
|
||||||
{
|
{
|
||||||
profile_this;
|
profile_this();
|
||||||
bool is_c_function = Memory::get_type(function) == Lisp_Object_Type::CFunction;
|
bool is_c_function = Memory::get_type(function) == Lisp_Object_Type::CFunction;
|
||||||
Environment* new_env;
|
Environment* new_env;
|
||||||
Lisp_Object* arguments = unevaluated_arguments;
|
Lisp_Object* arguments = unevaluated_arguments;
|
||||||
@@ -226,7 +226,7 @@ proc create_extended_environment_for_function_application(
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc apply_arguments_to_function(Lisp_Object* arguments, Lisp_Object* function, bool should_evaluate_args) -> Lisp_Object* {
|
proc apply_arguments_to_function(Lisp_Object* arguments, Lisp_Object* function, bool should_evaluate_args) -> Lisp_Object* {
|
||||||
profile_this;
|
profile_this();
|
||||||
Environment* new_env;
|
Environment* new_env;
|
||||||
Lisp_Object* result;
|
Lisp_Object* result;
|
||||||
|
|
||||||
@@ -236,10 +236,12 @@ proc apply_arguments_to_function(Lisp_Object* arguments, Lisp_Object* function,
|
|||||||
pop_environment();
|
pop_environment();
|
||||||
};
|
};
|
||||||
|
|
||||||
// if c function:
|
|
||||||
if (Memory::get_type(function) == Lisp_Object_Type::CFunction)
|
if (Memory::get_type(function) == Lisp_Object_Type::CFunction)
|
||||||
|
// if c function:
|
||||||
try result = function->value.cFunction->body();
|
try result = function->value.cFunction->body();
|
||||||
else // if lisp function
|
else
|
||||||
|
// if lisp function
|
||||||
try result = eval_expr(function->value.function->body);
|
try result = eval_expr(function->value.function->body);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -357,7 +359,7 @@ proc copy_scl(Source_Code_Location*) -> Source_Code_Location* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc eval_arguments(Lisp_Object* arguments) -> Lisp_Object* {
|
proc eval_arguments(Lisp_Object* arguments) -> Lisp_Object* {
|
||||||
profile_this;
|
profile_this();
|
||||||
// int my_out_arguments_length = 0;
|
// int my_out_arguments_length = 0;
|
||||||
if (arguments == Memory::nil) {
|
if (arguments == Memory::nil) {
|
||||||
// *(out_arguments_length) = 0;
|
// *(out_arguments_length) = 0;
|
||||||
@@ -393,7 +395,7 @@ proc eval_arguments(Lisp_Object* arguments) -> Lisp_Object* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc eval_expr(Lisp_Object* node) -> Lisp_Object* {
|
proc eval_expr(Lisp_Object* node) -> Lisp_Object* {
|
||||||
profile_this;
|
profile_this();
|
||||||
|
|
||||||
using namespace Globals::Current_Execution;
|
using namespace Globals::Current_Execution;
|
||||||
call_stack.append(node);
|
call_stack.append(node);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace GC {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc garbage_collect() -> void {
|
proc garbage_collect() -> void {
|
||||||
profile_this;
|
profile_this();
|
||||||
++current_mark;
|
++current_mark;
|
||||||
|
|
||||||
for (auto it : protected_environments) maybe_mark(it);
|
for (auto it : protected_environments) maybe_mark(it);
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ proc unescape_string(char* in) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc read_entire_file(char* filename) -> char* {
|
proc read_entire_file(char* filename) -> char* {
|
||||||
|
profile_this();
|
||||||
char *fileContent = nullptr;
|
char *fileContent = nullptr;
|
||||||
FILE *fp = fopen(filename, "r");
|
FILE *fp = fopen(filename, "r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ namespace Memory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc init(int sms) -> void {
|
proc init(int sms) -> void {
|
||||||
|
profile_this();
|
||||||
char* exe_path = get_exe_dir();
|
char* exe_path = get_exe_dir();
|
||||||
// don't free exe path because it will be used until end of time
|
// don't free exe path because it will be used until end of time
|
||||||
add_to_load_path(exe_path);
|
add_to_load_path(exe_path);
|
||||||
@@ -192,8 +193,9 @@ namespace Memory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc reset() -> void {
|
proc reset() -> void {
|
||||||
free_spots_in_string_memory.next_index = 0;
|
profile_this();
|
||||||
|
|
||||||
|
free_spots_in_string_memory.next_index = 0;
|
||||||
|
|
||||||
global_symbol_table.~Hash_Map();
|
global_symbol_table.~Hash_Map();
|
||||||
global_keyword_table.~Hash_Map();
|
global_keyword_table.~Hash_Map();
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ namespace Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc parse_atom(char* text, int* index_in_text) -> Lisp_Object* {
|
proc parse_atom(char* text, int* index_in_text) -> Lisp_Object* {
|
||||||
|
profile_this();
|
||||||
Lisp_Object* ret;
|
Lisp_Object* ret;
|
||||||
// numbers
|
// numbers
|
||||||
if ((text[*index_in_text] <= 57 && // if number
|
if ((text[*index_in_text] <= 57 && // if number
|
||||||
@@ -231,7 +232,7 @@ namespace Parser {
|
|||||||
|
|
||||||
|
|
||||||
proc parse_list(char* text, int* index_in_text) -> Lisp_Object* {
|
proc parse_list(char* text, int* index_in_text) -> Lisp_Object* {
|
||||||
|
profile_this();
|
||||||
if (text[*index_in_text] != '(') {
|
if (text[*index_in_text] != '(') {
|
||||||
create_parsing_error("a list cannot be parsed here");
|
create_parsing_error("a list cannot be parsed here");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -338,6 +339,7 @@ namespace Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc parse_expression(char* text, int* index_in_text) -> Lisp_Object* {
|
proc parse_expression(char* text, int* index_in_text) -> Lisp_Object* {
|
||||||
|
profile_this();
|
||||||
Lisp_Object* ret;
|
Lisp_Object* ret;
|
||||||
eat_until_code(text, index_in_text);
|
eat_until_code(text, index_in_text);
|
||||||
try ret = maybe_expand_short_form(text, index_in_text);
|
try ret = maybe_expand_short_form(text, index_in_text);
|
||||||
@@ -372,6 +374,7 @@ namespace Parser {
|
|||||||
|
|
||||||
|
|
||||||
proc parse_program(String* file_name, char* text) -> Array_List<Lisp_Object*>* {
|
proc parse_program(String* file_name, char* text) -> Array_List<Lisp_Object*>* {
|
||||||
|
profile_this();
|
||||||
parser_file = file_name;
|
parser_file = file_name;
|
||||||
parser_line = 1;
|
parser_line = 1;
|
||||||
parser_col = 0;
|
parser_col = 0;
|
||||||
|
|||||||