Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 01:59 08 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : MMEDIT INCLUDE

Author Message
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 02:32am 03 May 2016
Copy link to clipboard 
Print this post

Hello,
How can use the MMEDIT Include directive?
I try, but it is not operates. My mistake, it is sure.
It would be better a sample code

drkl
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 07:38am 03 May 2016
Copy link to clipboard 
Print this post

One for TassyJim when he wakes up - and something I need a little more info about too

@TassyJim - can you please provide me a link to the latest version of MMEdit as I have been 'offline' for a few weeks and am keen to catch up! - Thanks Jim

EDIT: Can you also link me to the latest Font Editor too if possible (so much to catch up on )
Edited by WhiteWizzard 2016-05-04
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 01:12pm 03 May 2016
Copy link to clipboard 
Print this post

I missed the INCLUDE section out of the help file when I changed to CHM format.
Here is the text from the original help file:
  Quote  To make it easier to reuse code, you can add your library files using two methods.
In the Edit menu, you can Insert a file at the current location (actually after the current line) or at the end of the file.
The second method requires INCLUDE directives.
In the main code a comment line with either ‘$INCLUDE:’ (Quick Basic style) or ‘#INCLUDE’ (C style) with indicate where the include file is to be placed.
Running ‘merge include files’ from the ‘Program’ menu will insert the library files into the main file. A comment line will be inserted at the end of the include file so you know what code was added. The original include directive has another comment (‘) added to prevent subsequent merges from adding a second copy of the include file.
An include file can have its own includes.
In both cases, the added code is now part of the main file.


The following code:

Newdate$= date$
mainloop:
DOW (Newdate$, weekday, day$) ' returns day of week as number and string
splitdate (Newdate$, day, month, year)
toJD (day, month, year, jd) ' returns Julien Day Number
print today$;" "weekday;" ";day$ ;" - JD number: ";format$(jd,"%12.0f")

input "New Date", Newdate$
if Newdate$<>"" then goto mainloop

end
'$INCLUDE: date.bas

Will become:

Newdate$= date$
mainloop:
DOW (Newdate$, weekday, day$) ' returns day of week as number and string
splitdate (Newdate$, day, month, year)
toJD (day, month, year, jd) ' returns Julien Day Number
print today$;" "weekday;" ";day$ ;" - JD number: ";format$(jd,"%12.0f")

input "New Date", Newdate$
if Newdate$<>"" then goto mainloop

end
''$INCLUDE: date.bas
' given date as string, returns day, month, year
sub splitdate (currentdate$, d, m, y)
d= val(mid$(currentdate$,1,2))
m= val(mid$(currentdate$,4,2))
y= val(mid$(currentdate$,7,4))
end sub

'given day, month, year
'dayz=days since 1/1/1900 - agrees with Excel after 1/3/1900
sub toMSday (d, m, y, dayz, dayofyear)
dayofyear= d+int((m-1)*30.57+0.5)
if m>2 then
dayofyear= dayofyear-1
if (y mod 4)>0 then dayofyear= dayofyear-1
endif
dayz= int((y-1900)*365.25-0.25)+dayofyear+1
end sub

' given date as string, returns day of week as number and string
sub DOW (currentdate$,weekday, day$)
local d, m, y, dayz
splitdate (currentdate$, d, m, y)
toMSday (d, m, y, dayz, dayofyear)
weekday= abs((dayz-1) mod 7)
day$=mid$("SunMonTueWedThuFriSatSun",weekday*3+1,3)
end sub

' input day, month, year - returns julien day number
sub toJD ( d, m, y, jd)
ff = fix((m-14)/12)
jd = fix((1461*(y+4800+ff))/4)+fix((367*(m-2-12*ff))/12)-fix((3*(fix(y+4900+ff)/100))/4)+d-32075
end sub

'input julien day - returns day, month, year
sub fromJD (jd, d, m, y)
local l, n, i, j
l = jd + 68569
n = fix(( 4 * l ) / 146097)
l = l - fix(( 146097 * n + 3 ) / 4)
i = fix(( 4000 * ( l + 1 ) ) / 1461001)
l = l - fix(( 1461 * i ) / 4 )+ 31
j = fix(( 80 * l ) / 2447)
d = l - fix(( 2447 * j ) / 80)
l = fix(j / 11)
m = j + 2 - ( 12 * l )
y = 100 * ( n - 49 ) + i + l
end sub

'End INCLUDE

Everything between ''$INCLUDE: date.bas and 'End INCLUDE
was in the file date.bas

'$INCLUDE: date.bas and '$INCLUDE date.bas are identical.

Include files can be either in the code source folder or preferably in a separate ‘include’ folder.



I will be changing the INCLUDE section to allow for adding the INCLUDE's during 'load and run', leaving the source file as is.

@WW
The latest MMEdit is a few weeks old but available from my website.

Search here for latest Font Tweak. I will put it and the other utilities on my website eventually.

Jim
VK7JH
MMedit
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1000
Posted: 01:54pm 03 May 2016
Copy link to clipboard 
Print this post

  TassyJim said  
I will be changing the INCLUDE section to allow for adding the INCLUDE's during 'load and run', leaving the source file as is.


Thanks Jim, this will be good.
Latest F4 Latest H7 FotS
 
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 07:34pm 03 May 2016
Copy link to clipboard 
Print this post

Jim, many thanks,

Thank you the quick and exact answer.
I tested, it operates well.


TassyJim wrote:

  Quote  

I will be changing the INCLUDE section to allow for adding the INCLUDE's during 'load and run', leaving the source file as is.



Beside this, the original solution is remains?

drkl

 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 08:17pm 03 May 2016
Copy link to clipboard 
Print this post

  drkl said  
TassyJim wrote:

  Quote  

I will be changing the INCLUDE section to allow for adding the INCLUDE's during 'load and run', leaving the source file as is.



Beside this, the original solution is remains?

drkl


Yes, it will continue to work the same way as well as the extra option.

Jim
VK7JH
MMedit
 
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 03:19pm 31 Jul 2016
Copy link to clipboard 
Print this post

Hi Jim, this include directive does not seem to work with the macro upload function to Teraterm , is that correct. I use that method all the time and the include working with this would be very useful, is it possible?

Mike
Codenquilts
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 05:30pm 31 Jul 2016
Copy link to clipboard 
Print this post

Are you using the 'normal' file "lastfile.bas" or the 'crunched' one "lastfile.baz"?

I would rather not touch the normal one but I could add the INCLUDE to the crunched one. It shouldn't cause any grief for other users.

It will add more time delays every time users do a 'save'.

Jim

VK7JH
MMedit
 
MikeO
Senior Member

Joined: 11/09/2011
Location: Australia
Posts: 275
Posted: 06:10pm 31 Jul 2016
Copy link to clipboard 
Print this post

Hi Jim, I just use the crunched one, hardly ever use the other so that's not a drama. Its just that I have started using the Library memory area in the Umite and being able to add in include files that I know are change free to the one main file would be really useful.

Perhaps an option switch?

Cheers Mike Edited by MikeO 2016-08-02
Codenquilts
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025