From a446d39a66078827459427364ca7091834007526 Mon Sep 17 00:00:00 2001 From: Toby Hunag <619058900@qq.com> Date: Fri, 4 Aug 2017 15:06:43 +1000 Subject: [PATCH] initial the labs' work --- week3/DLList.c | 246 +++++++++++++++++++++++++++++++++++++++++++++++ week3/DLList.h | 65 +++++++++++++ week3/Makefile | 22 +++++ week3/myed | Bin 0 -> 18688 bytes week3/myed.c | 176 +++++++++++++++++++++++++++++++++ week3/testL | Bin 0 -> 14184 bytes week3/testList.c | 17 ++++ week3/text | 4 + 8 files changed, 530 insertions(+) create mode 100644 week3/DLList.c create mode 100644 week3/DLList.h create mode 100644 week3/Makefile create mode 100755 week3/myed create mode 100644 week3/myed.c create mode 100755 week3/testL create mode 100644 week3/testList.c create mode 100644 week3/text diff --git a/week3/DLList.c b/week3/DLList.c new file mode 100644 index 0000000..4af0bfa --- /dev/null +++ b/week3/DLList.c @@ -0,0 +1,246 @@ +// DLList.c - Implementation of doubly-linked list ADT +// Written by John Shepherd, March 2013 +// Modified by John Shepherd, August 2014, August 2015 + +#include +#include +#include +#include +#include "DLList.h" + +// data structures representing DLList + +typedef struct DLListNode { + char *value; // value of this list item (string) + struct DLListNode *prev; + // pointer previous node in list + struct DLListNode *next; + // pointer to next node in list +} DLListNode; + +typedef struct DLListRep { + int nitems; // count of items in list + DLListNode *first; // first node in list + DLListNode *curr; // current node in list + DLListNode *last; // last node in list +} DLListRep; + +// create a new DLListNode (private function) +static DLListNode *newDLListNode(char *it) +{ + DLListNode *new; + new = malloc(sizeof(DLListNode)); + assert(new != NULL); + new->value = strdup(it); + new->prev = new->next = NULL; + return new; +} + +// create a new empty DLList +DLList newDLList() +{ + struct DLListRep *L; + + L = malloc(sizeof (struct DLListRep)); + assert (L != NULL); + L->nitems = 0; + L->first = NULL; + L->last = NULL; + L->curr = NULL; + return L; +} + +// free up all space associated with list +void freeDLList(DLList L) +{ + assert(L != NULL); + DLListNode *curr, *prev; + curr = L->first; + while (curr != NULL) { + prev = curr; + curr = curr->next; + free(prev->value); + free(prev); + } + free(L); +} + +// trim off \n from strings (private function) +// this is needed for getDLList() because of fgets() +// alternatively, we could use the evil gets() function +static char *trim(char *s) +{ + int end = strlen(s)-1; + if (s[end] == '\n') s[end] = '\0'; + return s; +} + +// create an DLList by reading items from a file +// assume that the file is open for reading +// assume one item per line, line < 999 chars +DLList getDLList(FILE *in) +{ + DLList L; + DLListNode *new; + char line[1000]; + + L = newDLList(); + while (fgets(line,1000,in) != NULL) { + char *value = strdup(trim(line)); + new = newDLListNode(value); + if (L->last == NULL) { + L->first = L->last = new; + } + else { + L->last->next = new; + new->prev = L->last; + L->last = new; + } + L->nitems++; + } + L->curr = L->first; + return L; +} + +// display list to file, one item per line +// assumes that the file is open for writing +void putDLList(FILE *out, DLList L) +{ + assert(out != NULL); assert(L != NULL); + DLListNode *curr; + for (curr = L->first; curr != NULL; curr = curr->next) + fprintf(out,"%s\n",curr->value); +} + +// check sanity of a DLList (for testing) +int validDLList(DLList L) +{ + if (L == NULL) { + fprintf(stderr,"DLList is null\n"); + return 0; + } + if (L->first == NULL) { + // list is empty; curr and last should be null + if (L->last != NULL || L->curr != NULL) { + fprintf(stderr,"Non-null pointers in empty list\n"); + return 0; + } + } + else { + // list is not empty; curr and last should be non-null + if (L->last == NULL || L->curr == NULL) { + fprintf(stderr,"Null pointers in non-empty list\n"); + return 0; + } + } + int count; + DLListNode *curr; + // check scanning forward through list + count = 0; + for (curr = L->first; curr != NULL; curr = curr->next) { + if (curr->prev != NULL && curr->prev->next != curr) { + fprintf(stderr, "Invalid forward link into node (%s)\n",curr->value); + return 0; + } + if (curr->next != NULL && curr->next->prev != curr) { + fprintf(stderr, "Invalid backward link into node (%s)\n",curr->value); + return 0; + } + count++; + } + if (count != L->nitems) { + fprintf(stderr, "Forward count mismatch; counted=%d, nitems=%d\n", + count, L->nitems); + return 0; + } + // check scanning backward through list + count = 0; + for (curr = L->last; curr != NULL; curr = curr->prev) { + count++; + } + if (count != L->nitems) { + fprintf(stderr, "Backward count mismatch; counted=%d, nitems=%d\n", + count, L->nitems); + return 0; + } + // nothing went wrong => must be ok + return 1; +} + +// return item at current position +char *DLListCurrent(DLList L) +{ + assert(L != NULL); assert(L->curr != NULL); + return L->curr->value; +} + +// move current position (+ve forward, -ve backward) +// return 1 if reach end of list during move +// if current is currently null, return 1 +int DLListMove(DLList L, int n) +{ + assert(L != NULL); + if (L->curr == NULL) + return 1; + else if (n > 0) { + while (n > 0 && L->curr->next != NULL) { + L->curr = L->curr->next; + n--; + } + } + else if (n < 0) { + while (n < 0 && L->curr->prev != NULL) { + L->curr = L->curr->prev; + n++; + } + } + return (L->curr == L->first || L->curr == L->last) ? 1 : 0; +} + +// move to specified position in list +// i'th node, assuming first node has i==1 +int DLListMoveTo(DLList L, int i) +{ + assert(L != NULL); assert(i > 0); + L->curr = L->first; + return DLListMove(L, i-1); +} + +// insert an item before current item +// new item becomes current item +void DLListBefore(DLList L, char *it) +{ + assert(L != NULL); + // COMPLETE THIS FUNCTION +} + +// insert an item after current item +// new item becomes current item +void DLListAfter(DLList L, char *it) +{ + assert(L != NULL); + // COMPLETE THIS FUNCTION +} + +// delete current item +// new item becomes item following current +// if current was last, current becomes new last +// if current was only item, current becomes null +void DLListDelete(DLList L) +{ + assert (L != NULL); + // COMPLETE THIS FUNCTION +} + +// return number of elements in a list +int DLListLength(DLList L) +{ + return (L->nitems); +} + +// is the list empty? +int DLListIsEmpty(DLList L) +{ + return (L->nitems == 0); +} + diff --git a/week3/DLList.h b/week3/DLList.h new file mode 100644 index 0000000..83ebe83 --- /dev/null +++ b/week3/DLList.h @@ -0,0 +1,65 @@ +// DLList.h - Interface to doubly-linked list ADT +// Written by John Shepherd, March 2013 +// Last modified, August 2014 + +#ifndef DLLIST_H +#define DLLIST_H + +#include +#include "DLList.h" + +// External view of DLList +// Implementation given in DLList.c +// Implements a DLList of strings (i.e. items are strings) + +typedef struct DLListRep *DLList; + +// create a new empty DLList +DLList newDLList(); + +// free up all space associated with list +void freeDLList(DLList); + +// create an DLList by reading items from a file +// assume that the file is open for reading +DLList getDLList(FILE *); + +// display list to file, one item per line +// assumes that the file is open for writing +void putDLList(FILE *, DLList); + +// check sanity of a DLList (for testing) +int validDLList(DLList); + +// return item at current position +char *DLListCurrent(DLList); + +// move current position (+ve forward, -ve backward) +// return 1 if reach end of list during move +int DLListMove(DLList, int); + +// move to specified position in list +// i'th node, assuming first node has i==1 +int DLListMoveTo(DLList, int); + +// insert an item before current item +// new item becomes current item +void DLListBefore(DLList, char *); + +// insert an item after current item +// new item becomes current item +void DLListAfter(DLList, char *); + +// delete current item +// new item becomes item following current +// if current was last, current becomes new last +// if current was only item, current becomes null +void DLListDelete(DLList); + +// return number of elements in a list +int DLListLength(DLList); + +// is the list empty? +int DLListIsEmpty(DLList); + +#endif diff --git a/week3/Makefile b/week3/Makefile new file mode 100644 index 0000000..75c9633 --- /dev/null +++ b/week3/Makefile @@ -0,0 +1,22 @@ +# COMP1927 16s2 Week 04 Lab + +CC=gcc +CFLAGS=-Wall -Werror +BINS=testL myed + +all: $(BINS) + +testL : testList.o DLList.o + $(CC) -o testL testList.o DLList.o + +myed : myed.o DLList.o + $(CC) -o myed myed.o DLList.o + +DLList.o : DLList.c DLList.h + +myed.o : myed.c DLList.h + +testList.o : testList.c DLList.h + +clean: + rm -f $(BINS) *.o core diff --git a/week3/myed b/week3/myed new file mode 100755 index 0000000000000000000000000000000000000000..994119ca9a5d494f91839d3610b04a15f9547697 GIT binary patch literal 18688 zcmeHP3vg6bnm*|e2(P50AORGv4rqL&O+X=tV&~CtqcLV6aTsTzY0@3insmqR+mJZp z7%QN5wK&;TcX4)WhuU>#v>YvJM=7+{5QG6&XG@%2U1!vt)Ra2i#z$1ttc&)3|9RZL z_tNdKTU%4LRh(4!fBx@(oOAy3xc8nuH+TA4*1C#{m`X0Th7mVb>gAC5W^AyYvl6Rg z)0vkoVhh<+ASL*CxrC_5DLN@#D_Sb`ib1E~Q|A&uoy*HJik>TArl_hRQ7SK&yfQ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$LajSc{}wpK&Dk%H7tkLCuF0~j z0m3~4JFNI;gad_HOI>#{@W082P8gS z#+m;n1N@f-{Qm}cg{zX$>lN1Y4sgv1$b7bd9~Z|@y?1F=|Oz>kv#F}&v%!{H`>FwxsP z022%6ho)gu?Hz#cPWcdQoyV!Q_fgc?ah#ZW~aUY#U zK~O9&VcI>ICpA>$a_?B$75S^1b_nwg^%k#Rs#i6g8nzcSVGxh{yKxo@A@n!j2vfW& z>QBT&LCX;j9OT~>#^AHzva3L0l>IdhCM zdWY6-nL8>YUX`^=nI}HbYXr7}8Zkk;RgRxf>cg8oQ6uE3Z)mPI0^20FEt2qTO@#5j zc{s>C#B~Sa-OLjlh`^tqModVy7?t(^KWE{hgh%!k0)*RezNtXTC zVXyYFpE^fqOjnAMI_tj|IMrXpUp-%pO8Zw;V5Gf@pJdsi4*NZFzd-%}k0VM^QfK-5 z9rkL!ZObBIa0Lx+OLCS!3K{K*C^fYYVE#W4i!EiH_P+vFj*qfe`wngoX`ia^w0|8s z6hCFJ_Q@(w)1Kaapb#s2wI8VdUyJ&`EUFt+`D*;U>nLCSzk~_-pr-Vo#*?yFbR4L) z{^tH-jnE$!#Qauvik@)TtLNWgY47ZBD$AO_1Vg@5`}fM{lLw`}B&LaG=0qk7LOz{( z%KkEkzA9hQ3dmL2R@K|Qf-6;uQs`i9bH{2wDl0T7Hw4dva5X+EZfgCe`I)bLFDWC{ Os)bLmygZrZ +#include +#include +#include "DLList.h" + +// size of line buffers +#define MAX 100 + +int getCommand(char *s); +void showCurrLine(DLList); +void showHelp(); + + +int main(int argc, char *argv[]) +{ + // Variables used throughout main + + DLList lines; // lines from input file as a DLList + FILE *f; // file handle + char fname[MAX]; // file name + char cmd[MAX]; // command typed by user + int n; // line numbers/displacements + int done; // flag for end-of-edit-session + char new[MAX]; // buffer to hold newly inserted line + + // Check command-line args + + if (argc < 2) { + fprintf(stderr, "Usage: %s FileName\n", argv[0]); + return EXIT_FAILURE; + } + strcpy(fname,argv[1]); + if ((f = fopen(fname,"r")) == NULL) { + fprintf(stderr, "Can't open file %s\n", argv[1]); + return EXIT_FAILURE; + } + lines = getDLList(f); + fclose(f); + + // Main loop + + done = 0; + while (!done && getCommand(cmd)) { + switch (cmd[0]) { + case '.': + // show current line + showCurrLine(lines); + break; + case '%': + // show all lines + putDLList(stdout,lines); + break; + case 'n': + // move to next line + DLListMove(lines,1); + showCurrLine(lines); + break; + case 'p': + // move to previous line + DLListMove(lines,-1); + showCurrLine(lines); + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + // move to line NN + n = 0; // just in case ... + sscanf(cmd,"%d",&n); + DLListMoveTo(lines,n); + showCurrLine(lines); + break; + case '+': case '-': + // move forward/backward NN lines + sscanf(cmd,"%d",&n); + DLListMove(lines,n); + showCurrLine(lines); + break; + case 'i': + // read new line and insert in front of current + fgets(new,MAX,stdin); + new[strlen(new)-1] = '\0'; + DLListBefore(lines,new); + break; + case 'a': + // read new line and insert after current + fgets(new,MAX,stdin); + new[strlen(new)-1] = '\0'; + DLListAfter(lines,new); + break; + case 'd': + // delete current line + DLListDelete(lines); + break; + case 'w': + // write lines to FileName.new + strcat(fname,".new"); + if ((f = fopen(fname,"w")) == NULL) + fprintf(stderr, "Can't write %s\n",fname); + else { + putDLList(f,lines); + fclose(f); + } + break; + case '?': + showHelp(); + break; + case 'q': + done = 1; + break; + } + } + + // Finish up cleanly + + return EXIT_SUCCESS; +} + +// getCommand(buf) +// prompt for and read next user command +// store it in buf +// return 1 if got a command, 0 if EOF +int getCommand(char *buf) +{ + printf("> "); + return (fgets(buf, MAX, stdin) != NULL); +} + +// showCurrLine(lines) +void showCurrLine(DLList lines) +{ + printf("%s",DLListCurrent(lines)); + printf("\n"); +} + +// giveHelp() +// show help message +void showHelp() +{ + printf("Editor commands:\n"); + printf(". = show current line\n"); + printf("%% = show all lines\n"); + printf("p = move to previous line and show it\n"); + printf("n = move to next line and show it\n"); + printf("NN = move to line number NN\n"); + printf("+NN = move forward by NN lines and show line\n"); + printf("-NN = move backward by NN lines and show line\n"); + printf("i = read new line and insert in front of current\n"); + printf("a = read new line and insert after current\n"); + printf("d = delete current line\n"); + printf("w = write out contents of file to file FileName.new\n"); + printf("? = show this help message\n"); + printf("q = quit from the editor\n"); +} diff --git a/week3/testL b/week3/testL new file mode 100755 index 0000000000000000000000000000000000000000..7d6b29ea5d6eee16399865fe8590838d30cabdf4 GIT binary patch literal 14184 zcmeHOdvH`$nm^r5Ab=zt5I2Y;*IjVIAx#1TL44d!(%5lA$U>s%3O7x z?4q#(7F{hfnN_DOYpTprj^*w;RnE9Yp}PZ(Sm0Q*Q|QX<)7jLn?sO*VW=3?Pi)4S_ zdECDDrZa2pAN$X8QhmSk{l3RJ=R1#k?>RS*hFZ3GJszf#m)*&T%g@$1B(97V)^Jv0 z^=vNF*^O)|n+>E4Kb=d6ikza8(zT-HQqKoE3%`1=0P4Lu&nS9>fSIDIhD52nV$x++ z(B;<&R#C<@4v-zywfsiTf_CzZqV2LCMG9bSbrcU`8oFvXHZ&I?pKjl7N|_%I*(fNA>)w$uAYR%kpN5i|RK;Wpmk@ z-uRvkx31}p*7U{`nFBQk>NnJExHXVY2G;U+lYi2^yS0OtWW^C2)%jZdXbh12FaQ0| zzkTw#KT8MahVQs|X3>QuPc}S4vibO_eq$bu4SM`u!mh!O(yFgLaYJ`U#J}m+IWU&;|W|-(M&%xj7T~iOPNM@B;L!q_r}aLiF#wC z5lv=H))(pRO?D9%OQl%%!>PC#W8M9!c*5+4Ir%lxW&|$!BJkUtip2o$?Mo&kY_Pjq znj0F8wSl#P^;CVY?a$45FhXdIsPUY+K0cRp4v`_!#IjCKX>O>wLcpXApTjl8Ma7NQ z7#eFTskjlY#vjR4+z4MlfK1ggp5&YAr;=vFt)&LSl{Va`ltF84xP9HLx8e4AuiJ3d z_v9{Y!x11Wwb}4_77G2L56i>3vWrVJ7Cw?Uy;B#$LvNIyWmD_l0W`JZU0f@d>Bte^ zLzZKsQ%Eb`B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goRk#goVoQ>w+4*NBZJjC^`v; zxCD49!Xx^N1+dokiIZ8|P2zu%rS};Rez^Veq~6EX_xoxeM~b_;xcxX%9XPwadcQZN!{rWbdUkfECa^d{OsewLJ^(#;QmPfidjC<+lM-gF z$k02AvVYU7gQI;YPFNcS2Wd8blvVcXIq+U!xCLAGYF~k#A1Gx7v98jc#qUOr_KsBf zYX9N5v{&(0?{7*^(T8A9dr^v4`xJR;ugQ|!^_MWC_f1k&_G&+4RN5bqimH5f`wvU| z2C1j^({@UOyv?5W+}!rx1V%BT`cYE*Bh?a6`*cD&z5gk`c6+stQY-C;m7%2SxlGZg zT=x0dI@iog`{Q$^p(M&qq0b^?FJJAKMx~<5oX1+(5*@*h>{a~L{!PEMuTcW%P*U*| z9AhscW49k!sB_VXd^veZDM~84)k5j>F}uCm4{BQ^RNnm`%FjcM_5^4SP*VFw*8iOd z*t)vw{}V{CyI|R?_g}yIe;&(HWZd@u0GR5p%2)e1)nCz`KGdSFR`zPYO8sAu`u`s} z9IW`Oaqu6m^40$(Oe}){N$Cl$*ng@W;}F>EZ|#3+!eXZ~lvLR%dI`AQUcE2w)P#Y% zze(4gz5qkMRQo%%PA+~>uV@wIs%*RJXh3k~ tN>K`3EHB$NM7icsO&Gi=C*aq>-j1J&n_9m~T&n!qTZH|~t^m5r|8LHWD#`!= literal 0 HcmV?d00001 diff --git a/week3/testList.c b/week3/testList.c new file mode 100644 index 0000000..0c243ef --- /dev/null +++ b/week3/testList.c @@ -0,0 +1,17 @@ +// testList.c - testing DLList data type +// Written by John Shepherd, March 2013 + +#include +#include +#include +#include "DLList.h" + +int main(int argc, char *argv[]) +{ + DLList myList; + myList = getDLList(stdin); + putDLList(stdout,myList); + assert(validDLList(myList)); + // TODO: more tests needed here + return 0; +} diff --git a/week3/text b/week3/text new file mode 100644 index 0000000..488114b --- /dev/null +++ b/week3/text @@ -0,0 +1,4 @@ +this is +a small file +containing a few lines +of boring text