Skip to content

Commit

Permalink
First Commit. libqueue is mostly done; only sorting must be added. No…
Browse files Browse the repository at this point in the history
… leaks.
  • Loading branch information
keon94 committed Mar 23, 2017
0 parents commit 377f484
Show file tree
Hide file tree
Showing 27 changed files with 4,785 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Launch Extension",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
],
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/out/**/*.js"
],
"preLaunchTask": "npm"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${file}/queuetest"
},
{
"type": "node",
"request": "attach",
"name": "Attach to Process",
"address": "localhost",
"port": 5858
}
]
}
69 changes: 69 additions & 0 deletions scheduler/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/queuetest",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
},
{
"name": "C++ Attach",
"type": "cppdbg",
"request": "attach",
"program": "enter program name, for example ${workspaceRoot}/a.out",
"processId": "${command.pickProcess}",
"linux": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
}
]
}
119 changes: 119 additions & 0 deletions scheduler/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Change this line before submission
STUDENTLASTNAMES = Student1-Student2
PROGNAME = simulator

CC = gcc --std=gnu11
CFLAGS = -Wall -g


####################################################################
# IMPORTANT #
####################################################################
# Add files to their respective line to get this makefile to build #
# them. #
####################################################################
# NOTE: The submission scripts assume all files in `CFILELIST` end with
# .c and all files in `HFILES` end in .h
CFILELIST = simulator.c libscheduler/libscheduler.c libpriqueue/libpriqueue.c
HFILELIST = libscheduler/libscheduler.h libpriqueue/libpriqueue.h

# Add libraries that need linked as needed (e.g. -lm -lpthread)
LIBLIST =

# Include locations
INCLIST = ./src ./src/libscheduler ./src/libpriqueue

# Doxygen configuration file
DOXYGENCONF = ./doc/Doxyfile

####################################################################

SRCDIR = ./src/
OBJDIR = ./obj/

EXECNAME = $(patsubst %,./%,$(PROGNAME))

CFILES = $(patsubst %,$(SRCDIR)%,$(CFILELIST))
HFILES = $(patsubst %,$(SRCDIR)%,$(HFILELIST))
OFILES = $(patsubst %.c,$(OBJDIR)%.o,$(CFILELIST))

RAWC = $(patsubst %.c,%,$(addprefix $(SRCDIR), $(CFILELIST)))
RAWH = $(patsubst %.h,%,$(addprefix $(SRCDIR), $(HFILELIST)))

INCDIRS = $(patsubst %,-I%,$(INCLIST))

SUBMISSION = $(STUDENTLASTNAMES)-project2-scheduler

OBJINNERDIRS = $(patsubst $(SRCDIR)%,$(OBJDIR)%,$(shell find $(SRCDIR) -type d))
SUBMISSIONDIRS = $(addprefix $(SUBMISSION)/,$(shell find $(SRCDIR) -type d))

# Build the the quash executable
all: $(PROGNAME) queuetest

# Build the object directories
$(OBJINNERDIRS):
$(foreach dir, $(OBJINNERDIRS), mkdir -p $(dir);)

# Build the program
$(PROGNAME): $(OBJINNERDIRS) $(PROGNAME)-inner
$(PROGNAME)-inner: $(OFILES)
$(CC) $(CFLAGS) $^ -o $(PROGNAME) $(LIBLIST)


# Generic build target for all compilation units. NOTE: Changing a
# header requires you to rebuild the entire project
$(OBJDIR)%.o: $(SRCDIR)%.c $(HFILES)
$(CC) $(CFLAGS) -c $(INCDIRS) -o $@ $< $(LIBS)

# Build a testing harness for the priority queue
queuetest: $(OBJINNERDIRS) queuetest-inner
queuetest-inner: ./src/queuetest.c ./src/libpriqueue/libpriqueue.o
$(CC) $(CFLAGS) $^ -o queuetest $(LIBLIST)

# Build and run the program
test: all
./queuetest
./examples.pl

# Build the documentation for the project
doc: $(DOXYGENCONF) $(CFILES)
doxygen $(DOXYGENCONF)

# Quickly build a submission then extract it. Useful for testing if
# we will be able to build your project from the code you gave us
testsubmit: submit unsubmit

# Build a safeassign friendly submission of the quash project
submit: clean
# Perform renaming copies across the Makefile and all .c and .h
# files
cp Makefile Makefile.txt
$(foreach file, $(RAWH), cp $(file).h $(file)-h.txt;)
$(foreach file, $(RAWC), cp $(file).c $(file)-c.txt;)

# Make a temporary directory
mkdir -p $(SUBMISSION)
$(foreach dir, $(SUBMISSIONDIRS), mkdir -p $(dir);)

# Move all the renamed files into the temporary directory
mv Makefile.txt $(SUBMISSION)
$(foreach file, $(RAWH), mv $(file)-h.txt $(SUBMISSION)/$(file)-h.txt &&) \
$(foreach file, $(RAWC), mv $(file)-c.txt $(SUBMISSION)/$(file)-c.txt &&) \
zip -r $(SUBMISSION).zip $(SUBMISSION) # Create submission zip
-rm -rf $(SUBMISSION) # Remove temporary directory

# We will use this command to extract your submission and build
# it. Check to see if the build works before submitting.
unsubmit: $(SUBMISSION).zip
unzip $< && \
cd $(SUBMISSION) && \
mv Makefile.txt Makefile && \
$(foreach file, $(RAWH), mv $(file)-h.txt $(file).h &&) \
$(foreach file, $(RAWC), mv $(file)-c.txt $(file).c &&) \
make $(PROGNAME)

# Remove all generated files and directories
clean:
-rm -rf $(PROGNAME) queuetest obj *~ $(SUBMISSION)* doc/html

.PHONY: all test submit unsubmit testsubmit doc clean
Loading

0 comments on commit 377f484

Please sign in to comment.