Session 9

Of the videos, this is the ninth session. It is about filenames.

This will get replaced with the video (if the JavaScript runs properly).

The transcript below is autogenerated from YouTube, and needs to be cleaned up.

accession number nine and if we get fall goes well we’ll have 10 11 and 12 later on today actually as I look at the schedule for today we’re talking about things that are most most system dependent these are the things that are most concerned with the people in the audience I imagine because there are the things where you’re going to have to be responsible to make it work on your own system on the other hand the the percentage of things that I have to cover to the things that are in the book is is is much higher which means that i can i can go slower today yesterday i was take out i was taking huge parts of tech just waving my hands and say it does it’s sort of like this today we’re taking small parts of tech the small system dependent parts and we can go over them slowly and leisurely make sure that everyone gets a thorough understanding of what’s involved and file names is our is the agenda for this hour starts in module number 4 28 i think we’ll be able to keep the lights on all our as far as I nose for the TV people back there now here we’re getting into the subject which is which makes portable software the the most difficult because operating systems different operating systems differ in the way they want to refer to file names I thought once that maybe we should just say that in as if someone’s writing in tech and wants to say input from a file or name a font some file that text should have its own language for file names so that it could be independent of mob systems but there was just no way that I could do this and make it make it right a person who’s who’s using tech as one of his or her favorite tools on the system will definitely want to call file names by the by the same conventions that are used for other programs that are used in that system so we have to live with the fact then that there will be there will be programs written in tech that are going to include syntax that isn’t going to be possible on other on other installations of tech just in this place where we refer to names of fun now okay there should be something that works everywhere namely if we if we have a file at him if the name is entirely composed of letters then every version of text should be able to do a reasonable thing with it so I mean if someone says in input paper paper should refer to some file called paper that I think we’ll be able to handle on all on all installations are take the the strange thing happens that what if it’s somebody else’s paper and so we have to say input se for somebody else paper on one operating system or we have to save paper you know SE / paper on another system and paper bracket 1 comma se on another system and so on and there’s lots of other different kinds of bracketing xand things that are used in order to locate things in file file servers and on networks and various things then it’s going to be different everywhere and it depends on the system dependent version of tech two parts these names and to come up with something sensible about them now so in you know but I want to try to have a little bit of uniformity in all of this and and so I tried to write tech 82 in such a way that that the system dependency would be factored out into us into a small number of routines that could be caused that could be called in a system independent way and this this is a attempt then to get as much portability as we could given the fact that we that that we couldn’t be completely uniform across all systems now I’m sure that if I interviewing the people in the audience I’d get another long longer list of possibility to certainly I see the guy from MIT right right here and and they have a really strange bunch of conventions okay now we can talk about for example on their on their system is it you give two names separated by spaces and then paper is one of the ways to work it on that system and one of the things tech likes to say is that a space is a delimiter after a file name so if the name of the file is going to include spaces then they should put quote marks before and after and put end and and take spaces out inside of there for example some kind of a scheme like that would should be implemented it should also be consistent that somebody who did who does this can be comfortable with the idea that it will also work at MIT you know and off and all the other things the reason that MIT is and since Stanford tend to be more different is because they started first and the conventions persisted over over many years and the reason this whole thing is in such a mess is because computer scientists haven’t considered that file naming was was part of real computer science and and never really paid much attention to the problem I was always left off as being as being something uh for hackers or something and it was never but it’s never considered as a scientific problem and so we had this proliferation sayings is the same applies to elect to a almost as much a degree just in poly input output in general computer scientists have tended to work on what you do inside the machine once he got it in there and before you put it out but but it would input and output I never was was given a very clean solution in the in lightning languages like alcohol and so on where the where the the best language designers have really have really sad in committee meetings they didn’t they just didn’t make a tackle input-output because they did somehow I didn’t meet their taste for what wasn’t in what was an important problem at the time should have been but it but it didn’t so so we have this problem let’s see how we how we can approach it now the thing at the thing at ekta 82 wants to impose on is is at least one kind of thing at that a filename consists of three parts it consists of the main part paper and it consists of an area part which which indicates what area this this this might be on what location within a large pile directory and there’s an extension part now it seems to be that true that when using these systems that we’ve been talking about wearing that that it makes sense to have relate have related files and in the in the system’s we’ve been using here we relate the files by giving them the same name but different extensions so a person running paper would write a file called paper tech for example and then he could he could expect as a result of his run to get paper DVI for his output to DVI file paper dot e RR for the transcript file of his session containing is it error messages and more information diagnostic information if somebody has a font called basic I mean a format or macro package called basic tech and you input that to any tech you would expect to get out basic dots FMT for the format when we write a program in web text we have test web tech CH for the change file we can pie light into tech Doug pass ghoul or something for the Pascal file in tech pool for the string pool file some kind of this idea of having that having a family of names with extensions on it seems to work reasonably well with under operating systems and it could be you don’t need a doc for that if you don’t like a doc but in the examples in the tech manual it’s going to use a dot to indicate that now the area is is the or file directory or whatever you call it telling how you get there if it’s not specified you have some notion of a default area the world for example whatever the user is logged in under is that is used as the area but at every system you have some natural idea as to what that’s going to mean for the for the default area when no area is mentioned and when it is mentioned then it might even be partially be faulted and so on there’s there’s a variety of conventions for that let’s talk about fonts also here I’ve got a format file here I’ve got a paper file what if I have a front F F is my dis say the name of the font then when I’m running meta find I would have FFN F for the meta font source file and it would produce lots of different kinds of output it might produce F F dot DVI if we’re doing proof mode but for and an F F dot pxl for the bit image of the font f F dot and TFM is the one that concerns us the tech metric file this would give the information to tech and a variety of other possible things f F dot chr is what we’re using for files that can be edited so that you can you can not play with the pixels yourself low resolution okay so this idea of extension is there and we also have the program’s tf2 PL and PL the TF i’ll be talking about later today so that would so we could you could read the fft FM file and convert that into the FF type p.m. so for a variety of these things we receive seem that to see that we want a name of a name and then an extension telling what what’s classifier relating to this name is involved now slight difference it is there is exist though between font files and and these other kinds of files because usually the fronts are something that lived that their home is in the system while a person’s paper is on his own airing so when you specify no area for a paper it means your own login area dispensed by no area for a font it means the system font area if you want to use a font that’s only your own that you just made yourself with meta francais then you then you are supposed to really specify your own area specifically in the case of fonts because if you because if you leave it blank that’s what that’s going to mean the system font by that name unless that unless there is no system font by that name it would look but look first for the system time or so so our and I think that we have to realize that these that these are different so tech is using that assumption now that they that if the area is is blank give me it means the default their area of some sort but the default for fonts is the system font area the default for other things is the user is logged in I tried to get on a file name or where are you out there okay if on a file name for a tech source file we omit the directory and it’s not a representation that’s not in our area to look in the system area afterwards as it used to yes yes that it’s built in right now that we have a default the area to looks to look before complaining that we couldn’t find the file at all so it looks first on your area and then it looks on the cyst on a system area we’ll we’ll see that later on this hour i think i’ll get to that and this could be extended to look in several to go through a sequence of other areas in before giving up and saying i can’t find your file please give me another name but right but right now it the code does support 11 extra try on after the after backslash input okay good point now now in in the case of font files up we have to communicate the file name to the DVI file so after we get this after tech is red in the font file then the DVI file is going to contact to contain the name of that font for communication to the outside world and so the name the name of the font is given by giving its area and its name and both of those are our are sequences of ASCII codes so in the DVI file specification well we’ll see it later but it turns out that the area which is usually an empty for the system fonts and the name are given as a sequence of a speaker or more precisely tech internal codes so that the font name that you use comes out in a DVI file without the extension without at efn without any extension whatsoever okay now how are we going to do this I tried once to to think of a scheme that would encompass all of the world’s naming conventions for fun for files and as and then I would parse I i would i would parse this and i would have a universal every except MIT I left out MIT I had every other possible scheme of a file naming it like that I could find and I and then I was going to define the syntax for this and then put it all into the thing and then and then let the system dependent parts just just look at this or maybe even work working on all systems well that was a failure didn’t it couldn’t be done so instead I I I said what I’m going to do is I’m going to I’m going to ask everybody to write three procedures that are explained there in module 4 29 begin named morning and ends name and when tech comes to the to a point where it needs a filename for example it has just passed the keyword input or some other place we need to file a never more than you might imagine after France and so on then it will start and it will call the procedure begin name suppose somebody writes input and then after that he has a sequence of characters c1 c2 c3 and so on after this is after a macro expansion so tick will in supply tokens to the tooth or what characters actually to the to these releasing more names takes in CA ask a code tech internal code symbol as a parameter but beginning and ending don’t have parameters okay now what what tech is going to do and oh by the way this is a this also returns a value this is a function that returns a boolean value tech will first call begin name and then it will get the next character of the input and expanding macro if it was there and if if the next character is not is a tech primitive something like deaf or something like that then tech will immediately call n names say that that we’ve got to the end if it’s a blank space tech will also I believe call n name right away but if it’s a character then it will call more name of C and get value back your false more name is going to return true if the native if the name has hasn’t ended yet as far as it knows that this just didn’t even have to be the end of the name but morning would return false if this is definitely the end of the name in text should stop in textured should call n name immediately afterwards and so we’ll keep calling more name or name morning until we either get to something that tech thinks is the end of the name or until more name says false tech thinks it’s the end of the name when i get to something that isn’t the character or when i get to a blank space but this means that it for example at MIT if the first character of the name is a quote mark then more name would return true until it got to another quote mark in which i’ll protect that was false for example this is a way that that the logic of calling these three procedures would be would be the same on all systems but the three procedures themselves be be different now after and after this is all done an N name has been called then what’s supposed to happen is that we’re supposed to have three global variables have been set up called Kerr area her name and occur xed for the area of the name and the extension and these are string numbers these are pointers into text string pool giving what those areas are in as a string that could be printed out and print in principle so these are these are the result of n name will be will be those three areas those three of those three things and they’re all strings in the sense of text strings that we talked about a couple days ago if the one of the strings that you can have in tech is is the null string Pascal compilers don’t always allow all strings but any but if the null string is this is one of the ones that Tech has in its Putin would be used if the area is blank and the extensions plank so if sky just writes paper here it should her name should be the string PAP ER and kearny area incur text are blank that’s the one thing I want these leads to satisfy the other things are depending on what you think is appropriate for your particular system so for example if this just you know if if this if I had dek paper here and I was using a top-20 system then the the program would call begin name begin name would would set some kind of initialization so that it knows what it’s doing these three procedures typically will communicate with among themselves with global variables and then I’ll call more name of less than morning with the more name of Ed morning ok and so on morning until I get two more name of our and then I get a space and I wouldn’t call morning anymore i call n name or something up something besides like a backslash input again comes right after that and i would i would again quit okay now in order to illustrate that the program assumes a special kind of syntax that is that is typical of other ones that is one that was close enough to something i was familiar with that I could I could do and and so the example of how to write begin name more name and end name in this in these sections are based on us on a simple simple scheme that’s defined in module 4 30 and here’s the scheme that I that I proposed there if the name contains a greater than sign or a colon the file area consists of all characters up to including the final such character so if you had several colon several greater thans and so on it only the last one counts otherwise the area is known now after you’ve thrown away the area by this rule then you look for dartford four dots and if there’s if there’s several dots only the first one counts not the last but the first one comes and then that the extension would be every character including that first thought four foot nerve to the end otherwise the extension is known so that’s the that’s the that’s the proposed example that’s used in the in the program and it in order to implement that I did that by having to global variables called the area delimiter & the ex limiter and this would just be a place in the string tool where where the most recent irrelevant a delimiter has occurred either a greater than sign of colon or a period so we have so is it in in our score system for example in order for me to refer to paper I would have to say CSD dot dek paper and I could I could also refer to I could also say dot tech dot to in order to refer it to version two of the paper in that case this would be the area and this would be the extension because I pick up the first period and and I think I don’t count the period that’s in there okay now how does more name implement that well as simple it has a pointer to the the most recent of right greater than sign or colon and a pointer to periods and so it starts putting in the string pool a left arrow let’s see let me give myself another board here so i’ll have my area delimiter a and my exit delimiter e and initially there no so i put in the string pool the first character last and i’m going to see an S and be in a period well this looks like the X the external delimiter should be a period because this might be the extension coming up here not d e K and greater than sign comes along greater than sign says oh oh this is an area delimiter so I’m supposed to remember the length of the final greater than sign and so that comes here also I wipe out e at this time because though they don’t count it there in the area part and then it would say ta PE r dot e starts the point there if I got a colon now or something it would wipe this out again te eft period now I check with this period i checked with this guy though is is already non-null so I don’t change him again two and then end name is called end name has to figure out from the fact that a is pointing somewhere in East pointing somewhere that wouldn’t that this act that this string here is supposed to really be broken into three strings and so I think the code does that and it makes up three strings in a swing full according to the conventions of the string pool so that string start of Coeur area would be here string start of her name be here and spring start of corrects would be here so these three programs you need to write to do the right thing for your system now we also have to figure out how we’re going to open files that that are there in pets golf doesn’t give us a Pascal was really intended more for small self-contained it programs when it was this when it was designed but but it’s all it’s been always extended now so that it’s possible to on every Pascal I know of to say reset and then you say file name and then you have some file variable this is in your Pascal program and you have some way to say what file you want to open so let’s suppose that in this that we’re working with Pascal that allows us to put here like name a file okay table now let’s suppose that this has the string has to be of a certain definite link it that depends on you on which Pascal you have as to what happened but anyway you should be able to specify the name of some file that you want to to input to to the system routine for reset if you can’t do that you just can’t possibly use tech because tech has to be able to read from files that aren’t known that at compile time of the Pascal program so file variable and then we have some extension that allows us to do this either like some system call or something it’s got to be possible and it almost anything to you it is so now what about this string here well just see tech call teka when it does this it assumes that this string i believe is called name of file I should have reviewed this this morning but that’s it name of so we’re going to say that this parameter here is a is a very global variable called name of file and tech is going to set that global variable name of file before it tries to to to reset profile and the system procedure that does this is called pack file name and it’s in module 4 36 the pack file name has three parameters and a and E in this order and their string number which means that you know it’s an indication of the string its text it’s text idea of strings so so you give it the three strings that you found that after n named those things are supposed to exist in Kurr name and so on and then pack filename will do it now Tech is going to substitute its extension though sometimes you see that’s it so if cur name for example is paper and then Tech is going to is one output to pay per dr to pay per dr are then pack file name is going to be called with the extension part set to extreme grr so so tech look and similarly DVI FMT tech will generate other calls unpacked file name for other things with your bike but mean text going to manufacture combinations of file names according to this going to this procedure ok now we we need ok so pack file name does that and and puts into the global variable name of file the the thing the thing in the correct format now i don’t know if anybody here has a 10 x system one of the old deck operating systems but in that case in order to call reset on on one pascal compiler that i know of you had to have and you had to have two parameters in her name a file you’ve had to have a string and and a Pippin I mean the Pippin was given in what they called six bit code which was a pact which was a curiously packed 36-bit word full of six bit numbers and it’s the only way the operating system would accept it and and so the reset procedure had three parameters and so this pack filename procedure on such a on such a version of Pascal would would have to set two things one of them would require a calculation of a 6-bit code from the extension in some in some grungy manner but this was a this is necessary and I’m sure that that that there are even weirder systems in existence that are going to need this but that’s what why I put this up as a separate routine and don’t consider it system independent further further on the better Pascal compiler that i’m using now on sale system i have we put the area last you know instead of first and so pack file name is certainly different on this machine and is another so anyway hope you’ve got that one now there’s a there’s another program you need also besides pack file name which is packed buffered name and this one is not as clean it but it’s unfortunately necessary because sometimes we were going to have to be getting a file name before the tech has been able to set up its strings you see when text starts out and we’ve got a virgin version of tech it has to read in its strings it doesn’t know any strings it can’t use these idea of Coeur area her name her extent extension at all because strings don’t exist yet we have to get the format file so so the user is going to based on the user’s input will know whether there’s a format file or not or to use a standard format file like basic and we haven’t got strings yet so I have to do something special there and get the in get the name right out of the buffer and so this routine is got different kind of parameters and I was Annie’s the first parameter is called a small number a small number is 0 to 63 it’s generally even smaller and then a and B are also parameters to this thing but a na don’t don’t match the NNA there so it probably wasn’t a good good idea but these are integers but also typically small and the idea is that that we that we’re going to manufacture name of file from something in the buffer instead of using that the nice begin name or name in name conventions that we had there and this has to be done in the following way I have a string called tech format defaults and I illustrated it daring in module 4 39 as being something like this tech formats the basic tech basic format excuse me some string that indicates the thought the default file name that you would use the default name of file that you would use if the you if if there is no specified file name given and what’s what pack buffered name is supposed to do it’s supposed to take the first n characters of this string and then it’s supposed to take characters AE to be out of the buffer buffered is something used for input buffers for input from the terminal so buffer a through be inclusive and then the last four characters of this string dot FMT that’s the way that thing is defined right now this is a procedure pack buffer name that has to be used when tech is really bootstrapping itself to get going at the beginning of a job it’s not allowed to call error messages yet because the error routine isn’t isn’t uh workable hair routine these strings this is way at the beginning when and when not when Tech has set its just being born every time when it’s been if it’s been loaded and that is a messy but there’s no other way I mean had to do something at this point to get to get everything going so that routine is called only in module 4 41 it’s called three times though and what have what we had what happens is this suppose somebody calls tech and and and he’s running a virgin version of tech which means that it’s not any tech it’s the it’s the one that it’s the one I’ve used for production but it could be used but doesn’t have any format pre-loaded into it so the next thing that you that person writes is the name of the format so if if the next thing a person writes is amps tech for example then it should look for FMT in some system format area or in saw in the users format area and then you could say paper after that and then you would you it would be the paper that you’re better this would be a way to call it if you can’t support getting this on your command line this would be given to the double star prompt that you would get it right afterwards but in any case the first thing would be the format pilot that’s to be read in well what so it’s sitting in the buffer because this is company so this has somehow gotten into the buffer and tech will know where this thing starts in some position in the buffer some subscript in the buffer and it will know where it ends in the book in the buffer it for a blank spaces for this purpose I believe yeah now so format names should be given at least that’s the assumption that group that that we’re making here that and seems to be reasonable for all the systems we knew up um okay now so what is this module 441 do it looks first to see whether he’s got a backslash this might also be relaxed or some other primitive saying that I don’t want you know I tonight I don’t want you to input any file any any any source of other because it was the backsplash like this then we’re going to assume we got the basic format that we’re going to this default one going to come in so this world is not a backslash then we look for this dot FMT pretty sure that’s exactly if you first try without the system file area and with the dot FMT so we call pack buffered name on this hole on this thing but with N equals zero so we don’t pick up any of the of the first part and so it looked you look for AMS te egg dot F mt on the users on you this area it doesn’t find that then it tries next with the system file area so then it sets n equals some number that’s the number of strings to use it’s called format default length format default length is in and the next time so it will try for tektite formats am STX should find it then but if it doesn’t then it pulls out all the stops and uses this whole forum at default name since a and B to something like 0 1 and 0 or something so you won’t pick up anything off of the users area and that would be the normal case the normal case is that there is no specific format given here it just has the name of the persons paper and so a one-foot so it would pick up the system marion the user wouldn’t have to know that there was even a chance to specify another format at that point at that point your question yes why do we use the back plus the heart escaped after their sure why are you in the backlash they’re the kind of safeguard which may not be the facts life anymore yeah the the the backslash is always us assumed to be an escape character it’s the only character whose type is known but in the in in tech 82 we are starting out assuming that backslashes an escape character as an assumption this means really the code whose internal tech code is is octal 136 it thought it it doesn’t have to be visibly a backslash but it has to be the character that’s internal code is one is it me not at the code table initially understands letters and that and that backslash the this other idea that we had in tech in the present tech that the first character you type in is going to be your escape character sounded good to us at the time in 1977 but it’s caused no end the confusion ever since an end up and there were great sighs of relief when I when I told my group that we were going to assume that we know that it’s going to be back / one of the one of the most funny examples of this and the other case in tech was when look though a novice user approach tech that giveth gave the prompt of asterisk and type in was paper seemed a reasonable thing to do compared to other systems that were there well soapy was the backslash character he was the escape character so then it had a macro PA because this this escape character terminated at you see well that’s back /a that’s a knack sent and so I said well you have to define a font first this was very scary first encounter with now now this is going to work and and it’s a and we found that I think most users wanted that so that so if if you have some other character that that’s going to be the standard escape at your system you just publicize that in the manual on everybody will be glad to use it but this dis change ability of the escape character was not a win not opening ideas or dropping it if somebody says tech so they also the manual is going to say how do you run tech and so it’s going to say well you give the name of the file that you want or if you or if you’re going to do some simple experiment with it you say backslash relax you could say back / input paper wouldn’t hurt but if your first if the first thing that you type in is not a backslash it is sooo it essentially implies that it was back / input and if the first thing you type in was not a foot the name of a format it assumes that it’s going to be the default format we r s we wrestled around with lots of different possible strategies and this one turned out to be the one that seemed to satisfy all the requirements as well as anything think it’s going to work well okay that’s so packed buffered name is is this routine that has to be used in order to get the the format going at the beginning it’s only using that one place and and so if you have to do something special for your system you just have to do it at that at that time okay now let’s see module 4 42 talks about something that we’d like to do if you can but it’s not necessary to to make a change here that is a figure out what what actual of what’s the actual full name of the file that you have just open is so if I for example if I’m writing paper DVI it’d be nice if I had a system call that would say that this is actually paper DVI version 28 and so that on my on my transcript file and it will tell me that I have just written this one dot version 28 so that I can tell which which it was my transcript Fire will have a date and time on it if we’ve been able to implement that part but it was also nice to correlate that with the actual file that you’ve written out so there are calls it’s called jiff ins on top 20 and there’s a various ways to get at hidden things on the sale system and I’m sure backs it has different call this operon system usually have a way to say what is the exact full file name that I have just opened you have a question as if you have a system that doesn’t allow multiple versions yeah yeahs married automatic scratching of old versions or that’s what we’ll have yeah I said we have in fact even on system that allows multiple versions they tend to fill up the disk very fast and we and and if you’re paying for it uses pretty soon set that as your default although i have seen another place where i wasn’t paying for it like when i use the free services at xerox sometimes I I had run up about 210 versions of errors temp at one point before I ran out of memory and and had to had to go back to my recent version but you know they accumulate very fast and it’s nice to have but it’s a luxury and the system that I use every day I get by with only the most recent version and only only twice a year do i go through fits of anxiety because i just clobbered it something that i needed anyway if you’re used to working on that kind of a system you learn how to protect protect yourself against disasters most of the time here uh but I I don’t know just not everybody will agree with these things anyway we got this make name screen function which which is supposed to take either the file that you’ve just opened and find out what it is and so we give the nickname string I have three functions defined there a make name string for an alpha file be make names being for a bike file and W make name string for a word file only because only because in Pascal I had to have a type associated with a file name unless i’m writing a system procedure and these would return a string that gives me the full of the full farming and including like in our system it would tell me that that i found one on the system area if that was the one that was actually being input if you can’t do that you could generate it just from name of file but you’re supposed to generate a string like this a couple of times for error messages and for word for historical records that tech makes i guess i should mention alpha file is a file that corresponds to text like like your sources like your dot te x files that you’re inputting um be white file is a is a file of 8-bit bites like a TFM file or a DVI file and the word files are the fmt files the format files that we better made out of memory words that we store and retrieve for initializing tech is there some particular global that make name string is supposed to return the name of make name string returns a string number and it’s given the file a file variable as its input so so the idea is if F represents a channel or something you know if that represents a channel in dec jargon is similar to a file variable in pascal jog on whatever has just been opened on that file we should we should we should create a string in text string pool and return the number of that string so will you always be calling one of the type versions of this affair occurs yeah I always call one of the type versions right and by looking in the index you’ll see that it that each it’s only called about twice you know but there are those times when I when I when I do want to know the name of the file that i just opened for example when I when somebody says input paper at in the sale system and we saw that on in the demo the other day so what actually Kamala left parenthesis saying I’m starting to read a file and then it said paper was capitalized paper TDX that was the default extension applied at that time left bracket key I think whatever I was logged in under i think it was passed TK was was there that was printed up and that full name was supplied by my system dependent a make name string the this tour starting in module 4 44 here is supposed to be independent system independent now and not requiring any any changes by you guys and so it summarized the way we should have done is begin named morning n name this is the driver that calls that they’re also the driver is also called somewhere else where where it pulls the characters out of the buffer and when you’re declaring fonts that’s in the prompt filename routine which again is supposed to be machine machine and so the rest of this section is it tell us about the things that that ought to work everywhere a few of them might maybe might be mark sisson epen but i don’t think so so the critical problems about the timing of these things fitting it in with all of text input and output routines getting it to going in the right place I think I’ve done that in a system independent way all you have to do is is these routines that are defined without knowing much of the logic of tech just have to be their system assistant problems I try to factor out the they have the tech algorithms the things Pacific tech into end and leave you just with comparatively simple tasks begin named morning and that don’t depend on on the fact that tech is also writing paragraphs and and has it has even even that you don’t have to know that tech is going to be prompting the user to give you another one if you can’t find the other one I mean that logic and prompt file name is supposed to work in all versions of tech you won’t look at prom file name a minute that’s module 448 it it has two parameters one of them is it is descriptive of what kind of a file it’s it wants and the other one is the default extension that it would apply and it it it either says I can’t find file paper tech or something like that or it says I can’t write on file favor to print file name is a is a system dependent procedures that I neglected to me it must have been in one of those it must have been the all yes yes my module for 35 I didn’t mention you need a procedure that takes three strings as input in it and it prints them out as the name that might have produced and has such a simple procedure I’d short when I forgot to mention it so print file name is when you got it right also if unless it’s the same as the one there so it prints out the name that it can’t find and then it if the extension is da te a kit shows the context of the message in the case of save or send files and in the case of input files of it was appropriate to show to show the where the file name appeared in the person’s input but in the other cases this was a file name that was manufactured behind the scenes and the context wouldn’t make sense so sova so that’s why it doesn’t show context in any other cases with show context is a subroutine that prints out these two line indications of where you are in your source of error message then it’ll say please type another yes please type another input file name please type another output file name something like that it looks next to see an interaction that’s one of the things that tech has it’s a low it’s it’s four levels of interaction there’s batch mode non stop mode scroll mode and Hera stop mode and if the interaction level is either batch mode or non stop mode then you’re not supposed to ever mention a file name that couldn’t be found so your job is aborted at that time batch mode for example this is intended for overnight running and if you can’t find the file at that time you’re dead there’s nothing to substitute for but otherwise if you were in scroll motor air stop mode then you get a chance to input a new file name in the first two cases it would have at least told you what it’s what it couldn’t find before thought now let’s see so then it clears the terminal third terminal means show in case the user has been typing ahead cancel what he’s been typing ahead that’s a system be kind of thing you’d have to do come some people think they there they know what’s going to go on in a space they start typing away and and save themselves some time but in air like this occurs then they don’t want what they typed ahead to be considered the new file name so we clear that we prompt them and scan the file name in the buffer which is the next module that is another call on beginning mourn a man named the prompt input routine gets something from the terminal and puts it in the buffer after we’ve got the file name in it and we’ve got an empty extension we use es the default for empty extension we pack the current name that’s a macro call explained there that calls pack file name in with the current name Carrera and corrects tension so that’s the logic there in prawn farming that logic you shouldn’t have to change that logic was the you know is something that most about the rest of tech the other routines that I’ve mentioned don’t have to oh yeah one more thing I want to make one more point I want to make before I before we close before I forget it and that is this reset procedure here that opens a new file it’s not only supposed to be something that that is able to open another file but it’s supposed to be it’s it’s not supposed to give us a system error message in case it it couldn’t find the file and otherwise you will have to change text logic so I want to explain that if the orc and similarly rewrite is another one where where you have a file variable and a name of file where you’re trying to open get get ready to write on a certain file name that you’ve generated in your program now these I have procedure called open a open be open for alpha file opening and B file opening but and they’re going to return to or false based on whether or not they were successful in opening this but they call reset and rewrite you you need procedures reset and rewrite that are going to let you tell that that are going to let you know whether that file was there or not and the way the way hedrick’s Pascal does it I think is the best solution and that is it look at EO f at the end of after you’ve done a reset and and if yo F is its ball it is false then you are successful of on opening this file if you found in file for input because you’re not at the end of the file and for output if vof is true you’re successful you successfully gotten that file ready for output but if the opposite holds so if you try to reset and you found that you that eof was true this is what this is this scent of the flower wasn’t there and if you try to rewrite and you get a false eof you’re not in the file this is your clue that the file wasn’t there now if you do if on the other hand if you’re using a pascal runtime system that’s real smart and it says oh yes I couldn’t open his file so I so I’m going to ask the user for a file name myself well then the user might get an inscrutable error message that isn’t tied into the text system but then the up but but that’s not the worst of it the worst of it is that the that the reset procedure will always return this condition and so tech will always think no matter what the user typed that it was okay so for example you misspelled your family or uh then it appears in the error message you know they say you didn’t know what you’re supposed to be typed a question mark and tech will will then call to open the file ? tech for input okay well the the Pascal runtime working will try to open ? tech it won’t find it and it says you know it will say something like file not found ? detect a new file name what should it be so you type in a new file name oh yes sir paper tech and it finds it but then tech is going to going to look at this ? and think it was ok so it’s going to try ? grr for the transcript file and it’s going to try ? DVI for the output file because it because tech didn’t have any indication anything went wrong and so you’re going to get have to type all those three in and also afterwards so so it’s but so we want to use a version of reset we want to make sure that this reset gives gives the information and the chance to make error messages to to tech and that and doesn’t try to do it all itself if not you have to think of some other way around it ok no so that finishes our our first hour and five minutes Arthur is it quick yes on some systems that do that you might still be able to find out the name of the file that was opened oh there would be a way out probably but you will have to have to get into some of the logic of tech in that case and and and and work a little harder the right now it’s set up it’s set up for under the assumption that we are able to have a procedure open that will that will we be able to return true or false as to whether was successful opener or not and and we’re trying to give a good indication of what files we couldn’t we couldn’t open since you asked a question that reminded me you you would ask earlier a question about about the tech the standard area and what happens when you type backslash input so if you want to look that up that’s module 4 54 where the where the file for input is actually opened and the calls impact file name was a tech area that’s a macro defined to be the standard area used to be used in case you have an area that commonly commonly used input files up here okay I believe the same this exactly the same input systems are going to be used in Marathon so once you solve this problem for tech you’ll also have itself for marathon next year your job will be a lot easier okay have a nice break and see you again at eleven five

That's the end of this page. If you have any feedback about anything on this site, you can contact me here. To go back to the top-level page (if you are not on it already), click here.