Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I'm thinking of making an electronic agenda, in ICE. I don't have any code, but I have some plans:

A main launcher program, Appvars for Period 0-7, or 8?

AppVar structure:
20 bytes for class name, 500 bytes for whatever.

These sizes seem appropriate for a day-to day basis, but if you are using it to keep track of a week's worth of stuff... then... sux for you Razz

I'm planning on a homescreen in which you can select the period, which will open up an editor interface in which you can add content. I'll probably restrict input to A-Z, 0-9, and basic punctuation e.g. . , : @ # & * ( ) etc.


This may not be so practical, let me know what you think! I'll probably need some input routines, I've got AppVar stuff down pretty well Smile Any GUI suggestions might help as well!
Good idea, though would 20 bytes be enough for all class names?
It's actually 20 bytes at the start of *each* Period AppVar for the class name
Sorry, that is what I meant - as in there aren't any class names that are long? Or will you just be using abbreviations where applicable?
Well, if there are, I can always increase the size Wink, like AP Environmental Science (24) can be AP Environmental Sci (Less than 20), but I'll see... I might end up increasing the sizes anyways
SM84CE wrote:
Well, if there are, I can always increase the size Wink, like AP Environmental Science (24) can be AP Environmental Sci (Less than 20), but I'll see... I might end up increasing the sizes anyways

Every single class I took last semester had an official name that was longer than 20 characters...
    PROGRAMMING WITH JAVA
    WEB SITE PLANNING AND IMPLEMENTATION
    OPERATING SYSTEMS AND SCRIPTING
    CONFIGURING, MANAGING AND MAINTAINING COMPUTERS
    FRANÇAIS ET PROFESSIONS III

That's an average of 32.4 characters per course! For this reason, I second the idea of increasing the amount of memory allocated to the names of the courses.
Never said I would... so maybe 32-50, but who uses the official names? I call "AP Language and Composition" AP English, or just English... So here's my shortened version of your classes:

Java
WEB SITE P & I
OSes & SCRIPTING
CONFIG, MANAGe & MAINTAIN COMPUTERS (35), could be CMM COMPUTERS
French & Jobs 3 (assuming "professions" meant jobs)

BOOM!! All less that 20... EAT THAT!!!
Just Joking
***SM84CE RUUNS
SM84CE wrote:
Never said I would... so maybe 32-50, but who uses the official names? I call "AP Language and Composition" AP English, or just English... So here's my shortened version of your classes:

Java
WEB SITE P & I
OSes & SCRIPTING
CONFIG, MANAGe & MAINTAIN COMPUTERS (35), could be CMM COMPUTERS
French & Jobs 3 (assuming "professions" meant jobs)

BOOM!! All less that 20... EAT THAT!!!
Just Joking
***SM84CE RUUNS

Hahaha, we obviously don't use the official names, colloquially, the courses were usually named as follows:
    Java (or somestimes OOP)
    Web
    Linux
    [teacher name]'s class Laughing
    French
Anything I can store in the config file?
I'm thinking number of periods... (3) Just Joking

Also, I need help on an ICE input routine, one that can convert keypresses to either letters or numbers, depending on the input "mode". I'm also thinking of a key to access the special characters menu. The input system also needs to have delete act like backspace (or maybe like the OS action?)

Any help would be appreciated. is needed because I have no idea on how to do this, and this is the first time I've ever needed to design a custom input routine.

Code:

      For(P,0,8
         CloseAll
         If L1(P*3)=1
            sub("012345678",P,1->PSTR
            "Period"+PSTR->PSTR
            Open(PSTR,"r+
         End
         CloseAll
      End


Is some of this invalid? I'm just trying for a faster/smaller way to set up the Period AppVars w/o a ~5 line If L1(P*3)=1 / set up file / End statement for each period, but ICE gives an error on the "Period"+PSTR->... line, I don't know what I'm doing wrong, or will my method just not work?
SM84CE wrote:

Code:

      For(P,0,8
         CloseAll
         If L1(P*3)=1
            sub("012345678",P,1->PSTR
            "Period"+PSTR->PSTR
            Open(PSTR,"r+
         End
         CloseAll
      End


Is some of this invalid? I'm just trying for a faster/smaller way to set up the Period AppVars w/o a ~5 line If L1(P*3)=1 / set up file / End statement for each period, but ICE gives an error on the "Period"+PSTR->... line, I don't know what I'm doing wrong, or will my method just not work?


I think that string concatenation was removed from ICE...
try this:

Code:

      "Period:X"->PSTR
      For(P,0,8
         CloseAll
         If L1(P*3)=1
            48+P->*{PSTR+7
            Open(PSTR,"r+
         End
         CloseAll
      End

48+P will give ascii codes for the numbers 0-9 as long as P<9. This value is being stored to the 8th character of PSTR (PSTR+7), and will overwrite "X" in the initial string.

Hope this helps Smile
I'll test ASAP, thanks!

Now to poke PT_ to re-add that feature to ICE...
OK, so with a lot of help from beckadamtheinventor, I got an input routine working, and AgendaCE is now to the point to where you can select the periods you have (0-8), and it will create the AppVar for them.

32 bytes was allocated for the name of the class, and I just need to move the routine and mod it a bit so I can set a few vars, then call the routine and have the string stored to the Period appvar.

So after that, does anyone know how to do a word wrap in ICE? Moving the actual word to the next line seems hard, so I'm 100% ok if anyone has a routine that just cuts the string at the point where it runs off, then puts it on the next line, etc.

A quick AppVar list: (some are done, the rest of this list is definitely planned)
Agenda: main file, contents: none yet, just used as an "install" indicator (maybe # of the selected periods?)
PeriodX, where X is 0-8, contents: size of period class name str, 1 byte, class name str -- size from the previous byte
For word wrapping, I think the font might be monospaced. If that's the case, then obviously, you're in luck, because word wrapping instantly becomes super easy (just store the length of the string to a variable, then loop through the string displaying a substring of the max length that fits, incrementing the Y coordinate by 1 character height + buffer space each time). Here is how you could do it assuming the font is monospaced:

Code:
"THIS IS A SENTENCE THAT WILL NEED TO BE CUT"→Str0
1→A
1→B
If length(Str0)>26
While (length(Str0)-A)>26
Output(B,1,sub(Str0,A,26))
B+1→B
A+26→A
End
Output(B,1,sub(Str0,A,length(Str0)-A+1))
Else
Output(B,1,Str0)
End

For readability and simplicity, I used the Output() command, but that could easily be converted to use PrintStringXY instead (which is what I think you actually want). Of course in that case, you would have to increment C by the height of the characters + 2 or something, rather than 1, and all the 26s could be replaced with a larger number since more characters can fit onto a single line with the smaller C font.
PROGRESS UPDATE!!!

I got inputting class names working, thanks to beckadamtheinventor, who "invented" an input routine for me to use
I'm working on the class agenda input stuff, which needs word wrapping. LAX18 gave me some old code, I'll see what I can create!
Thanks to you two especially, because without you guys (And Cemetech, of course, for the encouragement! #AgendaCEforPOTMJuly2018 maybe...), AgendaCE would just be a flashy UI Razz

I just need to make the class name input thing "Call-able", then have a loop to Call it from the main section. I'll post screens later in the week/ whenever possible!

/me has a problem...

the below code doesn't seem to be writing anything to the AppVar, the size, when viewed in the CEmu vars menu, doesn't seem to be changing...

Code:

Alloc(9*3->PERIOD
//9x 3b entries
Data(3,0,0,0,0,0,0,0,0,0->PERIOD
Copy(L1,PERIOD,27
...
Open("Agenda","r+->SLOT
Rewind(SLOT
//do I need this?
Write(L1,27,1,SLOT


Also, in my input routine, the # of chars is in IX, And the string itself is in STR, why doesn't this write any data? (The size of the PeriodX AppVars don't seem to change, and don't really show anything in a hex editor...)


Code:

For(P,0,8
   If L1(P*3)=1
      Call NAME
   End
End
...
Lbl NAME
//input stuff...
//STR = string that was entered
//IX = # of chars in the string
CloseAll
"PeriodX->PSTR
48+P->*{PSTR+6
//store ASCII # of period, 0-8, to offset 6
Open(PSTR,"r+->SLOT
Write(IX,1,1,SLOT
Write(STR,IX,1,SLOT+1
Return


What am I doing wrong?
SM84CE wrote:
PROGRESS UPDATE!!!

I got inputting class names working, thanks to beckadamtheinventor, who "invented" an input routine for me to use
I'm working on the class agenda input stuff, which needs word wrapping. LAX18 gave me some old code, I'll see what I can create!
Thanks to you two especially, because without you guys (And Cemetech, of course, for the encouragement! #AgendaCEforPOTMJuly2018 maybe...), AgendaCE would just be a flashy UI Razz

I just need to make the class name input thing "Call-able", then have a loop to Call it from the main section. I'll post screens later in the week/ whenever possible!

/me has a problem...

the below code doesn't seem to be writing anything to the AppVar, the size, when viewed in the CEmu vars menu, doesn't seem to be changing...

Code:

Alloc(9*3->PERIOD
//9x 3b entries
Data(3,0,0,0,0,0,0,0,0,0->PERIOD
Copy(L1,PERIOD,27
...
Open("Agenda","r+->SLOT
Rewind(SLOT
//do I need this?
Write(L1,27,1,SLOT


Also, in my input routine, the # of chars is in IX, And the string itself is in STR, why doesn't this write any data? (The size of the PeriodX AppVars don't seem to change, and don't really show anything in a hex editor...)


Code:

For(P,0,8
   If L1(P*3)=1
      Call NAME
   End
End
...
Lbl NAME
//input stuff...
//STR = string that was entered
//IX = # of chars in the string
CloseAll
"PeriodX->PSTR
48+P->*{PSTR+6
//store ASCII # of period, 0-8, to offset 6
Open(PSTR,"r+->SLOT
Write(IX,1,1,SLOT
Write(STR,IX,1,SLOT+1
Return


What am I doing wrong?


First of all:

Code:

Data(3,0,0,0,0,0,0,0,0,0->PERIOD

Why is the same thing in there twice? Razz
EDIT: If you need to have PERIOD point to 27 zeroes, then use Data. If you just need memory, use Alloc.

Second: you do not need Rewind at the start; that is only necessary to put the file cursor at the start of the file, after the cursor is not at the start.

Third: you need to use Resize to set the size of the variable if you want to write extra bytes to a file, unless you use PutChar for that, but that is extremely slow in comparison (due to it re-allocating the file for every time a character is put outside the bounds of the file).


Code:

Open("Agenda","r+->SLOT
GetSize(SLOT->FLEN
Resize(FLEN+27,SLOT
Write(L1,27,1,SLOT
//other stuff
Close(SLOT


Fourthly: you used SLOT twice for two different files, both open at the same time; try using a different variable if you must have more than one file open at a time Wink

Fifthly: don't forget to close a file slot after you are done writing to it.
You can use Write without a Resize beckadamtheinventor.
MateoConLechuga wrote:
You can use Write without a Resize beckadamtheinventor.


I said that you couldn't re allocate the file with Write Wink To my knowledge, anyways.
beckadamtheinventor wrote:
MateoConLechuga wrote:
You can use Write without a Resize beckadamtheinventor.


I said that you couldn't re allocate the file with Write Wink To my knowledge, anyways.

And I'm saying you can.
I have reallocated a file with just Write. In fact I have never used Resize.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement