source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/src/plyclean/undo.cc @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.5 KB
Line 
1//
2// undo.cc:
3// Save every variable that changes, so that we can exactly "undo"
4// an operation by putting everything back the way it was.  This
5// allows us to try mesh simplification changes, and abort the
6// changes if we detect something bad happening (like a topology
7// change...)
8
9#include <stdio.h>
10#include <stdlib.h>
11#include <math.h>
12#include <ply.h>
13#include <Linear.h>
14#include <string.h>
15#include <strings.h>
16
17#include "Mesh.h"
18#include "plyio.h"
19#include "undo.h"
20
21
22
23// Buffer stuff to remember, undo.
24
25int google = 3;
26int google22 = 3;
27
28// Variables for storing the undo operation list
29bool saveUndo = FALSE;
30char  undoBuf[sizeof(void *)*MAXUNDOBUFSIZE];
31char *undoPtr;
32void *undoLoc[MAXUNDOBUFSIZE];
33int  undoSize[MAXUNDOBUFSIZE];
34int undoN = 0;
35
36// Variables for saving calls to delete().  We don't actually
37// delete until we see the commit...
38// (not implemented yet)
39void *undoFree[MAXUNDOBUFSIZE];
40int   undoFreeN = 0;
41
42void undo(void)
43{
44  // Undo all the saves, in backward order
45  while (--undoN >= 0) {
46    undoPtr -= undoSize[undoN]; 
47    bcopy(undoPtr, (char *) undoLoc[undoN], undoSize[undoN]);
48  }
49
50  // Turn saving off, until we checkpoint again
51  SaveOff();
52 
53}
54
55void SaveCheckpoint(void)
56{
57  // Commit previous operations -- delete anything sitting around...
58  // (not implemented yet)
59  undoFreeN = 0;
60
61  // Initialize variables to start saving again...
62  saveUndo = TRUE;
63  undoN = 0;
64  undoPtr = undoBuf;
65
66}
67
68
69void SaveOff(void)
70{
71  // Turn off saving
72  saveUndo = FALSE;
73 
74  undoFreeN = 0;
75  undoN = 0;
76  undoPtr = undoBuf;
77}
Note: See TracBrowser for help on using the repository browser.